JAL-1114 - refactor methods handling Vectors and Hashtables to Lists and Maps, and...
[jalview.git] / src / jalview / appletgui / TreeCanvas.java
index 9a4c82c..4c56e69 100755 (executable)
@@ -608,6 +608,9 @@ public class TreeCanvas extends Panel implements MouseListener,
 
       ColourSchemeI cs = null;
 
+      SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
+              false, 0, av.getAlignment().getWidth() - 1);
+
       if (av.getGlobalColourScheme() != null)
       {
         if (av.getGlobalColourScheme() instanceof UserColourScheme)
@@ -619,8 +622,7 @@ public class TreeCanvas extends Panel implements MouseListener,
         }
         else
         {
-          cs = ColourSchemeProperty.getColour(sequences, av.getAlignment()
-                  .getWidth(), ColourSchemeProperty.getColourName(av
+          cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty.getColourName(av
                   .getGlobalColourScheme()));
         }
         // cs is null if shading is an annotationColourGradient
@@ -630,9 +632,9 @@ public class TreeCanvas extends Panel implements MouseListener,
                   av.getIgnoreGapsConsensus());
         }
       }
-
-      SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
-              false, 0, av.getAlignment().getWidth() - 1);
+      // TODO: cs used to be initialized with a sequence collection and recalcConservation called automatically
+      // instead we set it manually - recalc called after updateAnnotation
+      sg.cs=cs;
 
       sg.setName("JTreeGroup:" + sg.hashCode());
       sg.setIdColour(col);