Merge branch 'Release_2_8_2_Branch' of https://source.jalview.org/git/jalview.git...
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 18 Nov 2014 11:32:25 +0000 (11:32 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 18 Nov 2014 11:32:25 +0000 (11:32 +0000)
help/html/features/preferences.html
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/datamodel/HiddenSequences.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/Help.java
src/jalview/gui/Preferences.java
src/jalview/jbgui/GPreferences.java
src/jalview/viewmodel/AlignmentViewport.java
test/jalview/gui/HelpTest.java [new file with mode: 0644]

index 5d4ab4d..657359e 100755 (executable)
@@ -121,7 +121,8 @@ called to derive secondary structure information for RNA chains.
 column for the backbone atoms in the PDB file will be extracted as annotation lines shown on the alignment. 
 <p><em>Default structure viewer</em> - choose JMOL or CHIMERA for viewing 3D structures. 
 <p><em>Path to Chimera program</em> - Optional, as Jalview will search standard installation paths for Windows, Linux or MacOS. 
-If you have installed Chimera in a non-standard location, you can specify it here. Enter the full path to the Chimera executable program.  
+If you have installed Chimera in a non-standard location, you can specify it here, by entering the full path to the Chimera executable program.
+Double-click this field to open a file chooser dialog.  
 
 <p><a name="connections"><strong>&quot;Connections&quot;
 Preferences tab</strong></a></p>
index 511e5e9..952f902 100644 (file)
@@ -250,7 +250,7 @@ label.autoadd_temp = Add Temperature Factor annotation to alignment
 label.structure_viewer = Default structure viewer
 label.chimera_path = Path to Chimera program
 label.chimera_path_tip = Jalview will try standard locations, plus any path entered here.
-label.invalid_path = File not found or not executable
+label.invalid_chimera_path = Chimera path not found or not executable
 label.min_colour = Minimum Colour
 label.max_colour = Maximum Colour
 label.use_original_colours = Use Original Colours
@@ -344,7 +344,7 @@ label.dont_ask_me_again = Don't ask me again
 label.select_eps_character_rendering_style = Select EPS character rendering style
 label.invert_selection = Invert Selection
 label.optimise_order = Optimise Order
-label.seq_sort_by_score = Seq sort by Score
+label.seq_sort_by_score = Sequence sort by Score
 label.load_colours = Load Colours
 label.save_colours = Save Colours
 label.fetch_das_features = Fetch DAS Features
@@ -778,7 +778,9 @@ label.services_at = Services at {0}
 label.rest_client_submit = {0} using {1}
 label.fetch_retrieve_from =Retrieve from {0}</html>
 label.fetch_retrieve_from_all_sources = Retrieve from all {0} sources in {1}<br>First is :{2}<html> 
-label.feature_settings_click_drag = <html>Click/drag feature types up or down to change render order.<br/>Double click to select columns containing feature in alignment/current selection<br/>Pressing Alt will select columns outside features rather than inside<br/>Pressing Shift to modify current selection (rather than clear current selection)<br/>Press CTRL or Command/Meta to toggle columns in/outside features<br/></html>
+#label.feature_settings_click_drag = <html>Click/drag feature types up or down to change render order.<br/>Double click to select columns containing feature in alignment/current selection<br/>Pressing Alt will select columns outside features rather than inside<br/>Pressing Shift to modify current selection (rather than clear current selection)<br/>Press CTRL or Command/Meta to toggle columns in/outside features<br/></html>
+label.feature_settings_click_drag = Drag up or down to change render order.<br/>Double click to select columns containing feature.
+label.transparency_tip = Adjust transparency to 'see through' feature colours.
 label.opt_and_params_further_details = see further details by right-clicking
 label.opt_and_params_show_brief_desc_image_link = <html>Click to show brief description<br><img src="{0}"/> Right click for further information.</html> 
 label.opt_and_params_show_brief_desc = <html>Click to show brief description<br></html>
index a1663d9..dc403d0 100644 (file)
@@ -748,7 +748,7 @@ label.services_at = Servicios en {0}
 label.rest_client_submit = {0} utilizando {1}
 label.fetch_retrieve_from =Recuperar de {0}
 label.fetch_retrieve_from_all_sources = Recuperar de todas las fuentes {0} en {1}<br>La primera es :{2}
-label.feature_settings_click_drag = Haga clic o arrastre los tipos de las características hacia arriba o hacia abajo para cambiar el orden de visualización.<br/>Haga doble clic para seleccionar las columnas que contienen las características del alineamiento/selección actual.<br/>Presionando Alt seleccionará las columnas exteriores a las características en lugar de las interiores<br/>Presione Shift para modificar la selección actual (en lugar de borrarla)<br/>Presione CTRL o Command/Meta para cambiar las columans externas o internas a las características<br/>
+label.feature_settings_click_drag = Haga clic o arrastre los tipos de las características hacia arriba o hacia abajo para cambiar el orden de visualización.<br/>Haga doble clic para seleccionar las columnas que contienen las características del alineamiento/selección actual.<br/>
 label.opt_and_params_further_details = ver los detalles adicionales haciendo clic en el botón derecho
 label.opt_and_params_show_brief_desc_image_link = Haga clic para ver una descripción breve<br><img src="{0}"/>Haga clic en el botón derecho para obtener información adicional.
 label.opt_and_params_show_brief_desc = Haga clic para ver una descripción breve<br>
index aefb5cc..bfeafd6 100755 (executable)
@@ -20,7 +20,9 @@
  */
 package jalview.datamodel;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 public class HiddenSequences
 {
@@ -143,34 +145,34 @@ public class HiddenSequences
     alignment.deleteSequence(sequence);
   }
 
-  public Vector showAll(
+  public List<SequenceI> showAll(
           Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
   {
-    Vector revealedSeqs = new Vector();
+    List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
     for (int i = 0; i < hiddenSequences.length; i++)
     {
       if (hiddenSequences[i] != null)
       {
-        Vector tmp = showSequence(i, hiddenRepSequences);
-        for (int t = 0; t < tmp.size(); t++)
+        List<SequenceI> tmp = showSequence(i, hiddenRepSequences);
+        for (SequenceI seq : tmp)
         {
-          revealedSeqs.addElement(tmp.elementAt(t));
+          revealedSeqs.add(seq);
         }
       }
     }
     return revealedSeqs;
   }
 
-  public Vector showSequence(int alignmentIndex,
+  public List<SequenceI> showSequence(int alignmentIndex,
           Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
   {
-    Vector revealedSeqs = new Vector();
+    List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
     SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
     if (repSequence != null && hiddenRepSequences != null
             && hiddenRepSequences.containsKey(repSequence))
     {
       hiddenRepSequences.remove(repSequence);
-      revealedSeqs.addElement(repSequence);
+      revealedSeqs.add(repSequence);
     }
 
     int start = adjustForHiddenSeqs(alignmentIndex - 1);
@@ -192,7 +194,7 @@ public class HiddenSequences
         {
           if (seq.getLength() > 0)
           {
-            revealedSeqs.addElement(seq);
+            revealedSeqs.add(seq);
             asequences.add(alignmentIndex, seq);
           }
           else
index 693e6fe..2210148 100644 (file)
@@ -27,6 +27,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
+import jalview.gui.Help.HelpId;
 import jalview.io.JalviewFileChooser;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.schemes.GraduatedColor;
@@ -61,6 +62,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
+import javax.help.HelpSetException;
 import javax.swing.AbstractCellEditor;
 import javax.swing.BorderFactory;
 import javax.swing.Icon;
@@ -132,7 +134,19 @@ public class FeatureSettings extends JPanel
       ex.printStackTrace();
     }
 
-    table = new JTable();
+    table = new JTable() {
+      @Override
+      public String getToolTipText(MouseEvent e) {
+        if (table.columnAtPoint(e.getPoint()) == 0) {
+          /*
+           * Tooltip for feature name only
+           */
+          return JvSwingUtils.wrapTooltip(true,
+                MessageManager.getString("label.feature_settings_click_drag"));
+        }
+        return null;
+      }
+    };
     table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
     table.setFont(new Font("Verdana", Font.PLAIN, 12));
     table.setDefaultRenderer(Color.class, new ColorRenderer());
@@ -201,8 +215,8 @@ public class FeatureSettings extends JPanel
         }
       }
     });
-    table.setToolTipText(JvSwingUtils
-                    .wrapTooltip(true, MessageManager.getString("label.feature_settings_click_drag")));
+//    table.setToolTipText(JvSwingUtils.wrapTooltip(true,
+//            MessageManager.getString("label.feature_settings_click_drag")));
     scrollPane.setViewportView(table);
 
     dassourceBrowser = new DasSourceBrowser(this);
@@ -572,7 +586,9 @@ public class FeatureSettings extends JPanel
                 || ((Boolean) fr.featureGroups.get(group)).booleanValue())
         {
           if (group != null)
+          {
             checkGroupState(group);
+          }
           type = tmpfeatures[index].getType();
           if (!visibleChecks.contains(type))
           {
@@ -610,7 +626,9 @@ public class FeatureSettings extends JPanel
     if (fr.renderOrder != null)
     {
       if (!handlingUpdate)
+       {
         fr.findAllFeatures(groupChanged != null); // prod to update
+      }
       // colourschemes. but don't
       // affect display
       // First add the checks in the previous render order,
@@ -691,12 +709,18 @@ public class FeatureSettings extends JPanel
     {
       order[i] = fr.getOrder(data[i][0].toString());
       if (order[i] < 0)
+      {
         order[i] = fr.setOrder(data[i][0].toString(), i / order.length);
+      }
       if (i > 1)
+      {
         sort = sort || order[i - 1] > order[i];
+      }
     }
     if (sort)
+    {
       jalview.util.QuickSort.sort(order, data);
+    }
   }
 
   void load()
@@ -887,7 +911,9 @@ public class FeatureSettings extends JPanel
   public void orderByAvWidth()
   {
     if (table == null || table.getModel() == null)
+    {
       return;
+    }
     Object[][] data = ((FeatureTableModel) table.getModel()).getData();
     float[] width = new float[data.length];
     float[] awidth;
@@ -909,7 +935,9 @@ public class FeatureSettings extends JPanel
         width[i] = 0;
       }
       if (max < width[i])
+      {
         max = width[i];
+      }
     }
     boolean sort = false;
     for (int i = 0; i < width.length; i++)
@@ -929,11 +957,15 @@ public class FeatureSettings extends JPanel
         fr.setOrder(data[i][0].toString(), width[i]); // store for later
       }
       if (i > 0)
+      {
         sort = sort || width[i - 1] > width[i];
+      }
     }
     if (sort)
