JAL-2314 Tidy up
[jalview.git] / src / jalview / gui / AnnotationRowFilter.java
index 37f1e55..7705bc3 100644 (file)
@@ -26,6 +26,8 @@ import jalview.datamodel.SequenceGroup;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.util.MessageManager;
 
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.util.Vector;
@@ -134,6 +136,14 @@ public abstract class AnnotationRowFilter extends JPanel
   {
     this.av = av;
     this.ap = ap;
+    thresholdValue.addFocusListener(new FocusAdapter()
+    {
+      @Override
+      public void focusLost(FocusEvent e)
+      {
+        thresholdValue_actionPerformed();
+      }
+    });
   }
 
   public AnnotationRowFilter()
@@ -329,8 +339,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 +357,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 +376,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;