JAL-1264 first cut of panel for annotation show/hide options
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 23 Sep 2014 13:10:45 +0000 (14:10 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 23 Sep 2014 13:10:45 +0000 (14:10 +0100)
resources/lang/Messages.properties
src/jalview/datamodel/SequenceGroup.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AnnotationChooser.java [new file with mode: 0644]
src/jalview/gui/AnnotationColourChooser.java
src/jalview/gui/PopupMenu.java
src/jalview/jbgui/GAlignFrame.java
test/jalview/gui/AnnotationChooserTest.java [new file with mode: 0644]

index 6736791..22754f8 100644 (file)
@@ -54,8 +54,8 @@ action.right_justify_alignment = Right Justify Alignment
 action.boxes = Boxes\r
 action.text = Text\r
 action.by_pairwise_id = by Pairwise Identity\r
-action.by_id = by Id\r
 action.by_length = by Length\r
+action.by_id = by Id\r
 action.by_group = by Group\r
 action.remove = Remove\r
 action.remove_redundancy = Remove Redundancy...\r
@@ -223,6 +223,7 @@ label.all_columns = All Columns
 label.all_sequences = All Sequences\r
 label.selected_columns = Selected Columns \r
 label.selected_sequences = Selected Sequences\r
+label.except_selected_sequences = All except selected sequences\r
 label.all_but_selected_region = All but Selected Region (Shift+Ctrl+H)\r
 label.selected_region = Selected Region\r
 label.all_sequences_columns = All Sequences and Columns\r
@@ -465,9 +466,9 @@ label.to_lower_case = To Lower Case
 label.toggle_case = Toggle Case\r
 label.edit_name_description = Edit Name/Description ...\r
 label.create_sequence_feature = Create Sequence Feature ...\r
-label.edit_sequence = Edit Sequence\r
 label.edit_sequences = Edit Sequences\r
 label.sequence_details = Sequence Details\r
+label.choose_annotations = Show/Hide Sequence Annotations\r
 label.jmol_help = Jmol Help\r
 label.all = All\r
 label.sort_by = Sort by\r
@@ -738,3 +739,6 @@ label.select_columns_containing = Select columns containing
 label.select_columns_not_containing = Select columns that do not contain\r
 option.trim_retrieved_seqs = Trim retrieved sequences\r
 label.trim_retrieved_sequences = When the reference sequence is longer than the sequence that you are working with, only keep the relevant subsequences.\r
+label.choose_annotations = Choose annotations to show or hide\r
+label.show_selected_annotations = Show selected annotation types\r
+label.hide_selected_annotations = Hide selected annotation types\r
index b4cb3b1..17348c2 100755 (executable)
  */
 package jalview.datamodel;
 
-import java.util.*;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
 import java.util.List;
-
-import java.awt.*;
-
-import jalview.analysis.*;
-import jalview.schemes.*;
+import java.util.Map;
+import java.util.Vector;
 
 /**
  * Collects a set contiguous ranges on a set of sequences
@@ -289,11 +294,13 @@ public class SequenceGroup implements AnnotatedCollectionI
     return eres;
   }
 
+  @Override
   public List<SequenceI> getSequences()
   {
     return sequences;
   }
 
+  @Override
   public List<SequenceI> getSequences(
           Map<SequenceI, SequenceCollectionI> hiddenReps)
   {
@@ -307,7 +314,7 @@ public class SequenceGroup implements AnnotatedCollectionI
       SequenceI seq;
       for (int i = 0; i < sequences.size(); i++)
       {
-        seq = (SequenceI) sequences.elementAt(i);
+        seq = sequences.elementAt(i);
         allSequences.addElement(seq);
         if (hiddenReps.containsKey(seq))
         {
@@ -635,6 +642,7 @@ public class SequenceGroup implements AnnotatedCollectionI
    * 
    * @return the first column selected by this group. Runs from 0<=i<N_cols
    */
+  @Override
   public int getStartRes()
   {
     return startRes;
@@ -644,6 +652,7 @@ public class SequenceGroup implements AnnotatedCollectionI
    * 
    * @return the groups last selected column. Runs from 0<=i<N_cols
    */
+  @Override
   public int getEndRes()
   {
     return endRes;
@@ -689,7 +698,7 @@ public class SequenceGroup implements AnnotatedCollectionI
    */
   public SequenceI getSequenceAt(int i)
   {
-    return (SequenceI) sequences.elementAt(i);
+    return sequences.elementAt(i);
   }
 
   /**
@@ -760,17 +769,18 @@ public class SequenceGroup implements AnnotatedCollectionI
    * 
    * @return DOCUMENT ME!
    */
+  @Override
   public int getWidth()
   {
     // MC This needs to get reset when characters are inserted and deleted
     if (sequences.size() > 0)
     {
-      width = ((SequenceI) sequences.elementAt(0)).getLength();
+      width = sequences.elementAt(0).getLength();
     }
 
     for (int i = 1; i < sequences.size(); i++)
     {
-      SequenceI seq = (SequenceI) sequences.elementAt(i);
+      SequenceI seq = sequences.elementAt(i);
 
       if (seq.getLength() > width)
       {
@@ -1211,7 +1221,7 @@ public class SequenceGroup implements AnnotatedCollectionI
     // TODO add in other methods like 'getAlignmentAnnotation(String label),
     // etc'
     ArrayList<AlignmentAnnotation> annot = new ArrayList<AlignmentAnnotation>();
-    for (SequenceI seq : (Vector<SequenceI>) sequences)
+    for (SequenceI seq : sequences)
     {
       AlignmentAnnotation[] aa = seq.getAnnotation();
       if (aa != null)
@@ -1250,6 +1260,27 @@ public class SequenceGroup implements AnnotatedCollectionI
     return aa;
   }
 
+  /**
+   * Answer true if any annotation matches the calcId passed in (if not null).
+   * 
+   * @param calcId
+   * @return
+   */
+  public boolean hasAnnotation(String calcId)
+  {
+    if (calcId != null && !"".equals(calcId))
+    {
+      for (AlignmentAnnotation a : getAlignmentAnnotation())
+      {
+        if (a.getCalcId() == calcId)
+        {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
   public void clear()
   {
     sequences.clear();
index e6b7af4..544a971 100644 (file)
@@ -4025,6 +4025,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           tm.setText(title);//
           tm.addActionListener(new java.awt.event.ActionListener()
           {
+            @Override
             public void actionPerformed(ActionEvent e)
             {
               NewTreePanel(type, (String) pwtype, title);
@@ -5313,6 +5314,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     trimrs.setSelected(Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true));
     trimrs.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         trimrs.setSelected(trimrs.isSelected());
@@ -5703,6 +5705,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));
     }
   }
+
+  /**
+   * On menu option, open a panel to allow choice of annotation types to
+   * show/hide.
+   */
+  @Override
+  protected void chooseAnnotations_actionPerformed()
+  {
+    new AnnotationChooser(this.alignPanel);
+  }
 }
 
 class PrintThread extends Thread
diff --git a/src/jalview/gui/AnnotationChooser.java b/src/jalview/gui/AnnotationChooser.java
new file mode 100644 (file)
index 0000000..bb940e8
--- /dev/null
@@ -0,0 +1,564 @@
+package jalview.gui;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceGroup;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Checkbox;
+import java.awt.CheckboxGroup;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+
+/**
+ * A panel that allows the user to select which sequence-associated annotation
+ * rows to show or hide.
+ * 
+ * @author gmcarstairs
+ *
+ */
+public class AnnotationChooser extends JPanel
+{
+
+  private static final Font CHECKBOX_FONT = new Font("Serif", Font.BOLD, 12);
+
+  private static final int MY_FRAME_WIDTH = 600;
+
+  private static final int MY_FRAME_HEIGHT = 250;
+
+  private JInternalFrame frame;
+
+  private AlignmentPanel ap;
+
+  private SequenceGroup sg;
+
+  // all annotation rows' original visible state
+  private boolean[] resetState = null;
+
+  // is 'Show' selected?
+  private boolean showSelected;
+
+  // apply settings to selected (or all) sequences?
+  private boolean applyToSelectedSequences;
+
+  // apply settings to unselected (or all) sequences?
+  private boolean applyToUnselectedSequences;
+
+  // currently selected 'annotation type' checkboxes
+  private Map<String, String> selectedTypes = new HashMap<String, String>();
+  
+  /**
+   * Constructor.
+   * 
+   * @param alignPane
+   */
+  public AnnotationChooser(AlignmentPanel alignPane)
+  {
+    super();
+    this.ap = alignPane;
+    this.sg = alignPane.av.getSelectionGroup();
+    saveResetState(alignPane.getAlignment());
+
+    try
+    {
+      jbInit();
+    } catch (Exception ex)
+    {
+      ex.printStackTrace();
+    }
+    showFrame();
+  }
+
+  /**
+   * Save the initial show/hide state of all annotations to allow a Cancel
+   * operation.
+   * 
+   * @param alignment
+   */
+  protected void saveResetState(AlignmentI alignment)
+  {
+    AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
+    final int count = annotations.length;
+    this.resetState = new boolean[count];
+    for (int i = 0; i < count; i++)
+    {
+      this.resetState[i] = annotations[i].visible;
+    }
+  }
+
+  /**
+   * Populate this frame with:
+   * <p>
+   * checkboxes for the types of annotation to show or hide (i.e. any annotation
+   * type shown for any sequence in the whole alignment)
+   * <p>
+   * option to show or hide selected types
+   * <p>
+   * option to show/hide for the currently selected group, or its inverse
+   * <p>
+   * OK and Cancel (reset) buttons
+   */
+  protected void jbInit()
+  {
+    setLayout(new GridLayout(3, 1));
+    add(buildAnnotationTypesPanel());
+    add(buildShowHideOptionsPanel());
+    add(buildActionButtonsPanel());
+    validate();
+  }
+
+  /**
+   * Construct the panel with checkboxes for annotation types.
+   * 
+   * @return
+   */
+  protected JPanel buildAnnotationTypesPanel()
+  {
+    JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+    List<String> annotationTypes = getAnnotationTypes(
+            this.ap.getAlignment(), true);
+
+    for (final String type : annotationTypes)
+    {
+      final JCheckBox check = new JCheckBox(type);
+      check.setFont(CHECKBOX_FONT);
+      check.addItemListener(new ItemListener()
+      {
+        @Override
+        public void itemStateChanged(ItemEvent evt)
+        {
+          if (evt.getStateChange() == ItemEvent.SELECTED)
+          {
+            AnnotationChooser.this.selectedTypes.put(type, type);
+          }
+          else
+          {
+            AnnotationChooser.this.selectedTypes.remove(type);
+          }
+          repaintAnnotations(false);
+        }
+      });
+      jp.add(check);
+    }
+    return jp;
+  }
+
+  /**
+   * Set visibility flags on annotation rows then repaint the alignment panel.
+   * <p>
+   * Optionally, update all rows, including those not in the 'apply to' scope.
+   * This makes more sense when switching between selected and unselected
+   * sequences. When selecting annotation types, or show/hide, we only apply the
+   * settings to the selected sequences.
+   * <p>
+   * Note this only affects sequence-specific annotations, others are left
+   * unchanged.
+   */
+  protected void repaintAnnotations(boolean updateAllRows)
+  {
+    for (AlignmentAnnotation aa : this.ap.getAlignment()
+            .getAlignmentAnnotation())
+    {
+      if (aa.sequenceRef != null)
+      {
+        setAnnotationVisibility(aa, updateAllRows);
+      }
+    }
+    // copied from AnnotationLabel.actionPerformed (after show/hide row)...
+    // TODO should drive this functionality into AlignmentPanel
+    ap.updateAnnotation();
+    this.ap.annotationPanel.adjustPanelHeight();
+    this.ap.alabels.setSize(this.ap.alabels.getSize().width,
+            this.ap.annotationPanel.getSize().height);
+    this.ap.validate();
+    this.ap.paintAlignment(true);
+  }
+
+  /**
+   * Determine and set the visibility of the given annotation from the currently
+   * selected options.
+   * <p>
+   * If its sequence is in the selected application scope
+   * (all/selected/unselected sequences), then we set its visibility.
+   * <p>
+   * If the annotation type is one of those currently selected by checkbox, set
+   * its visibility to the selected value. If it is not currently selected, set
+   * it to the opposite value. So, unselecting an annotation type with 'hide'
+   * selected, will cause those annotations to be unhidden.
+   * <p>
+   * If force update of all rows is wanted, then set rows not in the sequence
+   * selection scope to the opposite visibility to those in scope.
+   * 
+   * @param aa
+   * @param updateAllRows
+   */
+  protected void setAnnotationVisibility(AlignmentAnnotation aa,
+          boolean updateAllRows)
+  {
+    boolean setToVisible = false;
+    if (this.selectedTypes.containsKey(aa.label))
+    {
+      setToVisible = this.showSelected;
+    }
+    else
+    {
+      setToVisible = !this.showSelected;
+    }
+    if (isInActionScope(aa))
+    {
+      aa.visible = setToVisible;
+    }
+    else if (updateAllRows)
+    {
+      aa.visible = !setToVisible;
+    }
+    // TODO force not visible if associated sequence is hidden?
+    // currently hiding a sequence does not hide its annotation rows
+  }
+
+  /**
+   * Answers true if the annotation falls in the current selection criteria for
+   * show/hide.
+   * <p>
+   * It must be in the sequence selection group (for 'Apply to selection'), or
+   * not in it (for 'Apply except to selection'). No check needed for 'Apply to
+   * all'.
+   * 
+   * @param aa
+   * @return
+   */
+  protected boolean isInActionScope(AlignmentAnnotation aa)
+  {
+    boolean result = false;
+    if (this.applyToSelectedSequences && this.applyToUnselectedSequences)
+    {
+      // we don't care if the annotation's sequence is selected or not
+      result = true;
+    }
+    else if (this.sg.getSequences().contains(aa.sequenceRef))
+    {
+      // annotation is for a member of the selection group
+      result = this.applyToSelectedSequences ? true : false;
+    }
+    else
+    {
+      // annotation is not associated with the selection group
+      result = this.applyToUnselectedSequences ? true : false;
+    }
+    return result;
+  }
+
+  /**
+   * Get annotation 'types' for an alignment, optionally restricted to
+   * sequence-specific annotations only. The label is currently used for 'type'.
+   * 
+   * TODO refactor to helper class. See
+   * AnnotationColourChooser.getAnnotationItems() for another client
+   * 
+   * @param alignment
+   * @param sequenceSpecific
+   * @return
+   */
+  public static List<String> getAnnotationTypes(AlignmentI alignment,
+          boolean sequenceSpecificOnly)
+  {
+    // stub
+    List<String> result = new ArrayList<String>();
+    for (AlignmentAnnotation aa : alignment.getAlignmentAnnotation())
+    {
+      if (!sequenceSpecificOnly || aa.sequenceRef != null)
+      {
+        String label = aa.label;
+        if (!result.contains(label))
+        {
+          result.add(label);
+        }
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Construct the panel with options to:
+   * <p>
+   * show or hide the selected annotation types
+   * <p>
+   * do this for the current selection group or its inverse
+   * 
+   * @return
+   */
+  protected JPanel buildShowHideOptionsPanel()
+  {
+    JPanel jp = new JPanel();
+    jp.setLayout(new BorderLayout());
+
+    JPanel showHideOptions = buildShowHidePanel();
+    jp.add(showHideOptions, BorderLayout.CENTER);
+
+    JPanel applyToOptions = buildApplyToOptionsPanel();
+    jp.add(applyToOptions, BorderLayout.SOUTH);
+
+    return jp;
+  }
+
+  /**
+   * Build a panel with radio buttons options for sequences to apply show/hide
+   * to. Options are all, current selection, all except current selection.
+   * Initial state has 'current selection' selected.
+   * <p>
+   * If the sequence group is null, then we are acting on the whole alignment,
+   * and only 'all sequences' is enabled (and selected).
+   * 
+   * @return
+   */
+  protected JPanel buildApplyToOptionsPanel()
+  {
+    final boolean wholeAlignment = this.sg == null;
+    JPanel applyToOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
+    CheckboxGroup actingOn = new CheckboxGroup();
+    
+    String forAll = MessageManager.getString("label.all_sequences");
+    final Checkbox allSequences = new Checkbox(forAll, actingOn,
+            wholeAlignment);
+    allSequences.addItemListener(new ItemListener()
+    {
+      @Override
+      public void itemStateChanged(ItemEvent evt)
+      {
+        if (evt.getStateChange() == ItemEvent.SELECTED) {
+          AnnotationChooser.this.setApplyToSelectedSequences(true);
+          AnnotationChooser.this.setApplyToUnselectedSequences(true);
+          AnnotationChooser.this.repaintAnnotations(true);
+        }
+      }
+    });
+    applyToOptions.add(allSequences);
+    
+    String forSelected = MessageManager
+            .getString("label.selected_sequences");
+    final Checkbox selectedSequences = new Checkbox(forSelected, actingOn,
+            !wholeAlignment);
+    selectedSequences.setEnabled(!wholeAlignment);
+    selectedSequences.addItemListener(new ItemListener()
+    {
+      @Override
+      public void itemStateChanged(ItemEvent evt)
+      {
+        if (evt.getStateChange() == ItemEvent.SELECTED)
+        {
+          AnnotationChooser.this.setApplyToSelectedSequences(true);
+          AnnotationChooser.this.setApplyToUnselectedSequences(false);
+          AnnotationChooser.this.repaintAnnotations(true);
+        }
+      }
+    });
+    applyToOptions.add(selectedSequences);
+    
+    String exceptSelected = MessageManager
+            .getString("label.except_selected_sequences");
+    final Checkbox unselectedSequences = new Checkbox(exceptSelected, actingOn, false);
+    unselectedSequences.setEnabled(!wholeAlignment);
+    unselectedSequences.addItemListener(new ItemListener()
+    {
+      @Override
+      public void itemStateChanged(ItemEvent evt)
+      {
+        if (evt.getStateChange() == ItemEvent.SELECTED)
+        {
+          AnnotationChooser.this.setApplyToSelectedSequences(false);
+          AnnotationChooser.this.setApplyToUnselectedSequences(true);
+          AnnotationChooser.this.repaintAnnotations(true);
+        }
+      }
+    });
+    applyToOptions.add(unselectedSequences);
+    
+    // set member variables to match the initial selection state
+    this.applyToSelectedSequences = selectedSequences.getState()
+            || allSequences.getState();
+    this.applyToUnselectedSequences = unselectedSequences.getState()
+            || allSequences.getState();
+
+    return applyToOptions;
+  }
+
+  /**
+   * Build a panel with radio buttons options to show or hide selected
+   * annotations.
+   * 
+   * @return
+   */
+  protected JPanel buildShowHidePanel()
+  {
+    JPanel showHideOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
+    CheckboxGroup showOrHide = new CheckboxGroup();
+
+    /*
+     * Radio button 'Show selected annotations' - initially unselected
+     */
+    String showLabel = MessageManager
+            .getString("label.show_selected_annotations");
+    final Checkbox showOption = new Checkbox(showLabel, showOrHide, false);
+    showOption.addItemListener(new ItemListener()
+    {
+      @Override
+      public void itemStateChanged(ItemEvent evt)
+      {
+        if (evt.getStateChange() == ItemEvent.SELECTED) {
+          AnnotationChooser.this.setShowSelected(true);
+          AnnotationChooser.this.repaintAnnotations(false);
+        }
+      }
+    });
+    showHideOptions.add(showOption);
+
+    /*
+     * Radio button 'hide selected annotations'- initially selected
+     */
+    String hideLabel = MessageManager
+            .getString("label.hide_selected_annotations");
+    final Checkbox hideOption = new Checkbox(hideLabel, showOrHide, true);
+    hideOption.addItemListener(new ItemListener()
+    {
+      @Override
+      public void itemStateChanged(ItemEvent evt)
+      {
+        if (evt.getStateChange() == ItemEvent.SELECTED)
+        {
+          AnnotationChooser.this.setShowSelected(false);
+          AnnotationChooser.this.repaintAnnotations(false);
+        }
+      }
+    });
+    showHideOptions.add(hideOption);
+
+    /*
+     * Set member variable to match initial selection state
+     */
+    this.showSelected = showOption.getState();
+
+    return showHideOptions;
+  }
+
+  /**
+   * Construct the panel with OK and Cancel buttons.
+   * 
+   * @return
+   */
+  protected JPanel buildActionButtonsPanel()
+  {
+    JPanel jp = new JPanel();
+    final Font labelFont = JvSwingUtils.getLabelFont();
+    
+    JButton ok = new JButton(MessageManager.getString("action.ok"));
+    ok.setFont(labelFont);
+    ok.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        close_actionPerformed();
+      }
+    });
+    jp.add(ok);
+    
+    JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+    cancel.setFont(labelFont);
+    cancel.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        cancel_actionPerformed();
+      }
+    });
+    jp.add(cancel);
+
+    return jp;
+  }
+
+  /**
+   * On 'Cancel' button, undo any changes.
+   */
+  protected void cancel_actionPerformed()
+  {
+    resetOriginalState();
+    this.ap.repaint();
+    close_actionPerformed();
+  }
+
+  /**
+   * Restore annotation visibility to their state on entry here, and repaint
+   * alignment.
+   */
+  protected void resetOriginalState()
+  {
+    int i = 0;
+    for (AlignmentAnnotation aa : this.ap.getAlignment()
+            .getAlignmentAnnotation())
+    {
+      aa.visible = this.resetState[i++];
+    }
+  }
+
+  /**
+   * On 'Close' button, close the dialog.
+   */
+  protected void close_actionPerformed()
+  {
+    try
+    {
+      this.frame.setClosed(true);
+    } catch (Exception exe)
+    {
+    }
+  }
+
+  /**
+   * Render a frame containing this panel.
+   */
+  private void showFrame()
+  {
+    frame = new JInternalFrame();
+    frame.setContentPane(this);
+    frame.setLayer(JLayeredPane.PALETTE_LAYER);
+    Desktop.addInternalFrame(frame,
+            MessageManager.getString("label.choose_annotations"),
+            MY_FRAME_WIDTH, MY_FRAME_HEIGHT, true);
+  }
+
+  protected void setShowSelected(boolean showSelected)
+  {
+    this.showSelected = showSelected;
+  }
+
+  protected void setApplyToSelectedSequences(
+          boolean applyToSelectedSequences)
+  {
+    this.applyToSelectedSequences = applyToSelectedSequences;
+  }
+
+  protected void setApplyToUnselectedSequences(
+          boolean applyToUnselectedSequences)
+  {
+    this.applyToUnselectedSequences = applyToUnselectedSequences;
+  }
+
+}
index 39f3a13..32e3f58 100644 (file)
  */
 package jalview.gui;
 
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import net.miginfocom.swing.MigLayout;
-
 import jalview.bin.Cache;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.ColourSchemeI;
 import jalview.util.MessageManager;
 
+import java.awt.BorderLayout;
+import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JColorChooser;
+import javax.swing.JComboBox;
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import net.miginfocom.swing.MigLayout;
 
 public class AnnotationColourChooser extends JPanel
 {
@@ -84,11 +100,12 @@ public class AnnotationColourChooser extends JPanel
 
     slider.addChangeListener(new ChangeListener()
     {
+      @Override
       public void stateChanged(ChangeEvent evt)
       {
         if (!adjusting)
         {
-          thresholdValue.setText(((float) slider.getValue() / 1000f) + "");
+          thresholdValue.setText((slider.getValue() / 1000f) + "");
           valueChanged(!sliderDragging);
         }
       }
@@ -109,6 +126,7 @@ public class AnnotationColourChooser extends JPanel
         super.mouseDragged(e);
       }
 
+      @Override
       public void mouseReleased(MouseEvent evt)
       {
         if (sliderDragging)
@@ -213,7 +231,7 @@ public class AnnotationColourChooser extends JPanel
       if (!list.contains(label))
       {
         anmap[list.size()] = i;
-        list.addElement(label);
+        list.add(label);
 
       }
       else
@@ -221,13 +239,13 @@ public class AnnotationColourChooser extends JPanel
         if (!isSeqAssociated)
         {
           anmap[list.size()] = i;
-          list.addElement(label + "_" + (index++));
+          list.add(label + "_" + (index++));
         }
       }
     }
     seqAssociated.setEnabled(enableSeqAss);
-    annmap = new int[list.size()];
-    System.arraycopy(anmap, 0, annmap, 0, annmap.length);
+    this.annmap = new int[list.size()];
+    System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length);
     return list;
   }
 
@@ -258,6 +276,7 @@ public class AnnotationColourChooser extends JPanel
     minColour.setToolTipText(MessageManager.getString("label.min_colour"));
     minColour.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent e)
       {
         if (minColour.isEnabled())
@@ -272,6 +291,7 @@ public class AnnotationColourChooser extends JPanel
     maxColour.setToolTipText(MessageManager.getString("label.max_colour"));
     maxColour.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent e)
       {
         if (maxColour.isEnabled())
@@ -284,6 +304,7 @@ public class AnnotationColourChooser extends JPanel
     ok.setText(MessageManager.getString("action.ok"));
     ok.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         ok_actionPerformed(e);
@@ -293,6 +314,7 @@ public class AnnotationColourChooser extends JPanel
     cancel.setText(MessageManager.getString("action.cancel"));
     cancel.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         cancel_actionPerformed(e);
@@ -314,6 +336,7 @@ public class AnnotationColourChooser extends JPanel
 
     annotations.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         annotations_actionPerformed(e);
@@ -321,6 +344,7 @@ public class AnnotationColourChooser extends JPanel
     });
     threshold.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         threshold_actionPerformed(e);
@@ -328,6 +352,7 @@ public class AnnotationColourChooser extends JPanel
     });
     thresholdValue.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         thresholdValue_actionPerformed(e);