+     {
       jalview.util.QuickSort.sort(width, data);
     // update global priority order
+    }
 
     updateFeatureRenderer(data, false);
     table.repaint();
@@ -1001,7 +1033,9 @@ public class FeatureSettings extends JPanel
 
   JButton sortByDens = new JButton();
 
-  JPanel transbuttons = new JPanel(new GridLayout(4, 1));
+  JButton help = new JButton();
+
+  JPanel transbuttons = new JPanel(new GridLayout(5, 1));
 
   private void jbInit() throws Exception
   {
@@ -1047,6 +1081,21 @@ public class FeatureSettings extends JPanel
         sortByDens(null);
       }
     });
+    help.setFont(JvSwingUtils.getLabelFont());
+    help.setText(MessageManager.getString("action.help"));
+    help.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        try
+        {
+          Help.showHelpWindow(HelpId.SequenceFeatureSettings);
+        } catch (HelpSetException e1)
+        {
+          e1.printStackTrace();
+        }
+      }
+    });
     cancel.setFont(JvSwingUtils.getLabelFont());
     cancel.setText(MessageManager.getString("action.cancel"));
     cancel.addActionListener(new ActionListener()
@@ -1094,6 +1143,8 @@ public class FeatureSettings extends JPanel
     });
 
     transparency.setMaximum(70);
