JAL-3081 autocalculated annotation first/last leaves others unchanged
[jalview.git] / src / jalview / gui / AlignFrame.java
index 092cf47..8994743 100644 (file)
@@ -146,8 +146,6 @@ import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 import javax.swing.JScrollPane;
 import javax.swing.SwingUtilities;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
 
 /**
  * DOCUMENT ME!
@@ -481,35 +479,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       }
     });
 
-    /*
-     * ensure By Label/Sequence are not selected if annotations
-     * have been reordered manually to CUSTOM order
-     */
-    annotationsMenu.addMenuListener(new MenuListener()
-    {
-      @Override
-      public void menuSelected(MenuEvent e)
-      {
-        SequenceAnnotationOrder sortAnnotationsBy = viewport
-                .getSortAnnotationsBy();
-        sortAnnByLabel.setSelected(
-                sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
-        sortAnnBySequence.setSelected(
-                sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
-      }
-
-      @Override
-      public void menuDeselected(MenuEvent e)
-      {
-      }
-
-      @Override
-      public void menuCanceled(MenuEvent e)
-      {
-      }
-    });
-
-    alignPanel.sortAnnotations();
+    alignPanel.sortAnnotations(false);
   }
 
   /**
@@ -4721,7 +4691,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       }
       if (isAnnotation)
       {
-
+        alignPanel.sortAnnotations(false);
         alignPanel.adjustAnnotationHeight();
         viewport.updateSequenceIdColours();
         buildSortByAnnotationScoresMenu();
@@ -5442,9 +5412,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * Sorts annotations and repaints the alignment
    */
   @Override
-  public void sortAnnotations()
+  public void sortAnnotations(boolean autoCalcOnly)
   {
-    alignPanel.sortAnnotations();
+    alignPanel.sortAnnotations(autoCalcOnly);
     alignPanel.paintAlignment(false, false);
   }