JAL-1152 annotation sorting preferences and help documentation
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 3 Nov 2014 16:59:04 +0000 (16:59 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 3 Nov 2014 16:59:04 +0000 (16:59 +0000)
15 files changed:
help/help.jhm
help/helpTOC.xml
help/html/menus/alignmentMenu.html
help/html/menus/alwannotation.html [new file with mode: 0755]
help/html/menus/alwannotationpanel.html [moved from help/html/menus/alwannotations.html with 100% similarity]
help/html/menus/alwview.html
help/html/menus/index.html
resources/lang/Messages.properties
src/jalview/analysis/AnnotationSorter.java
src/jalview/bin/Cache.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/Preferences.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GPreferences.java

index b199dbf..7750265 100755 (executable)
    <mapID target="alwEdit" url="html/menus/alwedit.html"/>
    <mapID target="alwSelect" url="html/menus/alwselect.html"/>
    <mapID target="alwView" url="html/menus/alwview.html"/>
+   <mapID target="alwAnnotations" url="html/menus/alwannotation.html"/>
    <mapID target="alwFormat" url="html/menus/alwformat.html"/>
    <mapID target="alwColour" url="html/menus/alwcolour.html"/>
    <mapID target="alwCalc" url="html/menus/alwcalculate.html"/>
    
    <mapID target="wsMenu" url="html/menus/wsmenu.html"/>
    <mapID target="popMenu" url="html/menus/popupMenu.html"/>
-   <mapID target="annotMenus" url="html/menus/alwannotations.html"/>
+   <mapID target="annotPanelMenu" url="html/menus/alwannotationpanel.html"/>
    
    <mapID target="memory" url="html/memory.html" />
    <mapID target="jalviewjnlp" url="html/jalviewjnlp.html" />
index 48a2b2a..4c09e8f 100755 (executable)
        <tocitem text="Window Menus" target="menus" expand="false">
                <tocitem text="Desktop Window" target="desktopMenu"/>
                <tocitem text="Alignment Window" target="alMenu">
-                <tocitem text="File Menu" target="alwFile"/>
-                <tocitem text="Edit Menu" target="alwEdit"/>
-                               <tocitem text="Select Menu" target="alwSelect"/> 
-                <tocitem text="View Menu" target="alwView"/>
-                               <tocitem text="Format Menu" target="alwFormat"/>
-                <tocitem text="Colour Menu" target="alwColour"/>
-                <tocitem text="Calculation Menu" target="alwCalc"/>
-               <tocitem text="Web Service Menu" target="wsMenu"/>
-               <tocitem text="Annotation Menus" target="annotMenus"/>
-               <tocitem text="Popup Menu" target="popMenu"/>
-                </tocitem>
+            <tocitem text="File Menu" target="alwFile"/>
+            <tocitem text="Edit Menu" target="alwEdit"/>
+                       <tocitem text="Select Menu" target="alwSelect"/> 
+            <tocitem text="View Menu" target="alwView"/>
+            <tocitem text="Annotations Menu" target="alwAnnotations"/>
+                       <tocitem text="Format Menu" target="alwFormat"/>
+            <tocitem text="Colour Menu" target="alwColour"/>
+            <tocitem text="Calculation Menu" target="alwCalc"/>
+                       <tocitem text="Web Service Menu" target="wsMenu"/>
+                       <tocitem text="Annotation Panel Menu" target="annotPanelMenu"/>
+                       <tocitem text="Popup Menu" target="popMenu"/>
+        </tocitem>
        </tocitem>
         <tocitem text="Preferences" target="preferences"/>
        <tocitem text="Memory Settings" target="memory" expand="false">
index a7cb733..f67faa9 100755 (executable)
                                                selected, the view will automatically scroll to display the
                                                highlighted sequence position corresponding to the position under
                                                the mouse pointer in a linked alignment or structure view.</em></li>
-                               <li><strong>Show Annotations<br> </strong><em>If this
-                                               is selected the &quot;Annotation Panel&quot; will be displayed
-                                               below the alignment. The default setting is to display the
-                                               conservation calculation, quality calculation and consensus values
-                                               as bar charts. </em>
-                               </li>
-                         <li><strong>Show All Annotations</strong><em><br>
-                           Show all available annotations on the alignment. You can selectively hide these from the <a href="./popupMenu.html">Popup</a> 
-                           or <a href="../features/annotation.html">Annotation</a> menus. (Since Jalview 2.8.2)</em></li>
-                         <li><strong>Hide All Annotations</strong><em><br>
-                           Hide all annotations on the alignment. (Since Jalview 2.8.2)</em></li>
-                               <li><strong>Autocalculated Annotation<br> </strong><em>Settings
-                                       for the display of autocalculated annotation.</em>
-                                       <ul>
-                                               <li><strong>Apply to all groups<br> </strong><em> When
-                                                       ticked, any modification to the current settings will be applied
-                                                       to all autocalculated annotation.</em></li>
-                                               <li><strong>Show Consensus Histogram<br> </strong><em>
-                                                       Enable or disable the display of the histogram above the
-                                                       consensus sequence.</em></li>
-                                               <li><strong>Show Consensus Logo<br> </strong><em> Enable
-                                                       or disable the display of the Consensus Logo above the consensus
-                                                       sequence.</em></li>
-                                               <li><strong>Normalise Consensus Logo<br>
-                                               </strong><em>When enabled, scales all logo stacks to the same height,
-                                                               making it easier to compare symbol diversity in highly variable
-                                                               regions.</em></li>
-                                               <li><strong>Group Conservation<br> </strong><em> When
-                                                       ticked, display a conservation row for all groups (only available
-                                                       for protein alignments).</em></li>
-                                               <li><strong>Apply to all groups<br> </strong><em> When
-                                                       ticked, display a consensus row for all groups.</em></li>
-                                       </ul></li>
                                <li><strong>Show Sequence Features</strong><br> <em>Show
                                                or hide sequence features on this alignment.</em>
                                </li>
                                                using the mouse. </em>
                                </li>
                        </ul></li>
+               <li><strong>Annotations</strong><em> (Since Jalview 2.8.2)</em>
+                       <ul>
+                         <li><strong>Show Annotations<br> </strong><em>If this
+                                               is selected the &quot;Annotation Panel&quot; will be displayed
+                                               below the alignment. The default setting is to display the
+                                               conservation calculation, quality calculation and consensus values
+                                               as bar charts. </em>
+                         </li>
+                         <li><strong>Show Alignment Related</strong><em><br>
+                           Show all annotations that are for the alignment as a whole (for example, Consensus, 
+                           or secondary structure prediction from alignment).</em></li>
+                         <li><strong>Hide Alignment Related</strong><em><br>
+                           Hide all annotations that are for the alignment as a whole.</em></li>
+                         <li><strong>Show Sequence Related</strong><em><br>
+                           Show all annotations that are for individual sequences.</em></li>
+                         <li><strong>Hide Sequence Related</strong><em><br>
+                           Hide all annotations that are for individual sequences.</em></li>
+                         <li><em>You can also selectively show or hide annotations from the <a href="./popupMenu.html">Popup</a> 
+                           or <a href="../features/annotation.html">Annotation</a> menus.</em></li>
+                         <li><strong>Sort by Sequence</strong><em><br>Sort sequence-specific annotations by sequence order in the alignment
+                         (and within that, by label).</em></li>
+                         <li><strong>Sort by Label</strong><em><br>Sort sequence-specific annotations by label
+                         (and within that, by sequence order). If neither sort order is selected, no sorting is applied,
+                         allowing you to make a manual ordering of the annotations.</em></li>
+                         <li><strong>Autocalculated Annotation<br> </strong><em>Settings
+                                       for the display of autocalculated annotation.</em>
+                                       <ul>
+                                           <li><strong>Show first<br></strong><em>
+                                             Show autocalculated annotations above sequence-specific annotations.
+                                             Note this also applies to other annotations for the alignment, for example secondary
+                                             structure prediction from alignment.</em></li>
+                                           <li><strong>Show last<br></strong><em>
+                                             Show autocalculated / alignment annotations below sequence-specific annotations.</em></li>
+                                               <li><strong>Apply to all groups<br> </strong><em> When
+                                                       ticked, any modification to the current settings will be applied
+                                                       to all autocalculated annotation.</em></li>
+                                               <li><strong>Show Consensus Histogram<br> </strong><em>
+                                                       Enable or disable the display of the histogram above the
+                                                       consensus sequence.</em></li>
+                                               <li><strong>Show Consensus Logo<br> </strong><em> Enable
+                                                       or disable the display of the Consensus Logo above the consensus
+                                                       sequence.</em></li>
+                                               <li><strong>Normalise Consensus Logo<br>
+                                               </strong><em>When enabled, scales all logo stacks to the same height,
+                                                               making it easier to compare symbol diversity in highly variable
+                                                               regions.</em></li>
+                                               <li><strong>Group Conservation<br> </strong><em> When
+                                                       ticked, display a conservation row for all groups (only available
+                                                       for protein alignments).</em></li>
+                                               <li><strong>Group Consensus<br> </strong><em> When
+                                                       ticked, display a consensus row for all groups.</em></li>
+                                       </ul>
+                               </li>
+                       </ul>
+               </li>
                <li><strong>Alignment Window Format Menu</strong>
                        <ul>
                                <li><strong>Font...<br> </strong><em>Opens the
diff --git a/help/html/menus/alwannotation.html b/help/html/menus/alwannotation.html
new file mode 100755 (executable)
index 0000000..2f98542
--- /dev/null
@@ -0,0 +1,79 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Alignment Window Menus</title>
+</head>
+
+<body>
+<p><strong>Alignment Window Annotations Menu</strong> (Since Jalview 2.8.2)</p>
+<ul>
+                         <li><strong>Show Alignment Related</strong><em><br>
+                           Show all annotations that are for the alignment as a whole (for example, Consensus, 
+                           or secondary structure prediction from alignment)).</em></li>
+                         <li><strong>Hide Alignment Related</strong><em><br>
+                           Hide all annotations that are for the alignment as a whole.</em></li>
+                         <li><strong>Show Sequence Related</strong><em><br>
+                           Show all annotations that are for individual sequences.</em></li>
+                         <li><strong>Hide Sequence Related</strong><em><br>
+                           Hide all annotations that are for individual sequences.</em></li>
+                         <li><strong>Show Alignment Related</strong><em><br>
+                           Show all annotations that are for the alignment as a whole (for example, Consensus).</em></li>
+                         <li><em>You can also selectively show or hide annotations from the <a href="./popupMenu.html">Popup</a> 
+                           or <a href="../features/annotation.html">Annotation</a> menus.</em></li>
+                         <li><strong>Sort by Sequence</strong><em><br>Sort sequence-specific annotations by sequence order in the alignment
+                         (and within that, by label).</em></li>
+                         <li><strong>Sort by Label</strong><em><br>Sort sequence-specific annotations by label
+                         (and within that, by sequence order). If neither sort order is selected, no sorting is applied,
+                         allowing you to make a manual ordering of the annotations.</em></li>
+                         <li><strong>Autocalculated Annotation<br> </strong><em>Settings
+                                       for the display of autocalculated annotation.</em>
+                                       <ul>
+                                           <li><strong>Show first<br></strong><em>
+                                             Show autocalculated annotations above sequence-specific annotations.
+                                             Note this also applies to other annotations for the alignment, for example secondary
+                                             structure prediction from alignment.</em></li>
+                                           <li><strong>Show last<br></strong><em>
+                                             Show autocalculated / alignment annotations below sequence-specific annotations.</em></li>
+                                               <li><strong>Apply to all groups<br> </strong><em> When
+                                                       ticked, any modification to the current settings will be applied
+                                                       to all autocalculated annotation.</em></li>
+                                               <li><strong>Show Consensus Histogram<br> </strong><em>
+                                                       Enable or disable the display of the histogram above the
+                                                       consensus sequence.</em></li>
+                                               <li><strong>Show Consensus Logo<br> </strong><em> Enable
+                                                       or disable the display of the Consensus Logo above the consensus
+                                                       sequence.</em></li>
+                                               <li><strong>Normalise Consensus Logo<br>
+                                               </strong><em>When enabled, scales all logo stacks to the same height,
+                                                               making it easier to compare symbol diversity in highly variable
+                                                               regions.</em></li>
+                                               <li><strong>Group Conservation<br> </strong><em> When
+                                                       ticked, display a conservation row for all groups (only available
+                                                       for protein alignments).</em></li>
+                                               <li><strong>Group Consensus<br> </strong><em> When
+                                                       ticked, display a consensus row for all groups.</em></li>
+                                       </ul>
+                               </li>
+</ul>
+<p>&nbsp;</p>
+</body>
+</html>
index cb38708..e8fce84 100755 (executable)
     All hidden Columns / Sequences / Sequences and Columns will be revealed. </em></li>
   <li><strong>Hide&#8594;(all Columns / Sequences / Selected Region / All but Selected Region)</strong><em><br>
     Hides the currently selected Columns / Sequences / Region  or everything but the selected Region.</em></li>
