From: gmungoc Date: Tue, 14 Feb 2017 14:12:39 +0000 (+0000) Subject: JAL-2346 disable 'threshold min/max' when 'use original colours' X-Git-Tag: Release_2_10_3b1~336^2~2^2~1^2~2^2~4 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=3ebdd4e28382e38a181aae1eed71549f603f9025 JAL-2346 disable 'threshold min/max' when 'use original colours' selected --- diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 33f7ad0..8500888 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -61,7 +61,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter private Hashtable oldgroupColours; - private JCheckBox currentColours = new JCheckBox(); + private JCheckBox useOriginalColours = new JCheckBox(); private JPanel minColour = new JPanel(); @@ -106,7 +106,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter if (oldcs instanceof AnnotationColourGradient) { AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - currentColours.setSelected(acg.isPredefinedColours() + useOriginalColours.setSelected(acg.isPredefinedColours() || acg.getBaseColour() != null); if (!acg.isPredefinedColours() && acg.getBaseColour() == null) { @@ -206,16 +206,16 @@ public class AnnotationColourChooser extends AnnotationRowFilter } }); - currentColours.setFont(JvSwingUtils.getLabelFont()); - currentColours.setOpaque(false); - currentColours.setText(MessageManager + useOriginalColours.setFont(JvSwingUtils.getLabelFont()); + useOriginalColours.setOpaque(false); + useOriginalColours.setText(MessageManager .getString("label.use_original_colours")); - currentColours.addActionListener(new ActionListener() + useOriginalColours.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - currentColours_actionPerformed(); + originalColours_actionPerformed(); } }); thresholdIsMin.setBackground(Color.white); @@ -255,7 +255,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter jPanel1.add(cancel); jPanel2.add(annotations, "grow, wrap"); jPanel2.add(seqAssociated); - jPanel2.add(currentColours); + jPanel2.add(useOriginalColours); JPanel colpanel = new JPanel(new FlowLayout()); colpanel.setBackground(Color.white); colpanel.add(minColour); @@ -330,7 +330,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter { if (slider.isEnabled()) { - if (currentColours.isSelected() + if (useOriginalColours.isSelected() && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) { updateView(); @@ -342,14 +342,16 @@ public class AnnotationColourChooser extends AnnotationRowFilter } } - public void currentColours_actionPerformed() + public void originalColours_actionPerformed() { - if (currentColours.isSelected()) + boolean selected = useOriginalColours.isSelected(); + if (selected) { reset(); } - maxColour.setEnabled(!currentColours.isSelected()); - minColour.setEnabled(!currentColours.isSelected()); + maxColour.setEnabled(!selected); + minColour.setEnabled(!selected); + thresholdIsMin.setEnabled(!selected); updateView(); } @@ -370,7 +372,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter slider.setEnabled(true); thresholdValue.setEnabled(true); - thresholdIsMin.setEnabled(true); + thresholdIsMin.setEnabled(!useOriginalColours.isSelected()); if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) { @@ -416,7 +418,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter { AnnotationColourGradient acg = null; - if (currentColours.isSelected()) + if (useOriginalColours.isSelected()) { acg = new AnnotationColourGradient(currentAnn, av.getGlobalColourScheme(), selectedThresholdOption); @@ -448,7 +450,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter continue; } - if (currentColours.isSelected()) + if (useOriginalColours.isSelected()) { sg.setColourScheme(new AnnotationColourGradient(currentAnn, sg .getColourScheme(), selectedThresholdOption));