From 756778e1bce242dd317b900431c9fe4b2823242e Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 16 Sep 2016 11:53:32 +0100 Subject: [PATCH] JAL-2183 don't open two free text panels; give input field focus --- resources/lang/Messages.properties | 2 +- src/jalview/fts/core/GFTSPanel.java | 13 +++++++++++-- src/jalview/fts/service/pdb/PDBFTSPanel.java | 2 +- src/jalview/fts/service/uniprot/UniprotFTSPanel.java | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index b01464a..f5b4f7a 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -772,7 +772,7 @@ label.select_backgroud_colour = Select Background Colour label.invalid_font = Invalid Font label.separate_multiple_accession_ids = Enter one or more accession IDs separated by a semi-colon ";" label.separate_multiple_query_values = Enter one or more {0}s separated by a semi-colon ";" -label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This Searches the entire database) +label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This searches the entire database) label.replace_commas_semicolons = Replace commas with semi-colons label.parsing_failed_syntax_errors_shown_below_param = Parsing failed. Syntax errors shown below {0} label.parsing_failed_unrecoverable_exception_thrown_param = \nParsing failed. An unrecoverable exception was thrown\:\n {0} diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 33fa020..30b6417 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -35,6 +35,7 @@ import java.awt.CardLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyAdapter; @@ -84,7 +85,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected JInternalFrame mainFrame = new JInternalFrame( getFTSFrameTitle()); - protected IProgressIndicator progressIdicator; + protected IProgressIndicator progressIndicator; protected JComboBox cmb_searchTarget = new JComboBox(); @@ -231,6 +232,14 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI try { jbInit(); + mainFrame.addFocusListener(new FocusAdapter() + { + @Override + public void focusGained(FocusEvent e) + { + txt_search.requestFocusInWindow(); + } + }); mainFrame.invalidate(); mainFrame.pack(); } catch (Exception e) @@ -757,7 +766,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected void btn_back_ActionPerformed() { closeAction(); - new SequenceFetcher(progressIdicator); + new SequenceFetcher(progressIndicator); } protected void disableActionButtons() diff --git a/src/jalview/fts/service/pdb/PDBFTSPanel.java b/src/jalview/fts/service/pdb/PDBFTSPanel.java index dc2b403..3fe8603 100644 --- a/src/jalview/fts/service/pdb/PDBFTSPanel.java +++ b/src/jalview/fts/service/pdb/PDBFTSPanel.java @@ -48,7 +48,7 @@ public class PDBFTSPanel extends GFTSPanel super(); pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize(); this.seqFetcher = seqFetcher; - this.progressIdicator = (seqFetcher == null) ? null : seqFetcher + this.progressIndicator = (seqFetcher == null) ? null : seqFetcher .getProgressIndicator(); } diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index 5691db1..0d02cc0 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -50,7 +50,7 @@ public class UniprotFTSPanel extends GFTSPanel pageLimit = UniProtFTSRestClient.getInstance() .getDefaultResponsePageSize(); this.seqFetcher = seqFetcher; - this.progressIdicator = (seqFetcher == null) ? null : seqFetcher + this.progressIndicator = (seqFetcher == null) ? null : seqFetcher .getProgressIndicator(); } -- 1.7.10.2