+    transparency.setToolTipText(MessageManager
+            .getString("label.transparency_tip"));
     fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
     fetchDAS.addActionListener(new ActionListener()
     {
@@ -1129,6 +1180,9 @@ public class FeatureSettings extends JPanel
     transbuttons.add(invert);
     transbuttons.add(sortByScore);
     transbuttons.add(sortByDens);
+    transbuttons.add(help);
+    JPanel sliderPanel = new JPanel();
+    sliderPanel.add(transparency);
     transPanel.add(transparency);
     transPanel.add(transbuttons);
     buttonPanel.add(ok);
index dac17c0..ae3f457 100644 (file)
@@ -2,6 +2,7 @@ package jalview.gui;
 
 import java.net.URL;
 
+import javax.help.BadIDException;
 import javax.help.HelpBroker;
 import javax.help.HelpSet;
 import javax.help.HelpSetException;
@@ -14,6 +15,23 @@ import javax.help.HelpSetException;
  */
 public class Help
 {
+  public enum HelpId
+  {
+    Home("home"), SequenceFeatureSettings("seqfeatures.settings");
+
+    private String id;
+
+    private HelpId(String loc)
+    {
+      this.id = loc;
+    }
+
+    @Override
+    public String toString()
+    {
+      return this.id;
+    }
+  }
 
   private static final long HALF_A_MO = 500; // half a second
 
@@ -33,10 +51,11 @@ public class Help
    * 
    * This is a workaround for issue JAL-914 - both Desktop and AlignFrame
    * responding to F1 key, resulting in duplicate help windows opened.
+   * @param id TODO
    * 
    * @throws HelpSetException
    */
-  public static void showHelpWindow() throws HelpSetException
+  public static void showHelpWindow(HelpId id) throws HelpSetException
   {
     long timeNow = System.currentTimeMillis();
 
@@ -48,8 +67,21 @@ public class Help
       HelpSet hs = new HelpSet(cl, url);
 
       HelpBroker hb = hs.createHelpBroker();
-      hb.setCurrentID("home");
+      try
+      {
+        hb.setCurrentID(id.toString());
+      } catch (BadIDException bad)
+      {
+        System.out.println("Bad help link: " + id.toString()
+                + ": must match a target in help.jhm");
+        throw bad;
+      }
       hb.setDisplayed(true);
     }
   }
+
+  public static void showHelpWindow() throws HelpSetException
+  {
+    showHelpWindow(HelpId.Home);
+  }
 }
index 09f3686..b082bc6 100755 (executable)
@@ -291,17 +291,7 @@ public class Preferences extends GPreferences
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        if (chimeraPath.getText().trim().length() > 0)
-        {
-          File f = new File(chimeraPath.getText());
-          if (!f.canExecute())
-          {
-            JOptionPane.showInternalMessageDialog(Desktop.desktop,
-                    MessageManager.getString("label.invalid_path"),
-                    MessageManager.getString("label.invalid_name"),
-                    JOptionPane.ERROR_MESSAGE);
-          }
-        }
+        validateChimeraPath();
       }
     });
 
