From e1cb1f4ff4ae05504c806d99395358629c807956 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 21 May 2018 10:36:35 +0100 Subject: [PATCH] JAL-2814 help links from PDB and Uniprot FTS panels --- help/help.jhm | 2 + help/html/features/pdbsequencefetcher.html | 2 +- help/html/features/uniprotsequencefetcher.html | 2 +- src/jalview/fts/core/GFTSPanel.java | 39 +++++++++++++++----- src/jalview/fts/service/pdb/PDBFTSPanel.java | 20 +++++++++- .../fts/service/uniprot/UniprotFTSPanel.java | 16 ++++++++ src/jalview/gui/Help.java | 6 +-- 7 files changed, 70 insertions(+), 17 deletions(-) diff --git a/help/help.jhm b/help/help.jhm index d9a201a..a8ff7fa 100755 --- a/help/help.jhm +++ b/help/help.jhm @@ -145,6 +145,7 @@ + @@ -153,6 +154,7 @@ + diff --git a/help/html/features/pdbsequencefetcher.html b/help/html/features/pdbsequencefetcher.html index bb63bed..9251277 100644 --- a/help/html/features/pdbsequencefetcher.html +++ b/help/html/features/pdbsequencefetcher.html @@ -43,7 +43,7 @@ alt="PDB sequence fetcher (introduced in Jalview 2.9)" />

- Searching the PDB Database + Searching the PDB Database

To search the PDB, begin typing in the text box. If the 'autosearch' checkbox is enabled, then the results of your query diff --git a/help/html/features/uniprotsequencefetcher.html b/help/html/features/uniprotsequencefetcher.html index 4a64f52..72e7649 100644 --- a/help/html/features/uniprotsequencefetcher.html +++ b/help/html/features/uniprotsequencefetcher.html @@ -44,7 +44,7 @@

- Searching the UniProt Database + Searching the UniProt Database