@@ -347,6 +372,7 @@ public class AnnotationColourChooser extends JPanel
             .getString("label.use_original_colours"));
     currentColours.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         currentColours_actionPerformed(e);
@@ -358,6 +384,7 @@ public class AnnotationColourChooser extends JPanel
             .getString("label.threshold_minmax"));
     thresholdIsMin.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         thresholdIsMin_actionPerformed(actionEvent);
@@ -679,7 +706,7 @@ public class AnnotationColourChooser extends JPanel
     {
       changeColour();
     }
-    currentAnnotation.threshold.value = (float) slider.getValue() / 1000f;
+    currentAnnotation.threshold.value = slider.getValue() / 1000f;
     propagateSeqAssociatedThreshold(updateAllAnnotation);
     ap.paintAlignment(false);
   }
index 0957d28..4ff525e 100644 (file)
@@ -25,8 +25,6 @@ import jalview.analysis.Conservation;
 import jalview.commands.ChangeCaseCommand;
 import jalview.commands.EditCommand;
 import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentView;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.PDBEntry;
@@ -60,7 +58,6 @@ import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Hashtable;
-import java.util.List;
 import java.util.Vector;
 
 import javax.swing.ButtonGroup;
@@ -129,6 +126,8 @@ public class PopupMenu extends JPopupMenu
 
   JMenuItem sequenceSelDetails = new JMenuItem();
 
