From: tcofoegbu Date: Mon, 2 May 2016 11:46:48 +0000 (+0100) Subject: JAL-1563 Fixed Uniprot FTS result-set count error, added blank image placeholder... X-Git-Tag: Release_2_10_0~234 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2dce7a14750a1a0484e71ba4c089ecfb44cc55b7;p=jalview.git JAL-1563 Fixed Uniprot FTS result-set count error, added blank image placeholder to prevent UI from jittering during a search operation, reverted timer for search textfield back to 1.5ses --- diff --git a/resources/images/blank_16x16_placeholder.png b/resources/images/blank_16x16_placeholder.png new file mode 100644 index 0000000..885ad87 Binary files /dev/null and b/resources/images/blank_16x16_placeholder.png differ diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index b68a358..cbadcbf 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1297,4 +1297,6 @@ label.run_groovy_tip = Run the script in the Groovy console over this alignment label.couldnt_run_groovy_script = Failed to run Groovy script label.uniprot_sequence_fetcher = UniProt Sequence Fetcher action.next_page= >> -action.prev_page= << \ No newline at end of file +action.prev_page= << +label.next_page_tooltop=Next Page +label.prev_page_tooltop=Previous Page \ No newline at end of file diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 02a313b..ccf33ed 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -91,7 +91,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected JButton btn_cancel = new JButton(); - protected JTextField txt_search = new JTextField(35); + protected JTextField txt_search = new JTextField(30); protected SequenceFetcher seqFetcher; @@ -189,10 +189,15 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected ImageIcon loadingImage = new ImageIcon(getClass().getResource( "/images/loading.gif")); + protected ImageIcon balnkPlaceholderImage = new ImageIcon(getClass() + .getResource("/images/blank_16x16_placeholder.png")); + protected JLabel lbl_warning = new JLabel(warningImage); protected JLabel lbl_loading = new JLabel(loadingImage); + protected JLabel lbl_blank = new JLabel(balnkPlaceholderImage); + private JTabbedPane tabbedPane = new JTabbedPane(); private JPanel pnl_actions = new JPanel(); @@ -229,6 +234,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI lbl_warning.setFont(new java.awt.Font("Verdana", 0, 12)); lbl_loading.setVisible(false); lbl_loading.setFont(new java.awt.Font("Verdana", 0, 12)); + lbl_blank.setVisible(true); + lbl_blank.setFont(new java.awt.Font("Verdana", 0, 12)); tbl_summary.setAutoCreateRowSorter(true); tbl_summary.getTableHeader().setReorderingAllowed(false); @@ -327,6 +334,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI }); btn_next_page.setEnabled(false); + btn_next_page.setToolTipText(MessageManager + .getString("label.next_page_tooltop")); btn_next_page.setFont(new java.awt.Font("Verdana", 0, 12)); btn_next_page.setText(MessageManager.getString("action.next_page")); btn_next_page.addActionListener(new java.awt.event.ActionListener() @@ -350,6 +359,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI }); btn_prev_page.setEnabled(false); + btn_prev_page.setToolTipText(MessageManager + .getString("label.prev_page_tooltop")); btn_prev_page.setFont(new java.awt.Font("Verdana", 0, 12)); btn_prev_page.setText(MessageManager.getString("action.prev_page")); btn_prev_page.addActionListener(new java.awt.event.ActionListener() @@ -465,7 +476,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI }); final DeferredTextInputListener listener = new DeferredTextInputListener( - 2500, + 1500, new ActionListener() { @Override @@ -490,7 +501,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI @Override public void focusLost(FocusEvent e) { - listener.stop(); +// listener.stop(); } }); @@ -552,6 +563,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI pnl_inputs.add(txt_search); pnl_inputs.add(lbl_loading); pnl_inputs.add(lbl_warning); + pnl_inputs.add(lbl_blank); pnl_inputs.add(btn_prev_page); pnl_inputs.add(btn_next_page); @@ -671,9 +683,11 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected void checkForErrors() { lbl_warning.setVisible(false); + lbl_blank.setVisible(true); if (errorWarning.length() > 0) { lbl_loading.setVisible(false); + lbl_blank.setVisible(false); lbl_warning.setToolTipText(JvSwingUtils.wrapTooltip(true, errorWarning.toString())); lbl_warning.setVisible(true); @@ -755,6 +769,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI lbl_loading.setVisible(false); errorWarning.setLength(0); lbl_warning.setVisible(false); + lbl_blank.setVisible(true); btn_ok.setEnabled(false); mainFrame.setTitle(getFTSFrameTitle()); referesh(); @@ -789,6 +804,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI @Override public void setSearchInProgress(Boolean isSearchInProgress) { + lbl_blank.setVisible(!isSearchInProgress); lbl_loading.setVisible(isSearchInProgress); } public void referesh() diff --git a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java index 57689f9..0541881 100644 --- a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java +++ b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java @@ -58,8 +58,7 @@ public class UniProtFTSRestClient extends FTSRestClient int responseSize = (uniportRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize() : uniportRestRequest.getResponseSize(); - int offSet = (uniportRestRequest.getOffSet() == 0) ? getDefaultResponsePageSize() - : uniportRestRequest.getOffSet(); + int offSet = uniportRestRequest.getOffSet(); String query = uniportRestRequest.getFieldToSearchBy() .equalsIgnoreCase("Search All") ? uniportRestRequest @@ -71,6 +70,9 @@ public class UniProtFTSRestClient extends FTSRestClient // : " AND status:REL"); // System.out.println(">>>>> Query : " + query); // System.out.println(">>>>> Columns : " + wantedFields); + // System.out.println(">>>>> Response size: " + responseSize + // + " offset : " + // + offSet); WebResource webResource = null; webResource = client.resource(UNIPROT_SEARCH_ENDPOINT) .queryParam("format", "tab") @@ -101,6 +103,12 @@ public class UniProtFTSRestClient extends FTSRestClient { FTSRestResponse searchResult = new FTSRestResponse(); List result = null; + if (uniProtTabDelimittedResponseString == null + || uniProtTabDelimittedResponseString.trim().isEmpty()) + { + searchResult.setNumberOfItemsFound(0); + return searchResult; + } String[] foundDataRow = uniProtTabDelimittedResponseString.split("\n"); if (foundDataRow != null && foundDataRow.length > 0) { diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index 3681a23..32f359e 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -114,13 +114,14 @@ public class UniprotFTSPanel extends GFTSPanel long endTime = System.currentTimeMillis(); resultSetCount = resultList.getNumberOfItemsFound(); - String result = (resultSetCount > 1) ? MessageManager + String result = (resultSetCount > 0) ? MessageManager .getString("label.results") : MessageManager .getString("label.result"); - if (isPaginationEnabled() && resultSetCount > 1) + if (isPaginationEnabled() && resultSetCount > 0) { updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result - + " " + offSet + " to " + (offSet + resultSetCount) + + " " + (offSet + 1) + " to " + + (offSet + resultSetCount) + " " + " (" + (endTime - startTime) + " milli secs)"); } else