To search UniProt, simply begin typing in the text box. If the 'autosearch' check box is enabled, then after a short delay (about diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 86710e1..232561c 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -34,6 +34,7 @@ import jalview.util.MessageManager; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -86,6 +87,8 @@ import javax.swing.text.JTextComponent; @SuppressWarnings("serial") public abstract class GFTSPanel extends JPanel implements GFTSPanelI { + private static final Font VERDANA_12 = new Font("Verdana", 0, 12); + protected JInternalFrame mainFrame = new JInternalFrame( getFTSFrameTitle()); @@ -300,11 +303,11 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI Integer height = getTempUserPrefs().get("FTSPanel.height") == null ? 400 : getTempUserPrefs().get("FTSPanel.height"); lbl_warning.setVisible(false); - lbl_warning.setFont(new java.awt.Font("Verdana", 0, 12)); + lbl_warning.setFont(VERDANA_12); lbl_loading.setVisible(false); - lbl_loading.setFont(new java.awt.Font("Verdana", 0, 12)); + lbl_loading.setFont(VERDANA_12); lbl_blank.setVisible(true); - lbl_blank.setFont(new java.awt.Font("Verdana", 0, 12)); + lbl_blank.setFont(VERDANA_12); tbl_summary.setAutoCreateRowSorter(true); tbl_summary.getTableHeader().setReorderingAllowed(false); @@ -357,6 +360,19 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI } }); + JButton txt_help = new JButton("?"); + txt_help.setFont(VERDANA_12); + txt_help.setPreferredSize(new Dimension(15, 15)); + txt_help.setToolTipText(MessageManager.getString("action.help")); + txt_help.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + showHelp(); + } + }); + btn_autosearch.setText(MessageManager.getString("option.autosearch")); btn_autosearch.setToolTipText( MessageManager.getString("option.enable_disable_autosearch")); @@ -371,7 +387,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI Boolean.toString(btn_autosearch.isSelected())); } }); - btn_back.setFont(new java.awt.Font("Verdana", 0, 12)); + btn_back.setFont(VERDANA_12); btn_back.setText(MessageManager.getString("action.back")); btn_back.addActionListener(new java.awt.event.ActionListener() { @@ -394,7 +410,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI }); btn_ok.setEnabled(false); - btn_ok.setFont(new java.awt.Font("Verdana", 0, 12)); + btn_ok.setFont(VERDANA_12); btn_ok.setText(MessageManager.getString("action.ok")); btn_ok.addActionListener(new java.awt.event.ActionListener() { @@ -418,7 +434,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI btn_next_page.setEnabled(false); btn_next_page.setToolTipText( MessageManager.getString("label.next_page_tooltip")); - btn_next_page.setFont(new java.awt.Font("Verdana", 0, 12)); + btn_next_page.setFont(VERDANA_12); btn_next_page.setText(MessageManager.getString("action.next_page")); btn_next_page.addActionListener(new java.awt.event.ActionListener() { @@ -443,7 +459,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI btn_prev_page.setEnabled(false); btn_prev_page.setToolTipText( MessageManager.getString("label.prev_page_tooltip")); - btn_prev_page.setFont(new java.awt.Font("Verdana", 0, 12)); + btn_prev_page.setFont(VERDANA_12); btn_prev_page.setText(MessageManager.getString("action.prev_page")); btn_prev_page.addActionListener(new java.awt.event.ActionListener() { @@ -476,7 +492,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI btn_next_page.setVisible(false); } - btn_cancel.setFont(new java.awt.Font("Verdana", 0, 12)); + btn_cancel.setFont(VERDANA_12); btn_cancel.setText(MessageManager.getString("action.cancel")); btn_cancel.addActionListener(new java.awt.event.ActionListener() { @@ -499,7 +515,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI }); scrl_searchResult.setPreferredSize(new Dimension(width, height)); - cmb_searchTarget.setFont(new java.awt.Font("Verdana", 0, 12)); + cmb_searchTarget.setFont(VERDANA_12); cmb_searchTarget.addItemListener(new ItemListener() { @Override @@ -532,7 +548,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI } }); - txt_search.setFont(new java.awt.Font("Verdana", 0, 12)); + txt_search.setFont(VERDANA_12); txt_search.getEditor().getEditorComponent() .addKeyListener(new KeyAdapter() @@ -666,6 +682,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI pnl_results.add(tabbedPane); pnl_inputs.add(cmb_searchTarget); pnl_inputs.add(txt_search); + pnl_inputs.add(txt_help); pnl_inputs.add(btn_autosearch); pnl_inputs.add(lbl_loading); pnl_inputs.add(lbl_warning); @@ -710,6 +727,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), width, height); } + abstract protected void showHelp(); + protected void closeAction() { getTempUserPrefs().put("FTSPanel.width", this.getWidth()); diff --git a/src/jalview/fts/service/pdb/PDBFTSPanel.java b/src/jalview/fts/service/pdb/PDBFTSPanel.java index 053d91b..da164f0 100644 --- a/src/jalview/fts/service/pdb/PDBFTSPanel.java +++ b/src/jalview/fts/service/pdb/PDBFTSPanel.java @@ -26,6 +26,8 @@ import jalview.fts.api.FTSRestClientI; import jalview.fts.core.FTSRestRequest; import jalview.fts.core.FTSRestResponse; import jalview.fts.core.GFTSPanel; +import jalview.gui.Help; +import jalview.gui.Help.HelpId; import jalview.gui.SequenceFetcher; import jalview.util.MessageManager; @@ -33,13 +35,15 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import javax.help.HelpSetException; + @SuppressWarnings("serial") public class PDBFTSPanel extends GFTSPanel { private static String defaultFTSFrameTitle = MessageManager .getString("label.pdb_sequence_fetcher"); - private static Map tempUserPrefs = new HashMap(); + private static Map tempUserPrefs = new HashMap<>(); private static final String PDB_FTS_CACHE_KEY = "CACHE.PDB_FTS"; @@ -190,7 +194,7 @@ public class PDBFTSPanel extends GFTSPanel // mainFrame.dispose(); disableActionButtons(); StringBuilder selectedIds = new StringBuilder(); - HashSet selectedIdsSet = new HashSet(); + HashSet selectedIdsSet = new HashSet<>(); int primaryKeyColIndex = 0; try { @@ -288,4 +292,16 @@ public class PDBFTSPanel extends GFTSPanel { return PDB_AUTOSEARCH; } + + @Override + protected void showHelp() + { + try + { + Help.showHelpWindow(HelpId.PdbFts); + } catch (HelpSetException e1) + { + e1.printStackTrace(); + } + } } \ 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 df54dea..977abfa 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -26,6 +26,8 @@ import jalview.fts.api.FTSRestClientI; import jalview.fts.core.FTSRestRequest; import jalview.fts.core.FTSRestResponse; import jalview.fts.core.GFTSPanel; +import jalview.gui.Help; +import jalview.gui.Help.HelpId; import jalview.gui.SequenceFetcher; import jalview.util.MessageManager; @@ -33,6 +35,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import javax.help.HelpSetException; + @SuppressWarnings("serial") public class UniprotFTSPanel extends GFTSPanel { @@ -245,4 +249,16 @@ public class UniprotFTSPanel extends GFTSPanel { return UNIPROT_AUTOSEARCH; } + + @Override + protected void showHelp() + { + try + { + Help.showHelpWindow(HelpId.UniprotFts); + } catch (HelpSetException e1) + { + e1.printStackTrace(); + } + } } diff --git a/src/jalview/gui/Help.java b/src/jalview/gui/Help.java index f2d8113..cba9c2c 100644 --- a/src/jalview/gui/Help.java +++ b/src/jalview/gui/Help.java @@ -28,17 +28,17 @@ import javax.help.HelpSet; import javax.help.HelpSetException; /** - * Utility class to show the help documentation window. + * Utility class to show the help documentation window * * @author gmcarstairs - * */ public class Help { public enum HelpId { Home("home"), SequenceFeatureSettings("seqfeatures.settings"), - StructureViewer("viewingpdbs"); + StructureViewer("viewingpdbs"), PdbFts("pdbfts"), + UniprotFts("uniprotfts"); private String id; -- 1.7.10.2