+ // Check if combobox is still adjusting\r
+ if (adjusting)\r
+ return;\r
+\r
+ // We removed the non-graph annotations when filling the combobox\r
+ // so allow for them again here\r
+ int nograph = 0, graph = -1;\r
+ for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)\r
+ {\r
+ if (av.alignment.getAlignmentAnnotation()[i].graph == 0)\r
+ nograph++;\r
+ else\r
+ graph++;\r
+\r
+ if (graph == annotations.getSelectedIndex())\r
+ break;\r
+ }\r
+\r
+ currentAnnotation = av.alignment.getAlignmentAnnotation()[graph + nograph];\r
+\r
+ int aboveThreshold = -1;\r
+ if (threshold.getSelectedItem().equals("Above Threshold"))\r
+ aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;\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
+ slider.setEnabled(false);\r
+ thresholdValue.setEnabled(false);\r
+ thresholdValue.setText("");\r
+ }\r
+ else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD &&\r
+ currentAnnotation.threshold == null)\r
+ {\r
+ currentAnnotation.setThreshold(new jalview.datamodel.GraphLine\r
+ ( (currentAnnotation.graphMax -\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.setMinimum( (int) (currentAnnotation.graphMin * 1000));\r
+ slider.setMaximum( (int) (currentAnnotation.graphMax * 1000));\r
+ slider.setValue( (int) (currentAnnotation.threshold.value * 1000));\r
+ thresholdValue.setText(currentAnnotation.threshold.value + "");\r
+ slider.setMajorTickSpacing( (int) (range / 10f));\r
+ slider.setEnabled(true);\r
+ thresholdValue.setEnabled(true);\r
+ adjusting = false;\r
+ }\r
+\r
+ AnnotationColourGradient acg = null;\r
+ if (currentColours.isSelected())\r
+ acg = new AnnotationColourGradient(\r
+ currentAnnotation,\r
+ av.getGlobalColourScheme(), aboveThreshold);\r
+ else\r
+ acg =\r
+ new AnnotationColourGradient(\r
+ currentAnnotation,\r
+ minColour.getBackground(),\r
+ maxColour.getBackground(),\r
+ aboveThreshold);\r