X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColourChooser.java;fp=src%2Fjalview%2Fgui%2FAnnotationColourChooser.java;h=ad013f5bb1a90478c99967c3ce79a70c6c862b24;hb=4160e6f1fa6aa45849153cce5794faa93e3a19c4;hp=e89c1c2998ecdf210b8f03b7490b5c997b9663c5;hpb=033962da90469745dd6639a1346ecbcbe2ed071f;p=jalview.git diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index e89c1c2..ad013f5 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -53,8 +53,6 @@ import net.miginfocom.swing.MigLayout; @SuppressWarnings("serial") public class AnnotationColourChooser extends AnnotationRowFilter { - private static final int ONETHOUSAND = 1000; - private ColourSchemeI oldcs; private JButton defColours; @@ -147,7 +145,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter "error.implementation_error_dont_know_about_threshold_setting")); } thresholdIsMin.setSelected(acg.isThresholdIsMinMax()); - thresholdValue.setText("" + acg.getAnnotationThreshold()); + thresholdValue + .setText(String.valueOf(acg.getAnnotationThreshold())); } jbInit(); @@ -329,7 +328,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter { updateView(); } - getCurrentAnnotation().threshold.value = slider.getValue() / 1000f; + getCurrentAnnotation().threshold.value = getSliderValue(); propagateSeqAssociatedThreshold(updateAllAnnotation, getCurrentAnnotation()); ap.paintAlignment(false, false); @@ -369,6 +368,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter thresholdValue.setEnabled(true); thresholdIsMin.setEnabled(!useOriginalColours.isSelected()); + final AlignmentAnnotation currentAnnotation = getCurrentAnnotation(); if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) { slider.setEnabled(false); @@ -377,33 +377,26 @@ public class AnnotationColourChooser extends AnnotationRowFilter thresholdIsMin.setEnabled(false); } else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD - && getCurrentAnnotation().threshold == null) + && currentAnnotation.threshold == null) { - getCurrentAnnotation().setThreshold(new GraphLine( - (getCurrentAnnotation().graphMax - - getCurrentAnnotation().graphMin) / 2f, + currentAnnotation.setThreshold(new GraphLine( + (currentAnnotation.graphMax - currentAnnotation.graphMin) + / 2f, "Threshold", Color.black)); } if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) { adjusting = true; - float range = getCurrentAnnotation().graphMax * ONETHOUSAND - - getCurrentAnnotation().graphMin * ONETHOUSAND; - - slider.setMinimum( - (int) (getCurrentAnnotation().graphMin * ONETHOUSAND)); - slider.setMaximum( - (int) (getCurrentAnnotation().graphMax * ONETHOUSAND)); - slider.setValue( - (int) (getCurrentAnnotation().threshold.value * ONETHOUSAND)); - thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); - slider.setMajorTickSpacing((int) (range / 10f)); + setSliderModel(currentAnnotation.graphMin, currentAnnotation.graphMax, + currentAnnotation.threshold.value); slider.setEnabled(true); + + setThresholdValueText(); thresholdValue.setEnabled(true); adjusting = false; } - colorAlignmentContaining(getCurrentAnnotation(), selectedThresholdItem); + colorAlignmentContaining(currentAnnotation, selectedThresholdItem); ap.alignmentChanged(); }