JAL-2371 CollectionColourScheme wraps ColourSchemeI
[jalview.git] / src / jalview / appletgui / TreeCanvas.java
index ca9f2d8..510df94 100755 (executable)
@@ -661,31 +661,33 @@ public class TreeCanvas extends Panel implements MouseListener,
                           .getGlobalColourScheme()));
         }
         // cs is null if shading is an annotationColourGradient
-        if (cs != null)
-        {
-          cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
-                  av.isIgnoreGapsConsensus());
-        }
+        // if (cs != null)
+        // {
+        // cs.setThreshold(av.getViewportColourScheme().getThreshold(),
+        // av.isIgnoreGapsConsensus());
+        // }
       }
       // 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.setColourScheme(cs);
+      sg.getGroupColourScheme().setThreshold(
+              av.getViewportColourScheme().getThreshold(),
+              av.isIgnoreGapsConsensus());
 
       sg.setName("JTreeGroup:" + sg.hashCode());
       sg.setIdColour(col);
       if (av.getGlobalColourScheme() != null
-              && av.getGlobalColourScheme().conservationApplied())
+              && av.getViewportColourScheme().conservationApplied())
       {
         Conservation c = new Conservation("Group", sg.getSequences(null),
                 sg.getStartRes(), sg.getEndRes());
 
         c.calculate();
         c.verdict(false, av.getConsPercGaps());
-        cs.setConservation(c);
-
-        sg.cs = cs;
 
+        sg.setColourScheme(cs);
+        sg.getGroupColourScheme().setConservation(c);
       }
 
       av.getAlignment().addGroup(sg);