JAL-3081 is/setShowAutocalculatedAbove pulled up to interface
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index 92b9a50..b27d66d 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.gui;
 
 import jalview.analysis.AnnotationSorter;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.bin.Cache;
@@ -804,10 +805,6 @@ public class AlignmentPanel extends GAlignmentPanel implements
   public void paintAlignment(boolean updateOverview,
           boolean updateStructures)
   {
-    final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
-            av.isShowAutocalculatedAbove());
-    sorter.sort(getAlignment().getAlignmentAnnotation(),
-            av.getSortAnnotationsBy());
     repaint();
 
     if (updateStructures)
@@ -825,6 +822,22 @@ public class AlignmentPanel extends GAlignmentPanel implements
   }
 
   /**
+   * Sorts annotations according to currently selected preferences. Does nothing
+   * if currently set to 'Custom' (manual) ordering.
+   */
+  @Override
+  public void sortAnnotations(boolean autoCalcOnly)
+  {
+    SequenceAnnotationOrder sortBy = av.getSortAnnotationsBy();
+    if (sortBy != SequenceAnnotationOrder.CUSTOM)
+    {
+      final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
+              av.isShowAutocalculatedAbove(), autoCalcOnly);
+      sorter.sort(getAlignment().getAlignmentAnnotation(), sortBy);
+    }
+  }
+
+  /**
    * DOCUMENT ME!
    * 
    * @param g