X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColourChooser.java;h=f0887915c40ce6b8f833613767dbcf2b9d9b6f26;hp=253a7ec91e03f95ded558a175cee5378f8d91227;hb=3d0101179759ef157b088ea135423cd909512d9f;hpb=7c70cb09e9de68ab567e38520d6d09f0c17a3939 diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 253a7ec..f088791 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -110,8 +110,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter if (oldcs instanceof AnnotationColourGradient) { AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - useOriginalColours.setSelected(acg.isPredefinedColours() - || acg.getBaseColour() != null); + useOriginalColours.setSelected( + acg.isPredefinedColours() || acg.getBaseColour() != null); if (!acg.isPredefinedColours() && acg.getBaseColour() == null) { minColour.setBackground(acg.getMinColour()); @@ -120,8 +120,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter seqAssociated.setSelected(acg.isSeqAssociated()); } - Vector annotItems = getAnnotationItems(seqAssociated - .isSelected()); + Vector annotItems = getAnnotationItems( + seqAssociated.isSelected()); annotations = new JComboBox(annotItems); populateThresholdComboBox(threshold); @@ -143,9 +143,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter getThreshold().setSelectedIndex(2); break; default: - throw new Error( - MessageManager - .getString("error.implementation_error_dont_know_about_threshold_setting")); + throw new Error(MessageManager.getString( + "error.implementation_error_dont_know_about_threshold_setting")); } thresholdIsMin.setSelected(acg.isThresholdIsMinMax()); thresholdValue.setText("" + acg.getAnnotationThreshold()); @@ -212,8 +211,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter useOriginalColours.setFont(JvSwingUtils.getLabelFont()); useOriginalColours.setOpaque(false); - useOriginalColours.setText(MessageManager - .getString("label.use_original_colours")); + useOriginalColours.setText( + MessageManager.getString("label.use_original_colours")); useOriginalColours.addActionListener(new ActionListener() { @Override @@ -224,8 +223,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter }); thresholdIsMin.setBackground(Color.white); thresholdIsMin.setFont(JvSwingUtils.getLabelFont()); - thresholdIsMin.setText(MessageManager - .getString("label.threshold_minmax")); + thresholdIsMin + .setText(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.addActionListener(new ActionListener() { @Override @@ -236,8 +235,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter }); seqAssociated.setBackground(Color.white); seqAssociated.setFont(JvSwingUtils.getLabelFont()); - seqAssociated.setText(MessageManager - .getString("label.per_sequence_only")); + seqAssociated + .setText(MessageManager.getString("label.per_sequence_only")); seqAssociated.addActionListener(new ActionListener() { @@ -283,10 +282,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter private void setDefaultMinMax() { - minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", - Color.orange)); - maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", - Color.red)); + minColour.setBackground( + Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange)); + maxColour.setBackground( + Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); } public void minColour_actionPerformed() @@ -334,8 +333,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter { if (slider.isEnabled()) { - if (useOriginalColours.isSelected() - && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) + if (useOriginalColours.isSelected() && !(av + .getGlobalColourScheme() instanceof AnnotationColourGradient)) { updateView(); } @@ -368,11 +367,12 @@ public class AnnotationColourChooser extends AnnotationRowFilter return; } - setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[annotations - .getSelectedIndex()]]); + setCurrentAnnotation( + av.getAlignment().getAlignmentAnnotation()[annmap[annotations + .getSelectedIndex()]]); - int selectedThresholdItem = getSelectedThresholdItem(getThreshold() - .getSelectedIndex()); + int selectedThresholdItem = getSelectedThresholdItem( + getThreshold().getSelectedIndex()); slider.setEnabled(true); thresholdValue.setEnabled(true); @@ -388,11 +388,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD && getCurrentAnnotation().threshold == null) { - getCurrentAnnotation() - .setThreshold( - new GraphLine( - (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, - "Threshold", Color.black)); + getCurrentAnnotation().setThreshold(new GraphLine( + (getCurrentAnnotation().graphMax + - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); } if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) @@ -401,9 +400,12 @@ public class AnnotationColourChooser extends AnnotationRowFilter 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)); + 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)); slider.setEnabled(true); @@ -418,9 +420,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter ap.paintAlignment(true); } - protected boolean colorAlignmentContaining(AlignmentAnnotation currentAnn, int selectedThresholdOption) + protected boolean colorAlignmentContaining(AlignmentAnnotation currentAnn, + int selectedThresholdOption) { - + AnnotationColourGradient acg = null; if (useOriginalColours.isSelected()) { @@ -434,40 +437,40 @@ public class AnnotationColourChooser extends AnnotationRowFilter selectedThresholdOption); } acg.setSeqAssociated(seqAssociated.isSelected()); - + if (currentAnn.graphMin == 0f && currentAnn.graphMax == 0f) { acg.setPredefinedColours(true); } - + acg.setThresholdIsMinMax(thresholdIsMin.isSelected()); - + av.setGlobalColourScheme(acg); - + if (av.getAlignment().getGroups() != null) { - + for (SequenceGroup sg : ap.av.getAlignment().getGroups()) { if (sg.cs == null) { continue; } - + if (useOriginalColours.isSelected()) { - sg.setColourScheme(new AnnotationColourGradient(currentAnn, sg - .getColourScheme(), selectedThresholdOption)); - ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated - .isSelected()); + sg.setColourScheme(new AnnotationColourGradient(currentAnn, + sg.getColourScheme(), selectedThresholdOption)); + ((AnnotationColourGradient) sg.cs) + .setSeqAssociated(seqAssociated.isSelected()); } else { sg.setColourScheme(new AnnotationColourGradient(currentAnn, minColour.getBackground(), maxColour.getBackground(), selectedThresholdOption)); - ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated - .isSelected()); + ((AnnotationColourGradient) sg.cs) + .setSeqAssociated(seqAssociated.isSelected()); } } }