-  <li><strong>Show Annotations<br>
-    </strong><em>If this is selected the &quot;Annotation Panel&quot; will be 
-    displayed below the alignment. The default setting is to display the conservation 
-    calculation, quality calculation and consensus values as bar charts. </em></li>
-  <li><strong>Show All Annotations</strong><em><br>
-    Show all available annotations on the alignment. You can selectively hide these from the <a href="./popupMenu.html">Popup</a> 
-    &nbsp;or <a href="../features/annotation.html">Annotation</a>&nbsp;menus. (Since Jalview 2.8.2)</em></li>
-  <li><strong>Hide All Annotations</strong><em><br>
-    Hide all annotations on the alignment. (Since Jalview 2.8.2)</em></li>
-    <li><strong>Autocalculated Annotation<br></strong>Settings for the display of autocalculated annotation.
-    <ul><li>
-       <strong>Apply to all groups<br></strong>
-       When ticked, any modification to the current settings will be applied to all autocalculated annotation.
-       </li> 
-       <li>
-       <strong>Show Consensus Histogram<br></strong>
-       Enable or disable the display of the histogram above the consensus sequence.
-       </li>
-       <li>
-       <strong>Show Consensus Logo<br></strong>
-               Enable or disable the display of the sequence logo above the consensus sequence.
-       </li>
-                               <li><strong>Normalise Consensus Logo<br>
-                               </strong><em>When enabled, scales all logo stacks to the same height,
-                                               making it easier to compare symbol diversity in highly variable
-                                               regions.</em></li>
-
-                               <li>
-       <strong>Group Conservation<br></strong>
-       When ticked, display a conservation row for all groups (only available for protein alignments).
-       </li>
-       <li>
-       <strong>Apply to all groups<br></strong>
-       When ticked, display a consensus row for all groups.
-       </li>
-       </ul>
-    </li>
   <li><strong>Automatic Scrolling<br>
     </strong><em>When selected, the view will automatically scroll to display the
     highlighted sequence position corresponding to the position under the mouse 
