Merge branch 'features/JAL-2360colourSchemeApplicability' into features/JAL-2371colle...
[jalview.git] / src / jalview / gui / AnnotationRowFilter.java
index 37f1e55..166e1ad 100644 (file)
@@ -329,8 +329,8 @@ public abstract class AnnotationRowFilter extends JPanel
     }
   }
 
-  protected boolean colorAlignmContaining(
-          AlignmentAnnotation currentAnn, int selectedThresholdOption)
+  protected boolean colorAlignmContaining(AlignmentAnnotation currentAnn,
+          int selectedThresholdOption)
   {
 
     AnnotationColourGradient acg = null;
@@ -347,8 +347,7 @@ public abstract class AnnotationRowFilter extends JPanel
     }
     acg.setSeqAssociated(seqAssociated.isSelected());
 
-    if (currentAnn.graphMin == 0f
-            && currentAnn.graphMax == 0f)
+    if (currentAnn.graphMin == 0f && currentAnn.graphMax == 0f)
     {
       acg.setPredefinedColours(true);
     }
@@ -367,23 +366,20 @@ public abstract class AnnotationRowFilter extends JPanel
           continue;
         }
 
+        AnnotationColourGradient scheme = null;
         if (currentColours.isSelected())
         {
-          sg.cs = new AnnotationColourGradient(currentAnn, sg.cs,
-                  selectedThresholdOption);
-          ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
-                  .isSelected());
-
+          scheme = new AnnotationColourGradient(currentAnn,
+                  sg.getColourScheme(), selectedThresholdOption);
         }
         else
         {
-          sg.cs = new AnnotationColourGradient(currentAnn,
+          scheme = new AnnotationColourGradient(currentAnn,
                   minColour.getBackground(), maxColour.getBackground(),
                   selectedThresholdOption);
-          ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
-                  .isSelected());
         }
-
+        scheme.setSeqAssociated(seqAssociated.isSelected());
+        sg.setColourScheme(scheme);
       }
     }
     return false;