@@ -376,6 +366,11 @@ public class Preferences extends GPreferences
    */
   public void ok_actionPerformed(ActionEvent e)
   {
+    if (!validateSettings())
+    {
+      return;
+    }
+
     /*
      * Save Visual settings
      */
@@ -601,6 +596,27 @@ public class Preferences extends GPreferences
   }
 
   /**
+   * Do any necessary validation before saving settings.
+   * 
+   * @return
+   */
+  private boolean validateSettings()
+  {
+    if (!validateStructure())
+    {
+      structureTab.requestFocusInWindow();
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  protected boolean validateStructure()
+  {
+    return validateChimeraPath();
+
+  }
+  /**
    * DOCUMENT ME!
    */
   public void startupFileTextfield_mouseClicked()
@@ -842,4 +858,25 @@ public class Preferences extends GPreferences
     userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
   }
 
+  /**
+   * Returns true if chimera path is to a valid executable, else show an error
+   * dialog.
+   */
+  private boolean validateChimeraPath()
+  {
+    if (chimeraPath.getText().trim().length() > 0)
+    {
+      File f = new File(chimeraPath.getText());
+      if (!f.canExecute())
+      {
+        JOptionPane.showInternalMessageDialog(Desktop.desktop,
+                MessageManager.getString("label.invalid_chimera_path"),
+                MessageManager.getString("label.invalid_name"),
+                JOptionPane.ERROR_MESSAGE);
+        return false;
+      }
+    }
+    return true;
+  }
+
 }
index a232377..9d691ca 100755 (executable)
@@ -26,6 +26,7 @@ import jalview.util.MessageManager;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.Font;
@@ -36,6 +37,8 @@ import java.awt.Insets;
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
@@ -45,6 +48,7 @@ import javax.swing.DefaultListCellRenderer;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
 import javax.swing.JLabel;
 import javax.swing.JList;
 import javax.swing.JPanel;
