JAL-2385 more tests/bug fixes mostly for gui.SliderPanel and some
[jalview.git] / src / jalview / appletgui / SliderPanel.java
index 1beb82b..9154aa0 100644 (file)
@@ -21,7 +21,7 @@
 package jalview.appletgui;
 
 import jalview.datamodel.SequenceGroup;
-import jalview.schemes.CollectionColourSchemeI;
+import jalview.renderer.ResidueShaderI;
 import jalview.util.MessageManager;
 
 import java.awt.BorderLayout;
@@ -49,18 +49,20 @@ import java.util.Iterator;
 public class SliderPanel extends Panel implements ActionListener,
         AdjustmentListener, MouseListener
 {
+  private static final String BACKGROUND = "Background";
+
   AlignmentPanel ap;
 
   boolean forConservation = true;
 
-  CollectionColourSchemeI cs;
+  ResidueShaderI cs;
 
   static Frame conservationSlider;
 
   static Frame PIDSlider;
 
   public static int setConservationSlider(AlignmentPanel ap,
-          CollectionColourSchemeI ccs, String source)
+          ResidueShaderI ccs, String source)
   {
     SliderPanel sp = null;
 
@@ -77,10 +79,9 @@ public class SliderPanel extends Panel implements ActionListener,
       sp.valueField.setText(String.valueOf(ccs.getConservationInc()));
     }
 
-    conservationSlider
-            .setTitle(MessageManager.formatMessage(
-                    "label.conservation_colour_increment",
-                    new String[] { source }));
+    conservationSlider.setTitle(MessageManager.formatMessage(
+            "label.conservation_colour_increment",
+            new String[] { source == null ? BACKGROUND : source }));
     if (ap.av.getAlignment().getGroups() != null)
     {
       sp.setAllGroupsCheckEnabled(true);
@@ -121,7 +122,7 @@ public class SliderPanel extends Panel implements ActionListener,
   }
 
   public static int setPIDSliderSource(AlignmentPanel ap,
-          CollectionColourSchemeI ccs, String source)
+          ResidueShaderI ccs, String source)
   {
     SliderPanel pid = null;
     if (PIDSlider == null)
@@ -136,10 +137,9 @@ public class SliderPanel extends Panel implements ActionListener,
       pid.cs = ccs;
       pid.valueField.setText(String.valueOf(ccs.getThreshold()));
     }
-    PIDSlider
-            .setTitle(MessageManager.formatMessage(
-                    "label.percentage_identity_threshold",
-                    new String[] { source }));
+    PIDSlider.setTitle(MessageManager.formatMessage(
+            "label.percentage_identity_threshold",
+            new String[] { source == null ? BACKGROUND : source }));
 
     if (ap.av.getAlignment().getGroups() != null)
     {
@@ -204,7 +204,7 @@ public class SliderPanel extends Panel implements ActionListener,
     }
   }
   public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,
-          CollectionColourSchemeI collectionColourSchemeI)
+          ResidueShaderI shader)
   {
     try
     {
@@ -214,7 +214,7 @@ public class SliderPanel extends Panel implements ActionListener,
       e.printStackTrace();
     }
     this.ap = ap;
-    this.cs = collectionColourSchemeI;
+    this.cs = shader;
     forConservation = forConserve;
     undoButton.setVisible(false);
     applyButton.setVisible(false);
@@ -249,7 +249,7 @@ public class SliderPanel extends Panel implements ActionListener,
       return;
     }
 
-    CollectionColourSchemeI toChange = cs;
+    ResidueShaderI toChange = cs;
     Iterator<SequenceGroup> allGroups = null;
 
     if (allGroupsCheck.getState())