index 2b51b18..7e1ed70 100755 (executable)
@@ -35,7 +35,7 @@ accessible once an alignment has been opened.</p>
 <p>The <a href="popupMenu.html">Popup Menus</a> are opened by
 clicking with the right mouse button in the alignment display area or on
 a sequence label in the alignment window.</p>
-<p>The <a href="alwannotations.html">Annotations Menu</a> is opened
+<p>The <a href="alwannotationpanel.html">Annotations Menu</a> is opened
 by right-clicking on an annotation row label or in an annotation row.</p>
 
 </body>
index fe04105..93977b4 100644 (file)
@@ -480,10 +480,11 @@ label.edit_sequences = Edit Sequences
 label.sequence_details = Sequence Details
 label.jmol_help = Jmol Help
 label.all = All
-label.sort_by = Sort by
+label.sort_by = Sort alignment by
 label.sort_by_score = Sort by Score
 label.sort_by_density = Sort by Density
 label.sequence_sort_by_density = Sequence sort by Density
+label.sort_ann_by = Sort annotations by
 label.sort_annotations_by_sequence = Sort by sequence
 label.sort_annotations_by_label = Sort by label
 label.reveal = Reveal
index b9e9ed5..28fa1f8 100644 (file)
@@ -17,9 +17,43 @@ import java.util.Comparator;
 public class AnnotationSorter
 {
 
+  /**
+   * enum for annotation sort options. The text description is used in the
+   * Preferences drop-down options. The enum name is saved in the preferences
+   * file.
+   * 
+   * @author gmcarstairs
+   *
+   */
   public enum SequenceAnnotationOrder
   {
-    SEQUENCE_AND_LABEL, LABEL_AND_SEQUENCE, NONE
+    // Text descriptions surface in the Preferences Sort by... options
+    SEQUENCE_AND_LABEL("Sequence"), LABEL_AND_SEQUENCE("Label"), NONE(
+            "No sort");
+
+    private String description;
+
+    private SequenceAnnotationOrder(String s)
+    {
+      description = s;
+    }
+
+    @Override
+    public String toString()
+    {
+      return description;
+    }
+
+    public static SequenceAnnotationOrder forDescription(String d) {
+      for (SequenceAnnotationOrder order : values())
+      {
+        if (order.toString().equals(d))
+        {
+          return order;
+        }
+      }
+      return null;
+    }
   }
 
   private final AlignmentI alignment;
index 2a9f53d..21a030b 100755 (executable)
@@ -32,8 +32,11 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.Collections;
 import java.util.Date;
+import java.util.Enumeration;
 import java.util.Properties;
+import java.util.TreeSet;
 
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Level;
@@ -204,13 +207,26 @@ public class Cache
 
   public static final String DAS_ACTIVE_SOURCE = "DAS_ACTIVE_SOURCE";
 
+  /*
+   * Property key/value constants
+   */
+  public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
+
+  public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
+
   /**
    * Initialises the Jalview Application Log
    */
   public static Logger log;
 
   /** Jalview Properties */
-  public static Properties applicationProperties = new Properties();
+  public static Properties applicationProperties = new Properties() {
+    // override results in properties output in alphabetical order
+    @Override
+    public synchronized Enumeration<Object> keys() {
+        return Collections.enumeration(new TreeSet<Object>(super.keySet()));
+    }
+  };
 
   /** Default file is ~/.jalview_properties */
   static String propertiesFile;
index 0069818..177c3ac 100644 (file)
@@ -5804,7 +5804,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     this.alignPanel.av.setSortAnnotationsBy(getAnnotationSortOrder());
     this.alignPanel.av
             .setShowAutocalculatedAbove(isShowAutoCalculatedAbove());
-    alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+    alignPanel.paintAlignment(true);
   }
 }
 