@@ -56,6 +60,8 @@ import javax.swing.SwingConstants;
 import javax.swing.border.Border;
 import javax.swing.border.EmptyBorder;
 import javax.swing.border.TitledBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 
@@ -128,8 +134,10 @@ public class GPreferences extends JPanel
   protected JCheckBox showNpTooltip = new JCheckBox();
 
   /*
-   * Annotations tab components
+   * Structure tab and components
    */
+  protected JPanel structureTab;
+
   protected JCheckBox structFromPdb = new JCheckBox();
 
   protected JCheckBox useRnaView = new JCheckBox();
@@ -239,7 +247,7 @@ public class GPreferences extends JPanel
    */
   private void jbInit() throws Exception
   {
-    JTabbedPane tabbedPane = new JTabbedPane();
+    final JTabbedPane tabbedPane = new JTabbedPane();
     this.setLayout(new BorderLayout());
     JPanel okCancelPanel = initOkCancelPanel();
     this.add(tabbedPane, BorderLayout.CENTER);
@@ -273,6 +281,31 @@ public class GPreferences extends JPanel
      */
     wsTab.setLayout(new BorderLayout());
     tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
+
+    /*
+     * Handler to validate a tab before leaving it - currently only for
+     * Structure.
+     */
+    tabbedPane.addChangeListener(new ChangeListener()
+    {
+      private Component lastTab;
+
+      @Override
+      public void stateChanged(ChangeEvent e)
+      {
+        if (lastTab == structureTab
+                && tabbedPane.getSelectedComponent() != structureTab)
+        {
+          if (!validateStructure())
+          {
+            tabbedPane.setSelectedComponent(structureTab);
+            return;
+          }
+        }
+        lastTab = tabbedPane.getSelectedComponent();
+      }
+
+    });
   }
 
   /**
@@ -691,7 +724,8 @@ public class GPreferences extends JPanel
    */
   private JPanel initStructureTab()
   {
-    JPanel structureTab = new JPanel();
+    structureTab = new JPanel();
+
     structureTab.setBorder(new TitledBorder(MessageManager
             .getString("label.structure_options")));
     structureTab.setLayout(null);
@@ -764,12 +798,81 @@ public class GPreferences extends JPanel
     chimeraPath.setFont(verdana11);
     chimeraPath.setText("");
     chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
+    chimeraPath.addMouseListener(new MouseAdapter()
+    {
+      @Override
+      public void mouseClicked(MouseEvent e)
+      {
+        if (e.getClickCount() == 2)
+        {
+          String chosen = openFileChooser();
+          if (chosen != null)
+          {
+            chimeraPath.setText(chosen);
+          }
+        }
+      }
+    });
     structureTab.add(chimeraPath);
 
+    structureTab.addFocusListener(new FocusAdapter()
+    {
+      @Override
+      public void focusLost(FocusEvent e)
+      {
+        validateStructure(e);
+      }
+
+    });
     return structureTab;
   }
 
   /**
+   * Show a dialog for the user to choose a file. Returns the chosen path, or
+   * null on Cancel.
+   * 
+   * @return
+   */
+  protected String openFileChooser()
+  {
+    String choice = null;
+    JFileChooser chooser = new JFileChooser();
+
+    // chooser.setFileView(new JalviewFileView());
+    chooser.setDialogTitle(MessageManager
+            .getString("label.open_local_file"));
+    chooser.setToolTipText(MessageManager.getString("action.open"));
+
+    int value = chooser.showOpenDialog(this);
+
+    if (value == JFileChooser.APPROVE_OPTION)
+    {
+      choice = chooser.getSelectedFile().getPath();
+    }
+    return choice;
+  }
+
+  /**
+   * Validate the structure tab preferences; if invalid, set focus on this tab.
+   * 
+   * @param e
+   */
+  protected boolean validateStructure(FocusEvent e)
+  {
+    if (!validateStructure())
+    {
+      e.getComponent().requestFocusInWindow();
+      return false;
+    }
+    return true;
+  }
+
+  protected boolean validateStructure()
+  {
+    return false;
+  }
+
+  /**
    * Initialises the Visual tabbed panel.
    * 
    * @return
index 0fa4a3c..1b42faf 100644 (file)
@@ -20,7 +20,6 @@
  */
 package jalview.viewmodel;
 
-import jalview.analysis.AAFrequency;
 import jalview.analysis.Conservation;
 import jalview.api.AlignCalcManagerI;
 import jalview.api.AlignViewportI;
