JAL-2591 Refactor HiddenColumns to use ArrayList instead of Vector
[jalview.git] / src / jalview / appletgui / AnnotationColumnChooser.java
index 2acb568..2557c8d 100644 (file)
@@ -46,7 +46,7 @@ import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.awt.event.TextEvent;
 import java.awt.event.TextListener;
-import java.util.Iterator;
+import java.util.ArrayList;
 import java.util.Vector;
 
 //import javax.swing.JPanel;
@@ -142,7 +142,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
     }
     setOldHiddenColumns(av.getAlignment().getHiddenColumns());
     adjusting = true;
-    Vector<String> list = new Vector<String>();
+    Vector<String> list = new Vector<>();
     int index = 1;
     for (int i = 0; i < anns.length; i++)
     {
@@ -298,16 +298,16 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
         HiddenColumns oldHidden = av
                 .getAnnotationColumnSelectionState()
                 .getOldHiddenColumns();
-        if (oldHidden != null && oldHidden.getListOfCols() != null
-                && !oldHidden.getListOfCols().isEmpty())
+        if (oldHidden != null)
         {
-          for (Iterator<int[]> itr = oldHidden.getListOfCols()
-                  .iterator(); itr.hasNext();)
+          ArrayList<int[]> regions = oldHidden.getHiddenColumnsCopy();
+          for (int[] positions : regions)
           {
-            int positions[] = itr.next();
             av.hideColumns(positions[0], positions[1]);
           }
         }
+        // TODO not clear why we need to hide all the columns (above) if we are
+        // going to copy the hidden columns over wholesale anyway
         av.getAlignment().setHiddenColumns(oldHidden);
       }
       ap.paintAlignment(true);
@@ -444,7 +444,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
       // build filter params
       filterParams
               .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
-      if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH)
+      if (getCurrentAnnotation().isQuantitative())
       {
         filterParams
                 .setThresholdValue(getCurrentAnnotation().threshold.value);
@@ -598,7 +598,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
   {
     String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
     if (av.getAlignment().getAlignmentAnnotation()[getAnnotations()
-            .getSelectedIndex()].graph != AlignmentAnnotation.NO_GRAPH)
+            .getSelectedIndex()].isQuantitative())
     {
       currentView = AnnotationColumnChooser.GRAPH_VIEW;
     }