oldcs = fr.featureColours.get(type);
if (oldcs instanceof GraduatedColor)
{
- cs = new GraduatedColor((GraduatedColor) oldcs, min, max);
+ if (((GraduatedColor)oldcs).isAutoScale())
+ {
+ // update the scale
+ cs = new GraduatedColor((GraduatedColor) oldcs, min, max);
+ } else {
+ cs = new GraduatedColor((GraduatedColor) oldcs);
+ }
} else {
// promote original color to a graduated color
Color bl = Color.black;
} catch (Exception ex)
{
}
+ // update the gui from threshold state
+ thresholdIsMin.setSelected(!cs.isAutoScale());
+ if (cs.getThreshType()!=AnnotationColourGradient.NO_THRESHOLD)
+ {
+ // initialise threshold slider and selector
+ threshold.setSelectedIndex(cs.getThreshType()==AnnotationColourGradient.ABOVE_THRESHOLD ? 1 : 2);
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+ threshline = new jalview.datamodel.GraphLine(
+ (max - min) / 2f,
+ "Threshold", Color.black);
+
+ }
adjusting = false;
threshold_actionPerformed(e);
}
});
- threshold.addItem("No Threshold");
- threshold.addItem("Above Threshold");
- threshold.addItem("Below Threshold");
+ threshold.addItem("No Threshold"); // index 0
+ threshold.addItem("Above Threshold"); // index 1
+ threshold.addItem("Below Threshold"); // index 2
jPanel3.setLayout(flowLayout2);
thresholdValue.addActionListener(new ActionListener()
{
acg.setThreshType(aboveThreshold);
if (thresholdIsMin.isSelected() && aboveThreshold != AnnotationColourGradient.NO_THRESHOLD)
{
+ acg.setAutoScaled(false);
if (aboveThreshold==AnnotationColourGradient.ABOVE_THRESHOLD)
{
acg = new GraduatedColor(acg, threshline.value, max);
} else {
acg = new GraduatedColor(acg, min,threshline.value);
}
+ } else {
+ acg.setAutoScaled(true);
}
fr.featureColours.put(type,acg);