colour by label prototype flag
authorjprocter <Jim Procter>
Fri, 24 Jul 2009 15:26:23 +0000 (15:26 +0000)
committerjprocter <Jim Procter>
Fri, 24 Jul 2009 15:26:23 +0000 (15:26 +0000)
src/jalview/gui/FeatureColourChooser.java

index 3c618e7..fedcbc5 100644 (file)
@@ -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();
+  }
 
 }