From 6c9e086eeb3cdc0013fbb573d8e0a9be0cfc2057 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 13 Nov 2017 12:43:38 +0000 Subject: [PATCH] JAL-2810 auto search checkbox state stored as user preference. Enabled by default. --- src/jalview/fts/api/GFTSPanelI.java | 7 +++++++ src/jalview/fts/core/GFTSPanel.java | 11 +++++++++++ src/jalview/fts/service/pdb/PDBFTSPanel.java | 9 ++++++++- src/jalview/fts/service/uniprot/UniprotFTSPanel.java | 8 ++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/jalview/fts/api/GFTSPanelI.java b/src/jalview/fts/api/GFTSPanelI.java index 99c0c51..974cc88 100644 --- a/src/jalview/fts/api/GFTSPanelI.java +++ b/src/jalview/fts/api/GFTSPanelI.java @@ -145,4 +145,11 @@ public interface GFTSPanelI * @return */ public String getCacheKey(); + + /** + * + * @return user preference name for configuring this FTS search's autosearch + * checkbox + */ + public String getAutosearchPreference(); } diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 5b8227f..9802d4b 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -360,6 +360,17 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI btn_autosearch.setText(MessageManager.getString("option.autosearch")); btn_autosearch.setToolTipText( MessageManager.getString("option.enable_disable_autosearch")); + btn_autosearch.setSelected( + jalview.bin.Cache.getDefault(getAutosearchPreference(), true)); + btn_autosearch.addActionListener(new java.awt.event.ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + jalview.bin.Cache.setProperty(getAutosearchPreference(), + Boolean.toString(btn_autosearch.isSelected())); + } + }); btn_back.setFont(new java.awt.Font("Verdana", 0, 12)); btn_back.setText(MessageManager.getString("action.back")); btn_back.addActionListener(new java.awt.event.ActionListener() diff --git a/src/jalview/fts/service/pdb/PDBFTSPanel.java b/src/jalview/fts/service/pdb/PDBFTSPanel.java index 687e83d..053d91b 100644 --- a/src/jalview/fts/service/pdb/PDBFTSPanel.java +++ b/src/jalview/fts/service/pdb/PDBFTSPanel.java @@ -43,6 +43,8 @@ public class PDBFTSPanel extends GFTSPanel private static final String PDB_FTS_CACHE_KEY = "CACHE.PDB_FTS"; + private static final String PDB_AUTOSEARCH = "FTS.PDB.AUTOSEARCH"; + public PDBFTSPanel(SequenceFetcher fetcher) { super(fetcher); @@ -281,4 +283,9 @@ public class PDBFTSPanel extends GFTSPanel return PDB_FTS_CACHE_KEY; } -} + @Override + public String getAutosearchPreference() + { + return PDB_AUTOSEARCH; + } +} \ No newline at end of file diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index 4f9e608..df54dea 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -44,6 +44,8 @@ public class UniprotFTSPanel extends GFTSPanel private static final String UNIPROT_FTS_CACHE_KEY = "CACHE.UNIPROT_FTS"; + private static final String UNIPROT_AUTOSEARCH = "FTS.UNIPROT.AUTOSEARCH"; + public UniprotFTSPanel(SequenceFetcher fetcher) { super(fetcher); @@ -237,4 +239,10 @@ public class UniprotFTSPanel extends GFTSPanel { return UNIPROT_FTS_CACHE_KEY; } + + @Override + public String getAutosearchPreference() + { + return UNIPROT_AUTOSEARCH; + } } -- 1.7.10.2