JAL-1114 - refactor methods handling Vectors and Hashtables to Lists and Maps, and...
[jalview.git] / src / jalview / appletgui / AnnotationColourChooser.java
index 5463ed8..1a661be 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -55,14 +55,11 @@ public class AnnotationColourChooser extends Panel implements
     }
 
     oldcs = av.getGlobalColourScheme();
-    if (av.alignment.getGroups() != null)
+    if (av.getAlignment().getGroups() != null)
     {
       oldgroupColours = new Hashtable();
-      Vector allGroups = ap.av.alignment.getGroups();
-      SequenceGroup sg;
-      for (int g = 0; g < allGroups.size(); g++)
+      for (SequenceGroup sg: ap.av.getAlignment().getGroups())
       {
-        sg = (SequenceGroup) allGroups.elementAt(g);
         if (sg.cs != null)
         {
           oldgroupColours.put(sg, sg.cs);
@@ -79,7 +76,7 @@ public class AnnotationColourChooser extends Panel implements
     slider.addAdjustmentListener(this);
     slider.addMouseListener(this);
 
-    if (av.alignment.getAlignmentAnnotation() == null)
+    if (av.getAlignment().getAlignmentAnnotation() == null)
     {
       return;
     }
@@ -100,9 +97,9 @@ public class AnnotationColourChooser extends Panel implements
 
     Vector list = new Vector();
     int index = 1;
-    for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
+    for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
     {
-      String label = av.alignment.getAlignmentAnnotation()[i].label;
+      String label = av.getAlignment().getAlignmentAnnotation()[i].label;
       if (!list.contains(label))
         list.addElement(label);
       else
@@ -395,7 +392,7 @@ public class AnnotationColourChooser extends Panel implements
       return;
     }
 
-    currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
+    currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations
             .getSelectedIndex()];
 
     int aboveThreshold = -1;
@@ -464,14 +461,11 @@ public class AnnotationColourChooser extends Panel implements
 
     av.setGlobalColourScheme(acg);
 
-    if (av.alignment.getGroups() != null)
+    if (av.getAlignment().getGroups() != null)
     {
-      Vector allGroups = ap.av.alignment.getGroups();
-      SequenceGroup sg;
-      for (int g = 0; g < allGroups.size(); g++)
+      for (SequenceGroup sg:ap.av.getAlignment().getGroups())
       {
-        sg = (SequenceGroup) allGroups.elementAt(g);
-
+     
         if (sg.cs == null)
         {
           continue;
@@ -499,13 +493,10 @@ public class AnnotationColourChooser extends Panel implements
   void reset()
   {
     av.setGlobalColourScheme(oldcs);
-    if (av.alignment.getGroups() != null)
+    if (av.getAlignment().getGroups() != null)
     {
-      Vector allGroups = ap.av.alignment.getGroups();
-      SequenceGroup sg;
-      for (int g = 0; g < allGroups.size(); g++)
+      for (SequenceGroup sg:ap.av.getAlignment().getGroups())
       {
-        sg = (SequenceGroup) allGroups.elementAt(g);
         Object cs = oldgroupColours.get(sg);
         if (cs instanceof ColourSchemeI)
         {