X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColourChooser.java;h=477fd6a5db6d5b9f153a4966b91e657360b2b477;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=b5472141ee6f30c50dd2f5c230acaae4de6633a6;hpb=217274a8e9ea2ae20d5a6d21989b8b16840ca6f0;p=jalview.git diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index b547214..477fd6a 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; @@ -68,6 +66,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter JPanel maxColour = new JPanel(); private JCheckBox thresholdIsMin = new JCheckBox(); + private JCheckBox transparency = new JCheckBox(); protected static final int MIN_WIDTH = 500; @@ -147,7 +146,7 @@ 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(); @@ -247,6 +246,19 @@ public class AnnotationColourChooser extends AnnotationRowFilter } }); + transparency.setBackground(Color.white); + transparency.setFont(JvSwingUtils.getLabelFont()); + transparency + .setText(MessageManager.getString("Use Transparency")); + transparency.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent arg0) + { + transparency_actionPerformed(); + } + }); this.setLayout(new BorderLayout()); JPanel jPanel1 = new JPanel(); JPanel jPanel2 = new JPanel(); @@ -259,6 +271,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter jPanel2.add(annotations, "grow, wrap"); jPanel2.add(seqAssociated); jPanel2.add(useOriginalColours); + jPanel2.add(transparency); JPanel colpanel = new JPanel(new FlowLayout()); colpanel.setBackground(Color.white); colpanel.add(minColour); @@ -274,6 +287,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter this.validate(); } + protected void transparency_actionPerformed() + { + updateView(); + } protected void resetColours_actionPerformed() { setDefaultMinMax(); @@ -301,14 +318,14 @@ public class AnnotationColourChooser extends AnnotationRowFilter updateView(); } }; - JalviewColourChooser.showColourChooser(Desktop.getDesktop(), ttl, + JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(), ttl, colourPanel.getBackground(), listener); } @Override public void reset() { - av.setGlobalColourScheme(oldcs); + this.ap.alignFrame.changeColour(oldcs); if (av.getAlignment().getGroups() != null) { @@ -329,7 +346,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 +386,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 +395,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(); } @@ -433,7 +444,9 @@ public class AnnotationColourChooser extends AnnotationRowFilter acg.setThresholdIsMinMax(thresholdIsMin.isSelected()); - av.setGlobalColourScheme(acg); + acg.setPositionToTransparency(transparency.isSelected()); + + this.ap.alignFrame.changeColour(acg); if (av.getAlignment().getGroups() != null) { @@ -444,8 +457,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter { continue; } - sg.setColourScheme( - acg.getInstance(sg, ap.av.getHiddenRepSequences())); + sg.setColourScheme(acg.getInstance(av, sg)); } } } @@ -456,5 +468,4 @@ public class AnnotationColourChooser extends AnnotationRowFilter super.sliderDragReleased(); ap.paintAlignment(true, true); } - }