2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
22 package jalview.fts.core;
24 import jalview.bin.Cache;
25 import jalview.fts.api.FTSDataColumnI;
26 import jalview.fts.api.GFTSPanelI;
27 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
28 import jalview.gui.Desktop;
29 import jalview.gui.IProgressIndicator;
30 import jalview.gui.JvSwingUtils;
31 import jalview.gui.SequenceFetcher;
32 import jalview.io.cache.JvCacheableInputBox;
33 import jalview.util.MessageManager;
34 import jalview.util.Platform;
36 import java.awt.BorderLayout;
37 import java.awt.CardLayout;
38 import java.awt.Dimension;
40 import java.awt.event.ActionEvent;
41 import java.awt.event.ActionListener;
42 import java.awt.event.FocusAdapter;
43 import java.awt.event.FocusEvent;
44 import java.awt.event.FocusListener;
45 import java.awt.event.ItemEvent;
46 import java.awt.event.ItemListener;
47 import java.awt.event.KeyAdapter;
48 import java.awt.event.KeyEvent;
49 import java.awt.event.MouseAdapter;
50 import java.awt.event.MouseEvent;
51 import java.text.DecimalFormat;
52 import java.util.ArrayList;
53 import java.util.Arrays;
54 import java.util.Collection;
55 import java.util.Collections;
56 import java.util.Comparator;
57 import java.util.HashSet;
58 import java.util.List;
60 import javax.swing.ImageIcon;
61 import javax.swing.JButton;
62 import javax.swing.JCheckBox;
63 import javax.swing.JComboBox;
64 import javax.swing.JFrame;
65 import javax.swing.JInternalFrame;
66 import javax.swing.JLabel;
67 import javax.swing.JPanel;
68 import javax.swing.JScrollPane;
69 import javax.swing.JTabbedPane;
70 import javax.swing.JTable;
71 import javax.swing.Timer;
72 import javax.swing.event.ChangeEvent;
73 import javax.swing.event.ChangeListener;
74 import javax.swing.event.DocumentEvent;
75 import javax.swing.event.DocumentListener;
76 import javax.swing.event.InternalFrameEvent;
77 import javax.swing.table.DefaultTableModel;
78 import javax.swing.table.TableColumn;
81 * This class provides the swing GUI layout for FTS Panel and implements most of
82 * the contracts defined in GFSPanelI
88 @SuppressWarnings("serial")
89 public abstract class GFTSPanel extends JPanel implements GFTSPanelI
91 private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
93 protected JInternalFrame mainFrame = new JInternalFrame(
96 protected JTabbedPane tabs = new JTabbedPane();
98 protected IProgressIndicator progressIndicator;
100 protected JComboBox<FTSDataColumnI> cmb_searchTarget = new JComboBox<>();
102 protected JButton btn_ok = new JButton();
104 protected JButton btn_back = new JButton();
106 protected JButton btn_cancel = new JButton();
108 protected JCheckBox btn_autosearch = new JCheckBox();
110 protected JvCacheableInputBox<String> txt_search;
112 protected SequenceFetcher seqFetcher;
114 protected Collection<FTSDataColumnI> wantedFields;
116 private String lastSearchTerm = "";
118 protected JButton btn_next_page = new JButton();
120 protected JButton btn_prev_page = new JButton();
122 protected StringBuilder errorWarning = new StringBuilder();
124 protected ImageIcon warningImage = new ImageIcon(
125 getClass().getResource("/images/warning.gif"));
127 protected ImageIcon loadingImage = new ImageIcon(
128 getClass().getResource("/images/loading.gif"));
130 protected ImageIcon balnkPlaceholderImage = new ImageIcon(
131 getClass().getResource("/images/blank_16x16_placeholder.png"));
133 protected JLabel lbl_warning = new JLabel(warningImage);
135 protected JLabel lbl_loading = new JLabel(loadingImage);
137 protected JLabel lbl_blank = new JLabel(balnkPlaceholderImage);
139 JTabbedPane tabbedPane = new JTabbedPane();
141 private JPanel pnl_actions = new JPanel();
143 private JPanel pnl_results = new JPanel(new CardLayout());
145 private JPanel pnl_inputs = new JPanel();
147 private BorderLayout mainLayout = new BorderLayout();
149 protected Object[] previousWantedFields;
151 protected int resultSetCount;
153 protected int totalResultSetCount;
155 protected int offSet;
157 protected int pageLimit;
159 protected HashSet<String> paginatorCart = new HashSet<>();
161 private static final int MIN_WIDTH = 670;
163 private static final int MIN_HEIGHT = 300;
165 protected static final DecimalFormat totalNumberformatter = new DecimalFormat(
168 private JTable tbl_summary = new JTable()
170 private boolean inLayout;
173 public boolean getScrollableTracksViewportWidth()
175 return hasExcessWidth();
180 public void doLayout()
182 if (hasExcessWidth())
184 autoResizeMode = AUTO_RESIZE_SUBSEQUENT_COLUMNS;
189 autoResizeMode = AUTO_RESIZE_OFF;
192 protected boolean hasExcessWidth()
194 return getPreferredSize().width < getParent().getWidth();
198 public void columnMarginChanged(ChangeEvent e)
204 TableColumn resizingColumn = getTableHeader().getResizingColumn();
205 // Need to do this here, before the parent's
206 // layout manager calls getPreferredSize().
207 if (resizingColumn != null && autoResizeMode == AUTO_RESIZE_OFF
210 resizingColumn.setPreferredWidth(resizingColumn.getWidth());
211 String colHeader = resizingColumn.getHeaderValue().toString();
212 getTempUserPrefs().put(colHeader, resizingColumn.getWidth());
218 public String getToolTipText(MouseEvent evt)
220 String toolTipText = null;
221 java.awt.Point pnt = evt.getPoint();
222 int rowIndex = rowAtPoint(pnt);
223 int colIndex = columnAtPoint(pnt);
227 if (getValueAt(rowIndex, colIndex) == null)
231 toolTipText = getValueAt(rowIndex, colIndex).toString();
233 } catch (Exception e)
237 toolTipText = (toolTipText == null ? null
238 : (toolTipText.length() > 500
239 ? JvSwingUtils.wrapTooltip(true,
240 toolTipText.subSequence(0, 500) + "...")
241 : JvSwingUtils.wrapTooltip(true, toolTipText)));
247 protected JScrollPane scrl_searchResult = new JScrollPane(tbl_summary);
254 public GFTSPanel(SequenceFetcher fetcher)
265 tabs.addTab(MessageManager.getString("label.retrieve_ids"),
267 fetcher.embedIn(this);
269 mainFrame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
270 final JPanel ftsPanel = this;
271 mainFrame.addFocusListener(new FocusAdapter()
274 public void focusGained(FocusEvent e)
276 // TODO: make selected tab gain focus in correct widget
278 && tabs.getSelectedComponent() == ftsPanel)
280 txt_search.getComponent().requestFocusInWindow();
284 mainFrame.invalidate();
286 } catch (Exception e)
293 * Initializes the GUI default properties
297 private void jbInit() throws Exception
300 txt_search = new JvCacheableInputBox<>(getCacheKey());
301 populateCmbSearchTargetOptions();
302 Integer width = getTempUserPrefs().get("FTSPanel.width") == null ? 800
303 : getTempUserPrefs().get("FTSPanel.width");
304 Integer height = getTempUserPrefs().get("FTSPanel.height") == null ? 400
305 : getTempUserPrefs().get("FTSPanel.height");
306 lbl_warning.setVisible(false);
307 lbl_warning.setFont(VERDANA_12);
308 lbl_loading.setVisible(false);
309 lbl_loading.setFont(VERDANA_12);
310 lbl_blank.setVisible(true);
311 lbl_blank.setFont(VERDANA_12);
313 tbl_summary.setAutoCreateRowSorter(true);
314 tbl_summary.getTableHeader().setReorderingAllowed(false);
315 tbl_summary.addMouseListener(new MouseAdapter()
318 public void mouseClicked(MouseEvent e)
324 public void mouseReleased(MouseEvent e)
329 tbl_summary.addKeyListener(new KeyAdapter()
332 public void keyPressed(KeyEvent evt)
335 switch (evt.getKeyCode())
337 case KeyEvent.VK_ESCAPE: // escape key
338 btn_back_ActionPerformed();
340 case KeyEvent.VK_ENTER: // enter key
341 if (btn_ok.isEnabled())
347 case KeyEvent.VK_TAB: // tab key
348 if (evt.isShiftDown())
350 tabbedPane.requestFocus();
354 btn_back.requestFocus();
364 JButton txt_help = new JButton("?");
365 txt_help.setFont(VERDANA_12);
366 txt_help.setPreferredSize(new Dimension(15, 15));
367 txt_help.setToolTipText(MessageManager.getString("action.help"));
368 txt_help.addActionListener(new ActionListener()
371 public void actionPerformed(ActionEvent e)
377 btn_autosearch.setText(MessageManager.getString("option.autosearch"));
378 btn_autosearch.setToolTipText(
379 MessageManager.getString("option.enable_disable_autosearch"));
380 btn_autosearch.setSelected(!Platform.isJS()
381 && Cache.getDefault(getAutosearchPreference(), true));
382 btn_autosearch.addActionListener(new java.awt.event.ActionListener()
385 public void actionPerformed(ActionEvent e)
387 jalview.bin.Cache.setProperty(getAutosearchPreference(),
388 Boolean.toString(btn_autosearch.isSelected()));
391 btn_back.setFont(VERDANA_12);
392 btn_back.setText(MessageManager.getString("action.back"));
393 btn_back.addActionListener(new java.awt.event.ActionListener()
396 public void actionPerformed(ActionEvent e)
398 btn_back_ActionPerformed();
401 btn_back.addKeyListener(new KeyAdapter()
404 public void keyPressed(KeyEvent evt)
406 if (evt.getKeyCode() == KeyEvent.VK_ENTER)
408 btn_back_ActionPerformed();
413 btn_ok.setEnabled(false);
414 btn_ok.setFont(VERDANA_12);
415 btn_ok.setText(MessageManager.getString("action.ok"));
416 btn_ok.addActionListener(new java.awt.event.ActionListener()
419 public void actionPerformed(ActionEvent e)
424 btn_ok.addKeyListener(new KeyAdapter()
427 public void keyPressed(KeyEvent evt)
429 if (evt.getKeyCode() == KeyEvent.VK_ENTER)
435 btn_next_page.setEnabled(false);
436 btn_next_page.setToolTipText(
437 MessageManager.getString("label.next_page_tooltip"));
438 btn_next_page.setFont(VERDANA_12);
439 btn_next_page.setText(MessageManager.getString("action.next_page"));
440 btn_next_page.addActionListener(new java.awt.event.ActionListener()
443 public void actionPerformed(ActionEvent e)
448 btn_next_page.addKeyListener(new KeyAdapter()
451 public void keyPressed(KeyEvent evt)
453 if (evt.getKeyCode() == KeyEvent.VK_ENTER)
460 btn_prev_page.setEnabled(false);
461 btn_prev_page.setToolTipText(
462 MessageManager.getString("label.prev_page_tooltip"));
463 btn_prev_page.setFont(VERDANA_12);
464 btn_prev_page.setText(MessageManager.getString("action.prev_page"));
465 btn_prev_page.addActionListener(new java.awt.event.ActionListener()
468 public void actionPerformed(ActionEvent e)
473 btn_prev_page.addKeyListener(new KeyAdapter()
476 public void keyPressed(KeyEvent evt)
478 if (evt.getKeyCode() == KeyEvent.VK_ENTER)
485 if (isPaginationEnabled())
487 btn_prev_page.setVisible(true);
488 btn_next_page.setVisible(true);
492 btn_prev_page.setVisible(false);
493 btn_next_page.setVisible(false);
496 btn_cancel.setFont(VERDANA_12);
497 btn_cancel.setText(MessageManager.getString("action.cancel"));
498 btn_cancel.addActionListener(new java.awt.event.ActionListener()
501 public void actionPerformed(ActionEvent e)
503 btn_cancel_ActionPerformed();
506 btn_cancel.addKeyListener(new KeyAdapter()
509 public void keyPressed(KeyEvent evt)
511 if (evt.getKeyCode() == KeyEvent.VK_ENTER)
513 btn_cancel_ActionPerformed();
517 scrl_searchResult.setPreferredSize(new Dimension(width, height));
519 cmb_searchTarget.setFont(VERDANA_12);
520 cmb_searchTarget.addItemListener(new ItemListener()
523 public void itemStateChanged(ItemEvent e)
525 if (e.getStateChange() == ItemEvent.SELECTED)
528 if ("all".equalsIgnoreCase(
529 getCmbSearchTarget().getSelectedItem().toString()))
531 tooltipText = MessageManager.getString("label.search_all");
533 else if ("pdb id".equalsIgnoreCase(
534 getCmbSearchTarget().getSelectedItem().toString()))
536 tooltipText = MessageManager
537 .getString("label.separate_multiple_accession_ids");
541 tooltipText = MessageManager.formatMessage(
542 "label.separate_multiple_query_values", new Object[]
543 { getCmbSearchTarget().getSelectedItem().toString() });
545 txt_search.getComponent().setToolTipText(
546 JvSwingUtils.wrapTooltip(true, tooltipText));
552 txt_search.getComponent().setFont(VERDANA_12);
554 txt_search.addKeyListener(new KeyAdapter()
557 public void keyPressed(KeyEvent e)
559 if (e.getKeyCode() == KeyEvent.VK_ENTER)
561 if (getTypedText() == null || getTypedText().isEmpty())
565 String primaryKeyName = getFTSRestClient()
566 .getPrimaryKeyColumn().getName();
567 if (primaryKeyName.equalsIgnoreCase(getCmbSearchTarget()
568 .getSelectedItem().toString()))
570 // TODO: nicer to show the list in the result set before
571 // viewing in Jalview perhaps ?
572 transferToSequenceFetcher(getTypedText());
576 performSearchAction();
581 final DeferredTextInputListener listener = new DeferredTextInputListener(
582 1500, new ActionListener()
585 public void actionPerformed(ActionEvent e)
587 if (btn_autosearch.isSelected()
588 || txt_search.wasEnterPressed())
590 performSearchAction();
594 txt_search.addDocumentListener(listener);
596 txt_search.addFocusListener(new FocusListener()
599 public void focusGained(FocusEvent e)
605 public void focusLost(FocusEvent e)
611 txt_search.addActionListener(new ActionListener()
614 public void actionPerformed(ActionEvent e)
616 performSearchAction();
619 final String searchTabTitle = MessageManager
620 .getString("label.search_result");
621 final String configureCols = MessageManager
622 .getString("label.configure_displayed_columns");
623 ChangeListener changeListener = new ChangeListener()
626 public void stateChanged(ChangeEvent changeEvent)
628 JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent
630 int index = sourceTabbedPane.getSelectedIndex();
632 btn_back.setVisible(true);
633 btn_cancel.setVisible(true);
634 btn_ok.setVisible(true);
635 if (sourceTabbedPane.getTitleAt(index).equals(configureCols))
637 btn_back.setVisible(false);
638 btn_cancel.setVisible(false);
639 btn_ok.setVisible(false);
640 btn_back.setEnabled(false);
641 btn_cancel.setEnabled(false);
642 btn_ok.setEnabled(false);
643 btn_next_page.setEnabled(false);
644 btn_prev_page.setEnabled(false);
645 txt_search.getComponent().setEnabled(false);
646 cmb_searchTarget.setEnabled(false);
647 previousWantedFields = getFTSRestClient()
648 .getAllDefaultDisplayedFTSDataColumns()
649 .toArray(new Object[0]);
651 if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle))
653 btn_back.setEnabled(true);
654 btn_cancel.setEnabled(true);
655 refreshPaginatorState();
656 txt_search.getComponent().setEnabled(true);
657 cmb_searchTarget.setEnabled(true);
658 if (wantedFieldsUpdated())
661 paginatorCart.clear();
670 tabbedPane.addChangeListener(changeListener);
671 tabbedPane.setPreferredSize(new Dimension(width, height));
672 tabbedPane.add(searchTabTitle, scrl_searchResult);
673 tabbedPane.add(configureCols, new FTSDataColumnPreferences(
674 PreferenceSource.SEARCH_SUMMARY, getFTSRestClient()));
676 pnl_actions.add(btn_back);
677 pnl_actions.add(btn_ok);
678 pnl_actions.add(btn_cancel);
680 pnl_results.add(tabbedPane);
681 pnl_inputs.add(cmb_searchTarget);
682 pnl_inputs.add(txt_search.getComponent());
683 pnl_inputs.add(txt_help);
684 pnl_inputs.add(btn_autosearch);
685 pnl_inputs.add(lbl_loading);
686 pnl_inputs.add(lbl_warning);
687 pnl_inputs.add(lbl_blank);
688 pnl_inputs.add(btn_prev_page);
689 pnl_inputs.add(btn_next_page);
691 this.setLayout(mainLayout);
692 this.add(pnl_inputs, java.awt.BorderLayout.NORTH);
693 this.add(pnl_results, java.awt.BorderLayout.CENTER);
694 this.add(pnl_actions, java.awt.BorderLayout.SOUTH);
695 mainFrame.setVisible(true);
698 tabs.setOpaque(true);
699 tabs.insertTab(MessageManager.getString("label.free_text_search"),
701 mainFrame.setContentPane(tabs);
702 tabs.setVisible(true);
706 mainFrame.setContentPane(this);
708 mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
709 mainFrame.addInternalFrameListener(
710 new javax.swing.event.InternalFrameAdapter()
713 public void internalFrameClosing(InternalFrameEvent e)
718 mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
719 Integer x = getTempUserPrefs().get("FTSPanel.x");
720 Integer y = getTempUserPrefs().get("FTSPanel.y");
721 if (x != null && y != null)
723 mainFrame.setLocation(x, y);
725 Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), width, height);
728 abstract protected void showHelp();
730 protected void closeAction()
732 getTempUserPrefs().put("FTSPanel.width", this.getWidth());
733 getTempUserPrefs().put("FTSPanel.height", pnl_results.getHeight());
734 getTempUserPrefs().put("FTSPanel.x", mainFrame.getX());
735 getTempUserPrefs().put("FTSPanel.y", mainFrame.getY());
737 txt_search.persistCache();
740 public class DeferredTextInputListener implements DocumentListener
742 private final Timer swingTimer;
744 public DeferredTextInputListener(int timeOut, ActionListener listener,
747 swingTimer = new Timer(timeOut, listener);
748 swingTimer.setRepeats(repeats);
762 public void insertUpdate(DocumentEvent e)
764 swingTimer.restart();
768 public void removeUpdate(DocumentEvent e)
770 swingTimer.restart();
774 public void changedUpdate(DocumentEvent e)
776 swingTimer.restart();
781 void performSearchAction()
783 String typed = getTypedText();
784 if (typed != null && typed.length() > 0
785 && !typed.equalsIgnoreCase(lastSearchTerm))
788 paginatorCart.clear();
789 lastSearchTerm = typed;
793 public boolean wantedFieldsUpdated()
795 if (previousWantedFields == null)
800 return Arrays.equals(getFTSRestClient()
801 .getAllDefaultDisplayedFTSDataColumns().toArray(new Object[0]),
802 previousWantedFields) ? false : true;
806 public void validateSelection()
808 if (tbl_summary.getSelectedRows().length > 0
809 || !paginatorCart.isEmpty())
811 btn_ok.setEnabled(true);
815 btn_ok.setEnabled(false);
819 public JComboBox<FTSDataColumnI> getCmbSearchTarget()
821 return cmb_searchTarget;
824 public JInternalFrame getMainFrame()
829 protected void delayAndEnableActionButtons()
839 } catch (InterruptedException e)
843 btn_ok.setEnabled(true);
844 btn_back.setEnabled(true);
845 btn_cancel.setEnabled(true);
850 protected void checkForErrors()
852 lbl_warning.setVisible(false);
853 lbl_blank.setVisible(true);
854 if (errorWarning.length() > 0)
856 lbl_loading.setVisible(false);
857 lbl_blank.setVisible(false);
858 lbl_warning.setToolTipText(
859 JvSwingUtils.wrapTooltip(true, errorWarning.toString()));
860 lbl_warning.setVisible(true);
865 * Action on Back button is to close this panel and open a new Sequence
868 public void btn_back_ActionPerformed()
871 new SequenceFetcher(progressIndicator);
874 protected void disableActionButtons()
876 btn_ok.setEnabled(false);
877 btn_back.setEnabled(false);
878 btn_cancel.setEnabled(false);
881 public void btn_cancel_ActionPerformed()
887 * Populates search target combo-box options
889 public void populateCmbSearchTargetOptions()
891 List<FTSDataColumnI> searchableTargets = new ArrayList<>();
894 Collection<FTSDataColumnI> foundFTSTargets = getFTSRestClient()
895 .getSearchableDataColumns();
896 searchableTargets.addAll(foundFTSTargets);
897 } catch (Exception e)
902 Collections.sort(searchableTargets, new Comparator<FTSDataColumnI>()
905 public int compare(FTSDataColumnI o1, FTSDataColumnI o2)
907 return o1.getName().compareTo(o2.getName());
911 for (FTSDataColumnI searchTarget : searchableTargets)
913 cmb_searchTarget.addItem(searchTarget);
917 public void transferToSequenceFetcher(String ids)
919 seqFetcher.setQuery(ids);
920 Thread worker = new Thread(seqFetcher);
925 public String getTypedText()
927 return txt_search.getUserInput();
931 public JTable getResultTable()
938 lbl_loading.setVisible(false);
939 errorWarning.setLength(0);
940 lbl_warning.setVisible(false);
941 lbl_blank.setVisible(true);
942 btn_ok.setEnabled(false);
943 mainFrame.setTitle(getFTSFrameTitle());
945 tbl_summary.setModel(new DefaultTableModel());
946 tbl_summary.setVisible(false);
950 public void setPrevPageButtonEnabled(boolean isEnabled)
952 btn_prev_page.setEnabled(isEnabled);
956 public void setNextPageButtonEnabled(boolean isEnabled)
958 btn_next_page.setEnabled(isEnabled);
962 public void setErrorMessage(String message)
964 errorWarning.append(message);
968 public void updateSearchFrameTitle(String title)
970 mainFrame.setTitle(title);
974 public void setSearchInProgress(Boolean isSearchInProgress)
976 lbl_blank.setVisible(!isSearchInProgress);
977 lbl_loading.setVisible(isSearchInProgress);
978 txt_search.setEditable(!isSearchInProgress);
982 public void prevPageAction()
984 updatePaginatorCart();
985 if (offSet >= pageLimit)
987 offSet = offSet - pageLimit;
992 refreshPaginatorState();
997 public void nextPageAction()
999 updatePaginatorCart();
1000 offSet = offSet + pageLimit;
1001 searchAction(false);
1004 public void updatePaginatorCart()
1006 int primaryKeyColIndex = 0;
1007 JTable resultTable = getResultTable();
1008 int totalRows = resultTable.getRowCount();
1011 primaryKeyColIndex = getFTSRestClient()
1012 .getPrimaryKeyColumIndex(wantedFields, false);
1013 } catch (Exception e)
1015 e.printStackTrace();
1018 for (int row = 0; row < totalRows; row++)
1020 String id = (String) resultTable.getValueAt(row, primaryKeyColIndex);
1021 if (paginatorCart.contains(id))
1023 paginatorCart.remove(id);
1026 int[] selectedRows = resultTable.getSelectedRows();
1027 for (int summaryRow : selectedRows)
1029 String idStr = resultTable.getValueAt(summaryRow, primaryKeyColIndex)
1031 paginatorCart.add(idStr);
1035 public void updateSummaryTableSelections()
1037 JTable resultTable = getResultTable();
1038 if (paginatorCart.isEmpty())
1042 int primaryKeyColIndex = 0;
1045 primaryKeyColIndex = getFTSRestClient()
1046 .getPrimaryKeyColumIndex(wantedFields, false);
1047 } catch (Exception e)
1049 e.printStackTrace();
1051 int totalRows = resultTable.getRowCount();
1052 for (int row = 0; row < totalRows; row++)
1054 String id = (String) resultTable.getValueAt(row, primaryKeyColIndex);
1055 if (paginatorCart.contains(id))
1057 resultTable.addRowSelectionInterval(row, row);
1060 validateSelection();
1063 public void refreshPaginatorState()
1065 setPrevPageButtonEnabled(false);
1066 setNextPageButtonEnabled(false);
1067 if (resultSetCount == 0 && pageLimit == 0)
1071 if (resultSetCount >= pageLimit)
1073 setNextPageButtonEnabled(true);
1075 if (offSet >= pageLimit)
1077 setPrevPageButtonEnabled(true);
1081 public void refresh()
1083 mainFrame.setTitle(getFTSFrameTitle());
1087 public abstract void okAction();