ColourSchemeI oldcs;\r
Hashtable oldgroupColours;\r
jalview.datamodel.AlignmentAnnotation currentAnnotation;\r
+ boolean adjusting = false;\r
\r
public AnnotationColourChooser(AlignViewport av, AlignmentPanel ap)\r
{\r
frame = new JInternalFrame();\r
frame.setContentPane(this);\r
frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
- Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145, false);\r
+ Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145);\r
\r
try\r
{\r
{\r
public void stateChanged(ChangeEvent evt)\r
{\r
- thresholdValue.setText( ( (float) slider.getValue() / 1000f) + "");\r
- valueChanged();\r
+ if(!adjusting)\r
+ {\r
+ thresholdValue.setText( ( (float) slider.getValue() / 1000f) + "");\r
+ valueChanged();\r
+ }\r
}\r
});\r
\r
maxColour.setBackground(Color.red);\r
}\r
\r
+ adjusting = true;\r
for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)\r
{\r
if (av.alignment.getAlignmentAnnotation()[i].graph > 0)\r
threshold.addItem("Above Threshold");\r
threshold.addItem("Below Threshold");\r
\r
+ adjusting = false;\r
+\r
+ changeColour();\r
+\r
}\r
\r
public AnnotationColourChooser()\r
thresholdValue_actionPerformed(e);\r
}\r
});\r
+ slider.setPaintLabels(false);\r
slider.setPaintTicks(true);\r
slider.setBackground(Color.white);\r
slider.setEnabled(false);\r
slider.setOpaque(false);\r
+ slider.setPreferredSize(new Dimension(150, 32));\r
thresholdValue.setEnabled(false);\r
thresholdValue.setColumns(10);\r
jPanel3.setBackground(Color.white);\r
void changeColour()\r
{\r
// Check if combobox is still adjusting\r
- if (threshold.getSelectedIndex() == -1)\r
+ if (adjusting)\r
return;\r
\r
// We removed the non-graph annotations when filling the combobox\r
else if (threshold.getSelectedItem().equals("Below Threshold"))\r
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;\r
\r
+ slider.setEnabled(true);\r
+ thresholdValue.setEnabled(true);\r
+\r
if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD)\r
{\r
- currentAnnotation.threshold = null;\r
slider.setEnabled(false);\r
thresholdValue.setEnabled(false);\r
thresholdValue.setText("");\r
currentAnnotation.graphMin) / 2f,\r
"Threshold",\r
Color.black));\r
+ }\r
+\r
+ if(aboveThreshold != AnnotationColourGradient.NO_THRESHOLD)\r
+ {\r
+ adjusting = true;\r
float range = currentAnnotation.graphMax * 1000 -\r
currentAnnotation.graphMin * 1000;\r
\r
slider.setMinorTickSpacing( (int) (range / 100f));\r
slider.setEnabled(true);\r
thresholdValue.setEnabled(true);\r
+ adjusting = false;\r
}\r
\r
AnnotationColourGradient acg = null;\r
\r
public void annotations_actionPerformed(ActionEvent e)\r
{\r
- if(currentAnnotation!=null)\r
- currentAnnotation.threshold = null;\r
changeColour();\r
}\r
\r
\r
public void valueChanged()\r
{\r
+ if (currentColours.isSelected()\r
+ && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient))\r
+ {\r
+ changeColour();\r
+ }\r
+\r
currentAnnotation.threshold.value = (float)slider.getValue()/1000f;\r
ap.repaint();\r
}\r