colour by label prototype flag
[jalview.git] / src / jalview / gui / FeatureColourChooser.java
index 55865db..fedcbc5 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -103,6 +103,7 @@ public class FeatureColourChooser extends JPanel
       }
       // original colour becomes the maximum colour
       cs = new GraduatedColor(Color.white,bl,mm[0],mm[1]);
+      cs.setColourByLabel(false);
     }
     minColour.setBackground(cs.getMinColor());
     maxColour.setBackground(cs.getMaxColor());
@@ -116,6 +117,7 @@ public class FeatureColourChooser extends JPanel
     }
     // update the gui from threshold state
     thresholdIsMin.setSelected(!cs.isAutoScale());
+    colourByLabel.setSelected(cs.isColourByLabel());
     if (cs.getThreshType()!=AnnotationColourGradient.NO_THRESHOLD)
     {
       // initialise threshold slider and selector
@@ -243,6 +245,15 @@ public class FeatureColourChooser extends JPanel
         thresholdIsMin_actionPerformed(actionEvent);
       }
     });
+    colourByLabel.setBackground(Color.white);
+    colourByLabel.setText("Colour by Label");
+    colourByLabel.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent actionEvent)
+      {
+        colourByLabel_actionPerformed(actionEvent);
+      }
+    });
     jPanel1.add(ok);
     jPanel1.add(cancel);
     // jPanel2.add(currentColours);
@@ -253,6 +264,7 @@ public class FeatureColourChooser extends JPanel
     jPanel3.add(slider);
     jPanel3.add(thresholdValue);
     jPanel3.add(thresholdIsMin);
+    jPanel3.add(colourByLabel);
     this.add(jPanel1, java.awt.BorderLayout.SOUTH);
     this.add(jPanel2, java.awt.BorderLayout.NORTH);
   }
@@ -287,6 +299,7 @@ public class FeatureColourChooser extends JPanel
   JCheckBox currentColours = new JCheckBox();
 
   JCheckBox thresholdIsMin = new JCheckBox();
+  JCheckBox colourByLabel = new JCheckBox();
 
   private GraphLine threshline;
 
@@ -383,7 +396,7 @@ public class FeatureColourChooser extends JPanel
     } else {
       acg.setAutoScaled(true);
     }
-    
+    acg.setColourByLabel(colourByLabel.isSelected());
     fr.featureColours.put(type,acg);
     cs = acg;
     ap.paintAlignment(false);
@@ -468,5 +481,9 @@ public class FeatureColourChooser extends JPanel
   {
     changeColour();
   }
+  public void colourByLabel_actionPerformed(ActionEvent actionEvent)
+  {
+    changeColour();
+  }
 
 }