JAL-2814 help links from PDB and Uniprot FTS panels
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 May 2018 09:36:35 +0000 (10:36 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 May 2018 09:36:35 +0000 (10:36 +0100)
help/help.jhm
help/html/features/pdbsequencefetcher.html
help/html/features/uniprotsequencefetcher.html
src/jalview/fts/core/GFTSPanel.java
src/jalview/fts/service/pdb/PDBFTSPanel.java
src/jalview/fts/service/uniprot/UniprotFTSPanel.java
src/jalview/gui/Help.java

index d9a201a..a8ff7fa 100755 (executable)
    
    <mapID target="biojson" url="html/features/bioJsonFormat.html" />
    <mapID target="pdbfetcher" url="html/features/pdbsequencefetcher.html" />
+   <mapID target="pdbfts" url="html/features/pdbsequencefetcher.html#pdbfts" />
    <mapID target="siftsmapping" url="html/features/siftsmapping.html" />
    <mapID target="pdbchooser" url="html/features/structurechooser.html" />
    <mapID target="selectcolbyannot" url="html/features/columnFilterByAnnotation.html" />
    <mapID target="ensemblfetch" url="html/features/ensemblsequencefetcher.html" />
    
    <mapID target="uniprotfetcher" url="html/features/uniprotsequencefetcher.html" />
+   <mapID target="uniprotfts" url="html/features/uniprotsequencefetcher.html#uniprotfts" />
    
    <mapID target="urllinks" url="html/webServices/urllinks.html" />
    <mapID target="linksprefs" url="html/features/preferences.html#links" />
index bb63bed..9251277 100644 (file)
@@ -43,7 +43,7 @@
     alt="PDB sequence fetcher (introduced in Jalview 2.9)" />
 
   <p>
-    <strong>Searching the PDB Database</strong>
+    <a name="pdbfts"><strong>Searching the PDB Database</strong></a>
   </p>
   <p>To search the PDB, begin typing in the text box. If the
     'autosearch' checkbox is enabled, then the results of your query
index 4a64f52..72e7649 100644 (file)
@@ -44,7 +44,7 @@
   </p>
 
   <p>
-    <strong>Searching the UniProt Database</strong>
+    <a name="uniprotfts"><strong>Searching the UniProt Database</strong></a>
   </p>
   <p>To search UniProt, simply begin typing in the text box. If the
     'autosearch' check box is enabled, then after a short delay (about
index 86710e1..232561c 100644 (file)
@@ -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());
index 053d91b..da164f0 100644 (file)
@@ -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<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
+  private static Map<String, Integer> 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<String> selectedIdsSet = new HashSet<String>();
+    HashSet<String> 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
index df54dea..977abfa 100644 (file)
@@ -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();
+    }
+  }
 }
index f2d8113..cba9c2c 100644 (file)
@@ -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;