Apply to all groups method added
authoramwaterhouse <Andrew Waterhouse>
Tue, 1 Feb 2005 19:04:14 +0000 (19:04 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 1 Feb 2005 19:04:14 +0000 (19:04 +0000)
src/jalview/gui/SliderPanel.java

index dee77d5..79a05de 100755 (executable)
@@ -1,10 +1,11 @@
 package jalview.gui;\r
 \r
 import jalview.jbgui.*;\r
-import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
+import jalview.datamodel.*;\r
 import java.awt.event.*;\r
 import javax.swing.event.*;\r
+import java.util.*;\r
 \r
 public class SliderPanel extends GSliderPanel\r
 {\r
@@ -49,32 +50,50 @@ public class SliderPanel extends GSliderPanel
 \r
   public void valueChanged(int i)\r
   {\r
+    ColourSchemeI toChange = null;\r
+    Vector allGroups = null;\r
+    int groupIndex = 0;\r
 \r
-    if(forConservation)\r
+    if(allGroupsCheck.isSelected())\r
     {\r
-      if (cs instanceof ConservationColourScheme)\r
-        ( (ConservationColourScheme) cs).inc = i;\r
+      allGroups = ap.av.alignment.getGroups();\r
+      groupIndex = allGroups.size()-1;\r
     }\r
     else\r
-     {\r
-       if( cs instanceof ResidueColourScheme)\r
-       {\r
-         ResidueColourScheme rcs = (ResidueColourScheme) cs;\r
-         rcs.setThreshold(i);\r
-       }\r
-       else if( cs instanceof ScoreColourScheme)\r
-       {\r
-         ScoreColourScheme scs = (ScoreColourScheme) cs;\r
-         scs.setThreshold(i);\r
-       }\r
-\r
-     }\r
+      toChange = cs;\r
+\r
+\r
+    while( groupIndex > -1 )\r
+    {\r
+      if(allGroups!=null)\r
+        toChange = ((SequenceGroup)allGroups.get(groupIndex)).cs;\r
+\r
+      if (forConservation)\r
+      {\r
+        if (toChange instanceof ConservationColourScheme)\r
+          ( (ConservationColourScheme) toChange).inc = i;\r
+      }\r
+      else\r
+      {\r
+        if (toChange.canThreshold())\r
+          ( (ResidueColourScheme) toChange).setThreshold(i);\r
+      }\r
+\r
+      groupIndex--;\r
+    }\r
+\r
 \r
     ap.seqPanel.seqCanvas.paintFlag=true;\r
     ap.seqPanel.repaint();\r
 \r
   }\r
 \r
+  public void setAllGroupsCheckEnabled(boolean b)\r
+  {\r
+    allGroupsCheck.setEnabled(b);\r
+  }\r
+\r
+\r
   public void valueField_actionPerformed(ActionEvent e)\r
   {\r
     try{\r
@@ -91,4 +110,6 @@ public class SliderPanel extends GSliderPanel
   {\r
     return Integer.parseInt(valueField.getText());\r
   }\r
+\r
+\r
 }\r