@@ -35,7 +34,6 @@ import jalview.datamodel.SequenceCollectionI;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.schemes.Blosum62ColourScheme;
-import jalview.schemes.ClustalxColourScheme;
 import jalview.schemes.ColourSchemeI;
 import jalview.schemes.PIDColourScheme;
 import jalview.schemes.ResidueProperties;
@@ -447,7 +445,9 @@ public abstract class AlignmentViewport implements AlignViewportI
           AlignmentAnnotation alignmentAnnotation)
   {
     if (!alignmentAnnotation.autoCalculated)
+    {
       return false;
+    }
     if (calculator.workingInvolvedWith(alignmentAnnotation))
     {
       // System.err.println("grey out ("+alignmentAnnotation.label+")");
@@ -899,11 +899,12 @@ public abstract class AlignmentViewport implements AlignViewportI
         selectionGroup = new SequenceGroup();
         selectionGroup.setEndRes(alignment.getWidth() - 1);
       }
-      Vector tmp = alignment.getHiddenSequences().showAll(
+      List<SequenceI> tmp = alignment.getHiddenSequences().showAll(
               hiddenRepSequences);
-      for (int t = 0; t < tmp.size(); t++)
+      for (SequenceI seq : tmp)
       {
-        selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+        selectionGroup.addSequence(seq, false);
+        setSequenceAnnotationsVisible(seq, true);
       }
 
       hasHiddenRows = false;
@@ -918,7 +919,8 @@ public abstract class AlignmentViewport implements AlignViewportI
 
   public void showSequence(int index)
   {
-    Vector tmp = alignment.getHiddenSequences().showSequence(index,
+    List<SequenceI> tmp = alignment.getHiddenSequences().showSequence(
+            index,
             hiddenRepSequences);
     if (tmp.size() > 0)
     {
@@ -928,9 +930,10 @@ public abstract class AlignmentViewport implements AlignViewportI
         selectionGroup.setEndRes(alignment.getWidth() - 1);
       }
 
-      for (int t = 0; t < tmp.size(); t++)
+      for (SequenceI seq : tmp)
       {
-        selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+        selectionGroup.addSequence(seq, false);
+        setSequenceAnnotationsVisible(seq, true);
       }
       // JBPNote: refactor: only update flag if we modified visiblity (used to
       // do this regardless)
@@ -964,12 +967,30 @@ public abstract class AlignmentViewport implements AlignViewportI
       for (int i = 0; i < seq.length; i++)
       {
         alignment.getHiddenSequences().hideSequence(seq[i]);
+        setSequenceAnnotationsVisible(seq[i], false);
       }
       hasHiddenRows = true;
       firePropertyChange("alignment", null, alignment.getSequences());
     }
   }
 
+  /**
+   * Set visibility for any annotations for the given sequence.
+   * 
+   * @param sequenceI
+   */
+  protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
+          boolean visible)
+  {
+    for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation())
+    {
+      if (ann.sequenceRef == sequenceI)
+      {
+        ann.visible = visible;
+      }
+    }
+  }
+
   public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
   {
     int sSize = sg.getSize();
diff --git a/test/jalview/gui/HelpTest.java b/test/jalview/gui/HelpTest.java
new file mode 100644 (file)
index 0000000..e4068d7
--- /dev/null
@@ -0,0 +1,32 @@
+package jalview.gui;
+
+import static org.junit.Assert.assertTrue;
+import jalview.gui.Help.HelpId;
+
+import java.net.URL;
+
+import javax.help.HelpSet;
+import javax.help.HelpSetException;
+import javax.help.Map;
+
+import org.junit.Test;
+
+public class HelpTest
+{
+  @Test
+  public void checkHelpTargets() throws HelpSetException
+  {
+    ClassLoader cl = Desktop.class.getClassLoader();
+    URL url = HelpSet.findHelpSet(cl, "help/help"); // $NON-NLS-$
+    HelpSet hs = new HelpSet(cl, url);
+    Map targets = hs.getLocalMap();
+
+    for (HelpId id : HelpId.values())
+    {
+      String target = id.toString();
+      assertTrue("Unmatched target enum: " + target,
+              targets.isValidID(target, hs));
+    }
+
+  }
+}