index d331e82..a738991 100644 (file)
@@ -366,9 +366,10 @@ public class AlignViewport extends AlignmentViewport implements
     sortByTree = Cache.getDefault("SORT_BY_TREE", false);
     followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
     sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault(
-            "SORT_ANNOTATIONS", SequenceAnnotationOrder.NONE.name()));
+            Cache.SORT_ANNOTATIONS, SequenceAnnotationOrder.NONE.name()));
     showAutocalculatedAbove = Cache
-            .getDefault("SHOW_AUTOCALC_ABOVE", false);
+.getDefault(Cache.SHOW_AUTOCALC_ABOVE,
+            false);
   }
 
   /**
index e44915d..dfb89b2 100755 (executable)
  */
 package jalview.gui;
 
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import jalview.bin.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.bin.Cache;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.jbgui.GPreferences;
+import jalview.jbgui.GSequenceLink;
+import jalview.schemes.ColourSchemeProperty;
 import jalview.util.MessageManager;
 
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.util.Collection;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JColorChooser;
+import javax.swing.JFileChooser;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+
 /**
  * DOCUMENT ME!
  * 
@@ -213,6 +224,24 @@ public class Preferences extends GPreferences
     sortby.addItem("Pairwise Identity");
     sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
 
+    sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
+    sortAnnBy
+            .addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString());
+    sortAnnBy
+            .addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString());
+    SequenceAnnotationOrder savedSort = SequenceAnnotationOrder
+            .valueOf(Cache.getDefault(Cache.SORT_ANNOTATIONS,
+                    SequenceAnnotationOrder.NONE.name()));
+    sortAnnBy.setSelectedItem(savedSort.toString());
+
+    sortAutocalc.addItem("Autocalculated first");
+    sortAutocalc.addItem("Autocalculated last");
+
+    final boolean showAbove = Cache.getDefault(Cache.SHOW_AUTOCALC_ABOVE,
+            true);
+    sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
+            : sortAutocalc.getItemAt(1));
+
     epsRendering.addItem(MessageManager.getString("label.prompt_each_time"));
     epsRendering.addItem(MessageManager.getString("label.lineart"));
     epsRendering.addItem(MessageManager.getString("action.text"));
@@ -355,6 +384,19 @@ public class Preferences extends GPreferences
     Cache.applicationProperties.setProperty("SORT_ALIGNMENT", sortby
             .getSelectedItem().toString());
 
+    // convert description of sort order to enum name for save
+    SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder
+            .forDescription(sortAnnBy.getSelectedItem().toString());
+    if (annSortOrder != null)
+    {
+      Cache.applicationProperties.setProperty(Cache.SORT_ANNOTATIONS,
+              annSortOrder.name());
+    }
+
+    final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
+    Cache.applicationProperties.setProperty(Cache.SHOW_AUTOCALC_ABOVE,
+            Boolean.valueOf(showAutocalcFirst).toString());
+
     Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
             minColour.getBackground());
     Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
index dba77dd..a7852b4 100755 (executable)
@@ -1139,15 +1139,20 @@ public class GAlignFrame extends JInternalFrame
         hideAllAnnotations_actionPerformed(true, false);
       }
     });
+    SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
+            .valueOf(Cache.getDefault(Cache.SORT_ANNOTATIONS,
+                    SequenceAnnotationOrder.NONE.name()));
     sortAnnBySequence.setText(MessageManager
             .getString("label.sort_annotations_by_sequence"));
+    sortAnnBySequence
+            .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
     sortAnnBySequence.addActionListener(new ActionListener()
     {
       @Override
       public void actionPerformed(ActionEvent e)
       {
         boolean newState = sortAnnBySequence.getState();
-        sortAnnByLabel.setState(false);
+        sortAnnByLabel.setSelected(false);
         setAnnotationSortOrder(newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
                 : SequenceAnnotationOrder.NONE);
         sortAnnotations_actionPerformed();
@@ -1155,13 +1160,15 @@ public class GAlignFrame extends JInternalFrame
     });
     sortAnnByLabel.setText(MessageManager
             .getString("label.sort_annotations_by_label"));
+    sortAnnByLabel
+            .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
     sortAnnByLabel.addActionListener(new ActionListener()
     {
       @Override
       public void actionPerformed(ActionEvent e)
       {
         boolean newState = sortAnnByLabel.getState();
-        sortAnnBySequence.setState(false);
+        sortAnnBySequence.setSelected(false);
         setAnnotationSortOrder(newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
                 : SequenceAnnotationOrder.NONE);
         sortAnnotations_actionPerformed();
@@ -1415,7 +1422,8 @@ public class GAlignFrame extends JInternalFrame
     });
 
     showAutoFirst.setText(MessageManager.getString("label.show_first"));
-    showAutoFirst.setState(Cache.getDefault("SHOW_AUTOCALC_ABOVE", false));
+    showAutoFirst.setState(Cache.getDefault(Cache.SHOW_AUTOCALC_ABOVE,
+            false));
     showAutoFirst.addActionListener(new ActionListener()
     {
       @Override
index bf01a01..2223c1f 100755 (executable)
@@ -23,13 +23,40 @@ package jalview.jbgui;
 import jalview.gui.JvSwingUtils;
 import jalview.util.MessageManager;
 
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
 import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
 
 /**
  * DOCUMENT ME!
@@ -73,19 +100,19 @@ public class GPreferences extends JPanel
 
   JLabel gapLabel = new JLabel();
 
-  protected JComboBox colour = new JComboBox();
+  protected JComboBox<String> colour = new JComboBox<String>();
 
   JLabel colourLabel = new JLabel();
 
   JLabel fontLabel = new JLabel();
 
-  protected JComboBox fontSizeCB = new JComboBox();
+  protected JComboBox<String> fontSizeCB = new JComboBox<String>();
 
-  protected JComboBox fontStyleCB = new JComboBox();
+  protected JComboBox<String> fontStyleCB = new JComboBox<String>();
 
-  protected JComboBox fontNameCB = new JComboBox();
+  protected JComboBox<String> fontNameCB = new JComboBox<String>();
 
-  protected JComboBox gapSymbolCB = new JComboBox();
+  protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
 
   protected JCheckBox startupCheckbox = new JCheckBox();
 
@@ -145,10 +172,16 @@ public class GPreferences extends JPanel
 
   GridBagLayout gridBagLayout3 = new GridBagLayout();
 
-  protected JComboBox sortby = new JComboBox();
+  protected JComboBox<String> sortby = new JComboBox<String>();
 
   JLabel sortLabel = new JLabel();
 
+  protected JComboBox<String> sortAnnBy = new JComboBox<String>();
+
+  protected JComboBox<String> sortAutocalc = new JComboBox<String>();
+
+  JLabel sortAnnLabel = new JLabel();
+
   JPanel jPanel2 = new JPanel();
 
   JPanel visual2panel = new JPanel();
@@ -169,7 +202,7 @@ public class GPreferences extends JPanel
 
   JLabel epsLabel = new JLabel();
 
-  protected JComboBox epsRendering = new JComboBox();
+  protected JComboBox<String> epsRendering = new JComboBox<String>();
 
   protected JLabel userIdWidthlabel = new JLabel();
 
@@ -450,7 +483,7 @@ public class GPreferences extends JPanel
     fontNameCB.setFont(verdana11);
     fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
     gapSymbolCB.setFont(verdana11);
-    gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 23));
+    gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
     mincolourLabel.setFont(verdana11);
     mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
     mincolourLabel.setText(MessageManager.getString("label.min_colour"));
@@ -484,7 +517,7 @@ public class GPreferences extends JPanel
     startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
     startupCheckbox.setSelected(true);
     startupFileTextfield.setFont(verdana11);
-    startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
+    startupFileTextfield.setBounds(new Rectangle(172, 287, 270, 20));
     startupFileTextfield.addMouseListener(new MouseAdapter()
     {
       public void mouseClicked(MouseEvent e)
@@ -605,13 +638,20 @@ public class GPreferences extends JPanel
     jPanel1.setBorder(titledBorder1);
     jPanel1.setLayout(gridBagLayout1);
     sortby.setFont(verdana11);
-    sortby.setBounds(new Rectangle(172, 249, 155, 21));
+    sortby.setBounds(new Rectangle(172, 240, 155, 21));
     sortLabel.setFont(verdana11);
     sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
     sortLabel.setText(MessageManager.getString("label.sort_by"));
-    jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
+    sortAnnBy.setFont(verdana11);
+    sortAnnBy.setBounds(new Rectangle(172, 264, 120, 21));
+    sortAnnLabel.setFont(verdana11);
+    sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+    sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
+    sortAutocalc.setFont(verdana11);
+    sortAutocalc.setBounds(new Rectangle(300, 264, 185, 21));
+    jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
     jPanel2.setLayout(gridLayout2);
-    gridLayout2.setRows(12);
+    gridLayout2.setRows(13);
     exportTab.setLayout(null);
     epsLabel.setFont(verdana11);
     epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -746,10 +786,13 @@ public class GPreferences extends JPanel
     jPanel2.add(gapLabel);
     jPanel2.add(wrap);
     jPanel2.add(sortLabel);
+    jPanel2.add(sortAnnLabel);
     jPanel2.add(startupCheckbox);
     visualTab.add(annotations);
     visualTab.add(startupFileTextfield);
     visualTab.add(sortby);
+    visualTab.add(sortAnnBy);
+    visualTab.add(sortAutocalc);
     visualTab.add(gapSymbolCB);
     visualTab.add(fontNameCB);
     visualTab.add(fontSizeCB);