+  JMenuItem chooseAnnotations = new JMenuItem();
+
   SequenceI sequence;
 
   JMenuItem createGroupMenuItem = new JMenuItem();
@@ -251,6 +250,7 @@ public class PopupMenu extends JPopupMenu
 
       item.addActionListener(new java.awt.event.ActionListener()
       {
+        @Override
         public void actionPerformed(ActionEvent e)
         {
           outputText_actionPerformed(e);
@@ -287,6 +287,7 @@ public class PopupMenu extends JPopupMenu
           menuItem.setText(pdb.getId());
           menuItem.addActionListener(new java.awt.event.ActionListener()
           {
+            @Override
             public void actionPerformed(ActionEvent e)
             {
               // TODO re JAL-860: optionally open dialog or provide a menu entry
@@ -337,6 +338,7 @@ public class PopupMenu extends JPopupMenu
             menuItem.addActionListener(new java.awt.event.ActionListener()
 
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 // System.out.println("1:"+structureLine);
@@ -377,6 +379,7 @@ public class PopupMenu extends JPopupMenu
                       { seq.getName() }));
               menuItem.addActionListener(new java.awt.event.ActionListener()
               {
+                @Override
                 public void actionPerformed(ActionEvent e)
                 {
                   // TODO: VARNA does'nt print gaps in the sequence
@@ -397,6 +400,7 @@ public class PopupMenu extends JPopupMenu
               MessageManager.getString("action.hide_sequences"));
       menuItem.addActionListener(new java.awt.event.ActionListener()
       {
+        @Override
         public void actionPerformed(ActionEvent e)
         {
           hideSequences(false);
@@ -412,6 +416,7 @@ public class PopupMenu extends JPopupMenu
                 { seq.getName() }));
         menuItem.addActionListener(new java.awt.event.ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent e)
           {
             hideSequences(true);
@@ -431,6 +436,7 @@ public class PopupMenu extends JPopupMenu
                   MessageManager.getString("action.reveal_sequences"));
           menuItem.addActionListener(new ActionListener()
           {
+            @Override
             public void actionPerformed(ActionEvent e)
             {
               ap.av.showSequence(index);
@@ -452,6 +458,7 @@ public class PopupMenu extends JPopupMenu
                 MessageManager.getString("action.reveal_all"));
         menuItem.addActionListener(new ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent e)
           {
             ap.av.showAllHiddenSeqs();
@@ -555,7 +562,7 @@ public class PopupMenu extends JPopupMenu
       SequenceI sqass = null;
       for (SequenceI sq : ap.av.getSequenceSelection())
       {
-        Vector<PDBEntry> pes = (Vector<PDBEntry>) sq.getDatasetSequence()
+        Vector<PDBEntry> pes = sq.getDatasetSequence()
                 .getPDBId();
         if (pes != null && pes.size() > 0)
         {
@@ -942,11 +949,13 @@ public class PopupMenu extends JPopupMenu
             { url }));
     item.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         new Thread(new Runnable()
         {
 
+          @Override
           public void run()
           {
             showLink(url);
@@ -982,11 +991,13 @@ public class PopupMenu extends JPopupMenu
     // TODO: put in info about what is being sent.
     item.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         new Thread(new Runnable()
         {
 
+          @Override
           public void run()
           {
             try
@@ -1017,6 +1028,7 @@ public class PopupMenu extends JPopupMenu
     groupName.setText(MessageManager.getString("label.name"));
     groupName.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         groupName_actionPerformed();
@@ -1027,15 +1039,28 @@ public class PopupMenu extends JPopupMenu
             .getString("label.edit_name_description"));
     sequenceName.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         sequenceName_actionPerformed();
       }
     });
+    chooseAnnotations.setText(MessageManager
+            .getString("label.choose_annotations") + "...");
+    chooseAnnotations
+            .addActionListener(new java.awt.event.ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        chooseAnnotations_actionPerformed(e);
+      }
+    });
     sequenceDetails.setText(MessageManager
             .getString("label.sequence_details") + "...");
     sequenceDetails.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         sequenceDetails_actionPerformed();
@@ -1046,6 +1071,7 @@ public class PopupMenu extends JPopupMenu
     sequenceSelDetails
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 sequenceSelectionDetails_actionPerformed();
@@ -1056,6 +1082,7 @@ public class PopupMenu extends JPopupMenu
             .setText(MessageManager.getString("action.remove_group"));
     unGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         unGroupMenuItem_actionPerformed();
@@ -1066,6 +1093,7 @@ public class PopupMenu extends JPopupMenu
     createGroupMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 createGroupMenuItem_actionPerformed();
@@ -1075,6 +1103,7 @@ public class PopupMenu extends JPopupMenu
     outline.setText(MessageManager.getString("action.border_colour"));
     outline.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         outline_actionPerformed();
@@ -1084,6 +1113,7 @@ public class PopupMenu extends JPopupMenu
             .setText(MessageManager.getString("label.nucleotide"));
     nucleotideMenuItem.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         nucleotideMenuItem_actionPerformed();
@@ -1094,6 +1124,7 @@ public class PopupMenu extends JPopupMenu
     showBoxes.setState(true);
     showBoxes.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showBoxes_actionPerformed();
@@ -1103,6 +1134,7 @@ public class PopupMenu extends JPopupMenu
     showText.setState(true);
     showText.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showText_actionPerformed();
@@ -1111,6 +1143,7 @@ public class PopupMenu extends JPopupMenu
     showColourText.setText(MessageManager.getString("label.colour_text"));
     showColourText.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showColourText_actionPerformed();
@@ -1121,6 +1154,7 @@ public class PopupMenu extends JPopupMenu
     displayNonconserved.setState(true);
     displayNonconserved.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showNonconserved_actionPerformed();
@@ -1130,6 +1164,7 @@ public class PopupMenu extends JPopupMenu
     cut.setText(MessageManager.getString("action.cut"));
     cut.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         cut_actionPerformed();
@@ -1138,6 +1173,7 @@ public class PopupMenu extends JPopupMenu
     upperCase.setText(MessageManager.getString("label.to_upper_case"));
     upperCase.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         changeCase(e);
@@ -1146,6 +1182,7 @@ public class PopupMenu extends JPopupMenu
     copy.setText(MessageManager.getString("action.copy"));
     copy.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         copy_actionPerformed();
@@ -1154,6 +1191,7 @@ public class PopupMenu extends JPopupMenu
     lowerCase.setText(MessageManager.getString("label.to_lower_case"));
     lowerCase.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         changeCase(e);
@@ -1162,6 +1200,7 @@ public class PopupMenu extends JPopupMenu
     toggle.setText(MessageManager.getString("label.toggle_case"));
     toggle.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         changeCase(e);
@@ -1172,6 +1211,7 @@ public class PopupMenu extends JPopupMenu
     pdbFromFile.setText(MessageManager.getString("label.from_file"));
     pdbFromFile.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         pdbFromFile_actionPerformed();
@@ -1206,6 +1246,7 @@ public class PopupMenu extends JPopupMenu
     enterPDB.setText(MessageManager.getString("label.enter_pdb_id"));
     enterPDB.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         enterPDB_actionPerformed();
@@ -1214,6 +1255,7 @@ public class PopupMenu extends JPopupMenu
     discoverPDB.setText(MessageManager.getString("label.discover_pdb_ids"));
     discoverPDB.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         discoverPDB_actionPerformed();
@@ -1225,6 +1267,7 @@ public class PopupMenu extends JPopupMenu
             .getString("label.create_sequence_feature"));
     sequenceFeature.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         sequenceFeature_actionPerformed();
@@ -1233,6 +1276,7 @@ public class PopupMenu extends JPopupMenu
     textColour.setText(MessageManager.getString("label.text_colour"));
     textColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         textColour_actionPerformed();
@@ -1247,6 +1291,7 @@ public class PopupMenu extends JPopupMenu
             + "...");
     editSequence.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         editSequence_actionPerformed(actionEvent);
@@ -1263,6 +1308,7 @@ public class PopupMenu extends JPopupMenu
     add(groupMenu);
     add(sequenceMenu);
     this.add(structureMenu);
+    groupMenu.add(chooseAnnotations);
     groupMenu.add(editMenu);
     groupMenu.add(outputMenu);
     groupMenu.add(sequenceFeature);
@@ -1303,6 +1349,7 @@ public class PopupMenu extends JPopupMenu
         JMenuItem item = new JMenuItem(userColours.nextElement().toString());
         item.addActionListener(new ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent evt)
           {
             userDefinedColour_actionPerformed(evt);
@@ -1342,6 +1389,7 @@ public class PopupMenu extends JPopupMenu
     noColourmenuItem.setText(MessageManager.getString("label.none"));
     noColourmenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         noColourmenuItem_actionPerformed();
@@ -1352,6 +1400,7 @@ public class PopupMenu extends JPopupMenu
             .getString("label.clustalx_colours"));
     clustalColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         clustalColour_actionPerformed();
@@ -1360,6 +1409,7 @@ public class PopupMenu extends JPopupMenu
     zappoColour.setText(MessageManager.getString("label.zappo"));
     zappoColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         zappoColour_actionPerformed();
@@ -1368,6 +1418,7 @@ public class PopupMenu extends JPopupMenu
     taylorColour.setText(MessageManager.getString("label.taylor"));
     taylorColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         taylorColour_actionPerformed();
@@ -1378,6 +1429,7 @@ public class PopupMenu extends JPopupMenu
     hydrophobicityColour
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 hydrophobicityColour_actionPerformed();
@@ -1386,6 +1438,7 @@ public class PopupMenu extends JPopupMenu
     helixColour.setText(MessageManager.getString("label.helix_propensity"));
     helixColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         helixColour_actionPerformed();
@@ -1395,6 +1448,7 @@ public class PopupMenu extends JPopupMenu
             .getString("label.strand_propensity"));
     strandColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         strandColour_actionPerformed();
@@ -1403,6 +1457,7 @@ public class PopupMenu extends JPopupMenu
     turnColour.setText(MessageManager.getString("label.turn_propensity"));
     turnColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         turnColour_actionPerformed();
@@ -1411,6 +1466,7 @@ public class PopupMenu extends JPopupMenu
     buriedColour.setText(MessageManager.getString("label.buried_index"));
     buriedColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         buriedColour_actionPerformed();
@@ -1420,6 +1476,7 @@ public class PopupMenu extends JPopupMenu
             .getString("label.above_identity_percentage"));
     abovePIDColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         abovePIDColour_actionPerformed();
@@ -1429,6 +1486,7 @@ public class PopupMenu extends JPopupMenu
             .getString("action.user_defined"));
     userDefinedColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         userDefinedColour_actionPerformed(e);
@@ -1438,6 +1496,7 @@ public class PopupMenu extends JPopupMenu
             .setText(MessageManager.getString("label.percentage_identity"));
     PIDColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         PIDColour_actionPerformed();
@@ -1446,6 +1505,7 @@ public class PopupMenu extends JPopupMenu
     BLOSUM62Colour.setText(MessageManager.getString("label.blosum62"));
     BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         BLOSUM62Colour_actionPerformed();
@@ -1456,6 +1516,7 @@ public class PopupMenu extends JPopupMenu
     purinePyrimidineColour
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 purinePyrimidineColour_actionPerformed();
@@ -1473,6 +1534,7 @@ public class PopupMenu extends JPopupMenu
     conservationMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 conservationMenuItem_actionPerformed();
@@ -1721,6 +1783,17 @@ public class PopupMenu extends JPopupMenu
   }
 
   /**
+   * Open a panel where the user can choose which types of sequence annotation
+   * to show or hide.
+   * 
+   * @param e
+   */
+  protected void chooseAnnotations_actionPerformed(ActionEvent e)
+  {
+    // todo correct way to guard against opening a duplicate panel?
+    new AnnotationChooser(ap);
+  }
+  /**
    * DOCUMENT ME!
    * 
    * @param e
@@ -2171,6 +2244,7 @@ public class PopupMenu extends JPopupMenu
             : ap.av.getSequenceSelection());
     Thread discpdb = new Thread(new Runnable()
     {
+      @Override
       public void run()
       {
 
@@ -2255,7 +2329,7 @@ public class PopupMenu extends JPopupMenu
     if (sg != null)
     {
       if (sequence == null)
-        sequence = (Sequence) sg.getSequenceAt(0);
+        sequence = sg.getSequenceAt(0);
 
       EditNameDialog dialog = new EditNameDialog(
               sequence.getSequenceAsString(sg.getStartRes(),
index d3154c7..3b8568c 100755 (executable)
@@ -186,6 +186,8 @@ public class GAlignFrame extends JInternalFrame
 
   public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
 
+  JMenuItem chooseAnnotations = new JMenuItem();
+
   JMenuItem deleteGroups = new JMenuItem();
 
   JMenuItem createGroup = new JMenuItem();
@@ -371,6 +373,7 @@ public class GAlignFrame extends JInternalFrame
 
         item.addActionListener(new java.awt.event.ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent e)
           {
             outputText_actionPerformed(e);
@@ -407,6 +410,7 @@ public class GAlignFrame extends JInternalFrame
         radioItem.setName("USER_DEFINED");
         radioItem.addMouseListener(new MouseAdapter()
         {
+          @Override
           public void mousePressed(MouseEvent evt)
           {
             if (evt.isControlDown()
@@ -431,6 +435,7 @@ public class GAlignFrame extends JInternalFrame
               {
                 radioItem.addActionListener(new ActionListener()
                 {
+                  @Override
                   public void actionPerformed(ActionEvent evt)
                   {
                     userDefinedColour_actionPerformed(evt);
@@ -442,6 +447,7 @@ public class GAlignFrame extends JInternalFrame
         });
         radioItem.addActionListener(new ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent evt)
           {
             userDefinedColour_actionPerformed(evt);
@@ -580,6 +586,7 @@ public class GAlignFrame extends JInternalFrame
                     | java.awt.event.KeyEvent.SHIFT_MASK, false));
     saveAs.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         saveAs_actionPerformed(e);
@@ -591,6 +598,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     closeMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         closeMenuItem_actionPerformed(false);
@@ -609,6 +617,7 @@ public class GAlignFrame extends JInternalFrame
     selectAllSequenceMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 selectAllSequenceMenuItem_actionPerformed(e);
@@ -621,6 +630,7 @@ public class GAlignFrame extends JInternalFrame
     deselectAllSequenceMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 deselectAllSequenceMenuItem_actionPerformed(e);
@@ -634,6 +644,7 @@ public class GAlignFrame extends JInternalFrame
     invertSequenceMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 invertSequenceMenuItem_actionPerformed(e);
@@ -643,6 +654,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("action.make_groups_selection"));
     grpsFromSelection.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         makeGrpsFromSelection_actionPerformed(e);
@@ -668,6 +680,7 @@ public class GAlignFrame extends JInternalFrame
     remove2LeftMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 remove2LeftMenuItem_actionPerformed(e);
@@ -681,6 +694,7 @@ public class GAlignFrame extends JInternalFrame
     remove2RightMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 remove2RightMenuItem_actionPerformed(e);
@@ -694,6 +708,7 @@ public class GAlignFrame extends JInternalFrame
     removeGappedColumnMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 removeGappedColumnMenuItem_actionPerformed(e);
@@ -708,6 +723,7 @@ public class GAlignFrame extends JInternalFrame
     removeAllGapsMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 removeAllGapsMenuItem_actionPerformed(e);
@@ -718,6 +734,7 @@ public class GAlignFrame extends JInternalFrame
     justifyLeftMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 justifyLeftMenuItem_actionPerformed(e);
@@ -728,6 +745,7 @@ public class GAlignFrame extends JInternalFrame
     justifyRightMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 justifyRightMenuItem_actionPerformed(e);
@@ -737,6 +755,7 @@ public class GAlignFrame extends JInternalFrame
     viewBoxesMenuItem.setState(true);
     viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         viewBoxesMenuItem_actionPerformed(e);
@@ -746,6 +765,7 @@ public class GAlignFrame extends JInternalFrame
     viewTextMenuItem.setState(true);
     viewTextMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         viewTextMenuItem_actionPerformed(e);
@@ -757,6 +777,7 @@ public class GAlignFrame extends JInternalFrame
     showNonconservedMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 showUnconservedMenuItem_actionPerformed(e);
@@ -767,6 +788,7 @@ public class GAlignFrame extends JInternalFrame
     sortPairwiseMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 sortPairwiseMenuItem_actionPerformed(e);
@@ -775,6 +797,7 @@ public class GAlignFrame extends JInternalFrame
     sortIDMenuItem.setText(MessageManager.getString("action.by_id"));
     sortIDMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         sortIDMenuItem_actionPerformed(e);
@@ -785,6 +808,7 @@ public class GAlignFrame extends JInternalFrame
     sortLengthMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 sortLengthMenuItem_actionPerformed(e);
@@ -793,6 +817,7 @@ public class GAlignFrame extends JInternalFrame
     sortGroupMenuItem.setText(MessageManager.getString("action.by_group"));
     sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         sortGroupMenuItem_actionPerformed(e);
@@ -806,6 +831,7 @@ public class GAlignFrame extends JInternalFrame
     removeRedundancyMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 removeRedundancyMenuItem_actionPerformed(e);
@@ -816,6 +842,7 @@ public class GAlignFrame extends JInternalFrame
     pairwiseAlignmentMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 pairwiseAlignmentMenuItem_actionPerformed(e);
@@ -825,6 +852,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.principal_component_analysis"));
     PCAMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         PCAMenuItem_actionPerformed(e);
@@ -835,6 +863,7 @@ public class GAlignFrame extends JInternalFrame
     averageDistanceTreeMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 averageDistanceTreeMenuItem_actionPerformed(e);
@@ -845,6 +874,7 @@ public class GAlignFrame extends JInternalFrame
     neighbourTreeMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 neighbourTreeMenuItem_actionPerformed(e);
@@ -862,6 +892,7 @@ public class GAlignFrame extends JInternalFrame
 
     clustalColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         clustalColour_actionPerformed(e);
@@ -870,6 +901,7 @@ public class GAlignFrame extends JInternalFrame
     zappoColour.setText(MessageManager.getString("label.zappo"));
     zappoColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         zappoColour_actionPerformed(e);
@@ -878,6 +910,7 @@ public class GAlignFrame extends JInternalFrame
     taylorColour.setText(MessageManager.getString("label.taylor"));
     taylorColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         taylorColour_actionPerformed(e);
@@ -888,6 +921,7 @@ public class GAlignFrame extends JInternalFrame
     hydrophobicityColour
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 hydrophobicityColour_actionPerformed(e);
@@ -896,6 +930,7 @@ public class GAlignFrame extends JInternalFrame
     helixColour.setText(MessageManager.getString("label.helix_propensity"));
     helixColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         helixColour_actionPerformed(e);
@@ -905,6 +940,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.strand_propensity"));
     strandColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         strandColour_actionPerformed(e);
@@ -913,6 +949,7 @@ public class GAlignFrame extends JInternalFrame
     turnColour.setText(MessageManager.getString("label.turn_propensity"));
     turnColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         turnColour_actionPerformed(e);
@@ -921,6 +958,7 @@ public class GAlignFrame extends JInternalFrame
     buriedColour.setText(MessageManager.getString("label.buried_index"));
     buriedColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         buriedColour_actionPerformed(e);
@@ -930,6 +968,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("action.user_defined"));
     userDefinedColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         userDefinedColour_actionPerformed(e);
@@ -939,6 +978,7 @@ public class GAlignFrame extends JInternalFrame
             .setText(MessageManager.getString("label.percentage_identity"));
     PIDColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         PIDColour_actionPerformed(e);
@@ -948,6 +988,7 @@ public class GAlignFrame extends JInternalFrame
             .setText(MessageManager.getString("label.blosum62_score"));
     BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         BLOSUM62Colour_actionPerformed(e);
@@ -956,6 +997,7 @@ public class GAlignFrame extends JInternalFrame
     nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
     nucleotideColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         nucleotideColour_actionPerformed(e);
@@ -967,6 +1009,7 @@ public class GAlignFrame extends JInternalFrame
     purinePyrimidineColour
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 purinePyrimidineColour_actionPerformed(e);
@@ -977,6 +1020,7 @@ public class GAlignFrame extends JInternalFrame
     RNAInteractionColour
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 RNAInteractionColour_actionPerformed(e);
@@ -994,6 +1038,7 @@ public class GAlignFrame extends JInternalFrame
     avDistanceTreeBlosumMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 avTreeBlosumMenuItem_actionPerformed(e);
@@ -1004,6 +1049,7 @@ public class GAlignFrame extends JInternalFrame
     njTreeBlosumMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 njTreeBlosumMenuItem_actionPerformed(e);
@@ -1017,6 +1063,7 @@ public class GAlignFrame extends JInternalFrame
     annotationPanelMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 annotationPanelMenuItem_actionPerformed(e);
@@ -1027,6 +1074,7 @@ public class GAlignFrame extends JInternalFrame
     colourTextMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 colourTextMenuItem_actionPerformed(e);
@@ -1035,6 +1083,7 @@ public class GAlignFrame extends JInternalFrame
     htmlMenuItem.setText(MessageManager.getString("label.html"));
     htmlMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         htmlMenuItem_actionPerformed(e);
@@ -1044,6 +1093,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.overview_window"));
     overviewMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         overviewMenuItem_actionPerformed(e);
@@ -1056,6 +1106,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     undoMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         undoMenuItem_actionPerformed(e);
@@ -1068,6 +1119,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     redoMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         redoMenuItem_actionPerformed(e);
@@ -1078,6 +1130,7 @@ public class GAlignFrame extends JInternalFrame
     conservationMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 conservationMenuItem_actionPerformed(e);
@@ -1086,6 +1139,7 @@ public class GAlignFrame extends JInternalFrame
     noColourmenuItem.setText(MessageManager.getString("label.none"));
     noColourmenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         noColourmenuItem_actionPerformed(e);
@@ -1094,6 +1148,7 @@ public class GAlignFrame extends JInternalFrame
     wrapMenuItem.setText(MessageManager.getString("label.wrap"));
     wrapMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         wrapMenuItem_actionPerformed(e);
@@ -1105,6 +1160,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     printMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         printMenuItem_actionPerformed(e);
@@ -1116,6 +1172,7 @@ public class GAlignFrame extends JInternalFrame
     renderGapsMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 renderGapsMenuItem_actionPerformed(e);
@@ -1127,6 +1184,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     findMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         findMenuItem_actionPerformed(e);
@@ -1136,6 +1194,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.above_identity_threshold"));
     abovePIDThreshold.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         abovePIDThreshold_actionPerformed(e);
@@ -1145,11 +1204,22 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.show_sequence_features"));
     showSeqFeatures.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         showSeqFeatures_actionPerformed(actionEvent);
       }
     });
+    chooseAnnotations.setText(MessageManager
+            .getString("label.choose_annotations") + "...");
+    chooseAnnotations.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent actionEvent)
+      {
+        chooseAnnotations_actionPerformed();
+      }
+    });
     /*
      * showSeqFeaturesHeight.setText("Vary Sequence Feature Height");
      * showSeqFeaturesHeight.addActionListener(new ActionListener() { public
@@ -1161,6 +1231,7 @@ public class GAlignFrame extends JInternalFrame
     showDbRefsMenuitem.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showDbRefs_actionPerformed(e);
@@ -1172,6 +1243,7 @@ public class GAlignFrame extends JInternalFrame
     showNpFeatsMenuitem.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showNpFeats_actionPerformed(e);
@@ -1183,6 +1255,7 @@ public class GAlignFrame extends JInternalFrame
     showGroupConservation.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showGroupConservation_actionPerformed(e);
@@ -1195,6 +1268,7 @@ public class GAlignFrame extends JInternalFrame
     showGroupConsensus.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showGroupConsensus_actionPerformed(e);
@@ -1206,6 +1280,7 @@ public class GAlignFrame extends JInternalFrame
     showConsensusHistogram.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showConsensusHistogram_actionPerformed(e);
@@ -1217,6 +1292,7 @@ public class GAlignFrame extends JInternalFrame
     showSequenceLogo.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showSequenceLogo_actionPerformed(e);
@@ -1228,6 +1304,7 @@ public class GAlignFrame extends JInternalFrame
     normaliseSequenceLogo.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         normaliseSequenceLogo_actionPerformed(e);
@@ -1241,6 +1318,7 @@ public class GAlignFrame extends JInternalFrame
     applyAutoAnnotationSettings.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         applyAutoAnnotationSettings_actionPerformed(e);
@@ -1251,6 +1329,7 @@ public class GAlignFrame extends JInternalFrame
     nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
     nucleotideColour.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         nucleotideColour_actionPerformed(e);
@@ -1276,6 +1355,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     deleteGroups.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         deleteGroups_actionPerformed(e);
@@ -1287,6 +1367,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     createGroup.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         createGroup_actionPerformed(e);
@@ -1299,6 +1380,7 @@ public class GAlignFrame extends JInternalFrame
                     | java.awt.event.KeyEvent.SHIFT_MASK, false));
     unGroup.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         unGroup_actionPerformed(e);
@@ -1311,6 +1393,7 @@ public class GAlignFrame extends JInternalFrame
 
     copy.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         copy_actionPerformed(e);
@@ -1322,6 +1405,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     cut.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         cut_actionPerformed(e);
@@ -1332,6 +1416,7 @@ public class GAlignFrame extends JInternalFrame
             java.awt.event.KeyEvent.VK_BACK_SPACE, 0, false));
     delete.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         delete_actionPerformed(e);
@@ -1345,6 +1430,7 @@ public class GAlignFrame extends JInternalFrame
                     | java.awt.event.KeyEvent.SHIFT_MASK, false));
     pasteNew.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         pasteNew_actionPerformed(e);
@@ -1356,6 +1442,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     pasteThis.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         pasteThis_actionPerformed(e);
@@ -1365,6 +1452,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.apply_colour_to_all_groups"));
     applyToAllGroups.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         applyToAllGroups_actionPerformed(e);
@@ -1372,6 +1460,7 @@ public class GAlignFrame extends JInternalFrame
     });
     createPNG.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         createPNG(null);
@@ -1383,6 +1472,7 @@ public class GAlignFrame extends JInternalFrame
     font.setText(MessageManager.getString("action.font"));
     font.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         font_actionPerformed(e);
@@ -1394,6 +1484,7 @@ public class GAlignFrame extends JInternalFrame
     seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
     seqLimits.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         seqLimit_actionPerformed(e);
@@ -1402,6 +1493,7 @@ public class GAlignFrame extends JInternalFrame
     epsFile.setText("EPS");
     epsFile.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         createEPS(null);
@@ -1413,6 +1505,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.load_associated_tree"));
     LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         LoadtreeMenuItem_actionPerformed(e);
@@ -1423,6 +1516,7 @@ public class GAlignFrame extends JInternalFrame
     scaleAbove.setText(MessageManager.getString("action.scale_above"));
     scaleAbove.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         scaleAbove_actionPerformed(e);
@@ -1433,6 +1527,7 @@ public class GAlignFrame extends JInternalFrame
     scaleLeft.setText(MessageManager.getString("action.scale_left"));
     scaleLeft.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         scaleLeft_actionPerformed(e);
@@ -1443,6 +1538,7 @@ public class GAlignFrame extends JInternalFrame
     scaleRight.setText(MessageManager.getString("action.scale_right"));
     scaleRight.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         scaleRight_actionPerformed(e);
@@ -1455,6 +1551,7 @@ public class GAlignFrame extends JInternalFrame
     centreColumnLabelsMenuItem
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 centreColumnLabels_actionPerformed(e);
@@ -1467,6 +1564,7 @@ public class GAlignFrame extends JInternalFrame
     followHighlightMenuItem.addActionListener(new ActionListener()
     {
 
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         followHighlight_actionPerformed();
@@ -1478,6 +1576,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.modify_identity_thereshold"));
     modifyPID.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         modifyPID_actionPerformed(e);
@@ -1488,6 +1587,7 @@ public class GAlignFrame extends JInternalFrame
     modifyConservation
             .addActionListener(new java.awt.event.ActionListener()
             {
+              @Override
               public void actionPerformed(ActionEvent e)
               {
                 modifyConservation_actionPerformed(e);
@@ -1498,15 +1598,18 @@ public class GAlignFrame extends JInternalFrame
     sort.setText(MessageManager.getString("action.sort"));
     sort.addMenuListener(new MenuListener()
     {
+      @Override
       public void menuSelected(MenuEvent e)
       {
         buildTreeMenu();
       }
 
+      @Override
       public void menuDeselected(MenuEvent e)
       {
       }
 
+      @Override
       public void menuCanceled(MenuEvent e)
       {
       }
@@ -1517,14 +1620,17 @@ public class GAlignFrame extends JInternalFrame
     sortByAnnotScore.addMenuListener(new javax.swing.event.MenuListener()
     {
 
+      @Override
       public void menuCanceled(MenuEvent e)
       {
       }
 
+      @Override
       public void menuDeselected(MenuEvent e)
       {
       }
 
+      @Override
       public void menuSelected(MenuEvent e)
       {
         buildSortByAnnotationScoresMenu();
@@ -1541,6 +1647,7 @@ public class GAlignFrame extends JInternalFrame
             .getDefault("PAD_GAPS", false));
     padGapsMenuitem.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         padGapsMenuitem_actionPerformed(e);
@@ -1550,6 +1657,7 @@ public class GAlignFrame extends JInternalFrame
     vamsasStore.setText(MessageManager.getString("label.vamsas_store"));
     vamsasStore.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         vamsasStore_actionPerformed(e);
@@ -1559,6 +1667,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.translate_cDNA"));
     showTranslation.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showTranslation_actionPerformed(e);
@@ -1568,6 +1677,7 @@ public class GAlignFrame extends JInternalFrame
             + "...");
     extractScores.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         extractScores_actionPerformed(e);
@@ -1586,6 +1696,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.feature_settings"));
     openFeatureSettings.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         featureSettings_actionPerformed(e);
@@ -1595,6 +1706,7 @@ public class GAlignFrame extends JInternalFrame
             .setText(MessageManager.getString("label.fetch_sequences"));
     fetchSequence.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         fetchSequence_actionPerformed(e);
@@ -1605,6 +1717,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("action.by_annotation"));
     annotationColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         annotationColour_actionPerformed(e);
@@ -1615,6 +1728,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("action.by_rna_helixes"));
     rnahelicesColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         rnahelicesColour_actionPerformed(e);
@@ -1625,6 +1739,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.load_features_annotations"));
     associatedData.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         associatedData_actionPerformed(e);
@@ -1636,6 +1751,7 @@ public class GAlignFrame extends JInternalFrame
             "AUTO_CALC_CONSENSUS", true));
     autoCalculate.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         autoCalculate_actionPerformed(e);
@@ -1651,6 +1767,7 @@ public class GAlignFrame extends JInternalFrame
             .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false));
     sortByTree.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         sortByTreeOption_actionPerformed(e);
@@ -1666,6 +1783,7 @@ public class GAlignFrame extends JInternalFrame
     listenToViewSelections.setState(false);
     listenToViewSelections.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         listenToViewSelections_actionPerformed(e);
@@ -1677,6 +1795,7 @@ public class GAlignFrame extends JInternalFrame
     addFromFile.setText(MessageManager.getString("label.from_file"));
     addFromFile.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         addFromFile_actionPerformed(e);
@@ -1685,6 +1804,7 @@ public class GAlignFrame extends JInternalFrame
     addFromText.setText(MessageManager.getString("label.from_textbox"));
     addFromText.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         addFromText_actionPerformed(e);
@@ -1693,6 +1813,7 @@ public class GAlignFrame extends JInternalFrame
     addFromURL.setText(MessageManager.getString("label.from_url"));
     addFromURL.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         addFromURL_actionPerformed(e);
@@ -1702,6 +1823,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.export_features"));
     exportFeatures.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         exportFeatures_actionPerformed(e);
@@ -1711,6 +1833,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.export_annotations"));
     exportAnnotations.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         exportAnnotations_actionPerformed(e);
@@ -1723,6 +1846,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.toggle_sequence_visibility"));
     showAllSeqs.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showAllSeqs_actionPerformed(e);
@@ -1733,6 +1857,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.toggle_columns_visibility"));
     showAllColumns.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showAllColumns_actionPerformed(e);
@@ -1745,6 +1870,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.toggle_sequence_visibility"));
     hideSelSequences.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         hideSelSequences_actionPerformed(e);
@@ -1756,6 +1882,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.toggle_columns_visibility"));
     hideSelColumns.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         hideSelColumns_actionPerformed(e);
@@ -1765,6 +1892,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.selected_region"));
     hideAllSelection.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         hideAllSelection_actionPerformed(e);
@@ -1775,6 +1903,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.all_but_selected_region"));
     hideAllButSelection.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         hideAllButSelection_actionPerformed(e);
@@ -1786,6 +1915,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.toggles_visibility_hidden_selected_regions"));
     showAllhidden.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showAllhidden_actionPerformed(e);
@@ -1796,6 +1926,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("action.show_hidden_markers"));
     hiddenMarkers.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         hiddenMarkers_actionPerformed(e);
@@ -1809,6 +1940,7 @@ public class GAlignFrame extends JInternalFrame
                     | java.awt.event.KeyEvent.ALT_MASK, false));
     invertColSel.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         invertColSel_actionPerformed(e);
@@ -1816,6 +1948,7 @@ public class GAlignFrame extends JInternalFrame
     });
     tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
     {
+      @Override
       public void stateChanged(ChangeEvent evt)
       {
         JTabbedPane pane = (JTabbedPane) evt.getSource();
@@ -1825,6 +1958,7 @@ public class GAlignFrame extends JInternalFrame
     });
     tabbedPane.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent e)
       {
         tabbedPane_mousePressed(e);
@@ -1832,6 +1966,7 @@ public class GAlignFrame extends JInternalFrame
     });
     tabbedPane.addFocusListener(new FocusAdapter()
     {
+      @Override
       public void focusGained(FocusEvent e)
       {
         tabbedPane_focusGained(e);
@@ -1843,6 +1978,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     save.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         save_actionPerformed(e);
@@ -1852,6 +1988,7 @@ public class GAlignFrame extends JInternalFrame
     reload.setText(MessageManager.getString("action.reload"));
     reload.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         reload_actionPerformed(e);
@@ -1863,6 +2000,7 @@ public class GAlignFrame extends JInternalFrame
                     .getMenuShortcutKeyMask(), false));
     newView.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         newView_actionPerformed(e);
@@ -1875,6 +2013,7 @@ public class GAlignFrame extends JInternalFrame
             + "...");
     textColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         textColour_actionPerformed(e);
@@ -1886,6 +2025,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.right_align_sequence_id"));
     idRightAlign.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         idRightAlign_actionPerformed(e);
@@ -1897,6 +2037,7 @@ public class GAlignFrame extends JInternalFrame
             java.awt.event.KeyEvent.VK_G, 0, false));
     gatherViews.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         gatherViews_actionPerformed(e);
@@ -1908,6 +2049,7 @@ public class GAlignFrame extends JInternalFrame
             java.awt.event.KeyEvent.VK_X, 0, false));
     expandViews.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         expandViews_actionPerformed(e);
@@ -1917,6 +2059,7 @@ public class GAlignFrame extends JInternalFrame
             .setText(MessageManager.getString("action.page_setup") + "...");
     pageSetup.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         pageSetup_actionPerformed(e);
@@ -1926,6 +2069,7 @@ public class GAlignFrame extends JInternalFrame
             .getString("label.alignment_props") + "...");
     alignmentProperties.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         alignmentProperties();
@@ -1999,6 +2143,7 @@ public class GAlignFrame extends JInternalFrame
     viewMenu.add(autoAnnMenu);
     viewMenu.addSeparator();
     viewMenu.add(showSeqFeatures);
+    viewMenu.add(chooseAnnotations);
     // viewMenu.add(showSeqFeaturesHeight);
 
     viewMenu.add(openFeatureSettings);
@@ -2107,6 +2252,14 @@ public class GAlignFrame extends JInternalFrame
     // selectMenu.add(listenToViewSelections);
   }
 
+  /**
+   * Action on menu item "Show/hide sequence annotations..."
+   */
+  protected void chooseAnnotations_actionPerformed()
+  {
+
+  }
+
   protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
diff --git a/test/jalview/gui/AnnotationChooserTest.java b/test/jalview/gui/AnnotationChooserTest.java
new file mode 100644 (file)
index 0000000..161ebee
--- /dev/null
@@ -0,0 +1,44 @@
+package jalview.gui;
+
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FileLoader;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit tests for AnnotationChooser
+ * 
+ * @author gmcarstairs
+ *
+ */
+public class AnnotationChooserTest
+{
+  final static String TEST_FILE = "./examples/uniref50.fa";
+  AnnotationChooser testee;
+
+  AlignFrame af;
+
+  @Before
+  public void setUp()
+  {
+    FileLoader fl = new jalview.io.FileLoader(false);
+    af = fl.LoadFileWaitTillLoaded(TEST_FILE,
+            AppletFormatAdapter.FILE);
+
+  }
+
+  @Test
+  public void testAlignmentLoader() throws Exception
+  {
+
+    AlignmentPanel parentPanel = new AlignmentPanel(af, af.getViewport());
+    testee = new AnnotationChooser(parentPanel);
+  }
+
+  @Test
+  public void testBuildFrame()
+  {
+
+  }
+}