JAL-1264 adding show/hide annotation options to applet
[jalview.git] / src / jalview / appletgui / AlignmentPanel.java
index 9896ee7..c74914f 100644 (file)
  */
 package jalview.appletgui;
 
-import jalview.api.AlignViewportI;
-import jalview.api.AlignmentViewPanel;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SearchResults;
-import jalview.datamodel.SequenceI;
-import jalview.structure.StructureSelectionManager;
-
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Dimension;
@@ -40,6 +33,14 @@ import java.awt.event.AdjustmentListener;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
 
+import jalview.analysis.AnnotationSorter;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceI;
+import jalview.structure.StructureSelectionManager;
+
 public class AlignmentPanel extends Panel implements AdjustmentListener,
         AlignmentViewPanel
 {
@@ -801,8 +802,15 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
                     av.endSeq);
   }
 
+  /**
+   * Repaint the alignment and annotations, and, optionally, any overview window
+   */
   public void paintAlignment(boolean updateOverview)
   {
+    final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
+            av.isShowAutocalculatedAbove());
+    sorter.sort(getAlignment().getAlignmentAnnotation(),
+            av.getSortAnnotationsBy());
     repaint();
 
     if (updateOverview)