X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureColourChooser.java;h=d8db54657c628d40186a77e88b22efe7ca3df91c;hb=5eeb49c62b1004b1efe837a543c8ff84aa6d7faf;hp=4172819a356e3708032ca4ebbf93e8e37baaefaf;hpb=98f6651899fa88eed326ef6684b22e06e7a49c1a;p=jalview.git diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 4172819..d8db546 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -31,6 +31,8 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -117,8 +119,9 @@ public class FeatureColourChooser extends JalviewDialog this.fr = frender; this.type = theType; ap = fr.ap; - String title = MessageManager.formatMessage( - "label.graduated_color_for_params", new String[] { theType }); + String title = MessageManager + .formatMessage("label.graduated_color_for_params", new String[] + { theType }); initDialogFrame(this, true, blocking, title, 480, 185); slider.addChangeListener(new ChangeListener() @@ -144,7 +147,7 @@ public class FeatureColourChooser extends JalviewDialog */ if (ap != null) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } }); @@ -205,7 +208,8 @@ public class FeatureColourChooser extends JalviewDialog slider.setEnabled(true); slider.setValue((int) (cs.getThreshold() * scaleFactor)); thresholdValue.setEnabled(true); - threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); + threshline = new GraphLine((max - min) / 2f, "Threshold", + Color.black); threshline.value = cs.getThreshold(); } @@ -286,20 +290,28 @@ public class FeatureColourChooser extends JalviewDialog thresholdValue_actionPerformed(); } }); + thresholdValue.addFocusListener(new FocusAdapter() + { + @Override + public void focusLost(FocusEvent e) + { + thresholdValue_actionPerformed(); + } + }); slider.setPaintLabels(false); slider.setPaintTicks(true); slider.setBackground(Color.white); slider.setEnabled(false); slider.setOpaque(false); slider.setPreferredSize(new Dimension(100, 32)); - slider.setToolTipText(MessageManager - .getString("label.adjust_threshold")); + slider.setToolTipText( + MessageManager.getString("label.adjust_threshold")); thresholdValue.setEnabled(false); thresholdValue.setColumns(7); jPanel3.setBackground(Color.white); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setText(MessageManager - .getString("label.threshold_minmax")); + thresholdIsMin + .setText(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.setToolTipText(MessageManager .getString("label.toggle_absolute_relative_display_threshold")); thresholdIsMin.addActionListener(new ActionListener() @@ -313,9 +325,8 @@ public class FeatureColourChooser extends JalviewDialog colourByLabel.setBackground(Color.white); colourByLabel .setText(MessageManager.getString("label.colour_by_label")); - colourByLabel - .setToolTipText(MessageManager - .getString("label.display_features_same_type_different_label_using_different_colour")); + colourByLabel.setToolTipText(MessageManager.getString( + "label.display_features_same_type_different_label_using_different_colour")); colourByLabel.addActionListener(new ActionListener() { @Override @@ -385,9 +396,9 @@ public class FeatureColourChooser extends JalviewDialog * feature type, and repaints the alignment, and optionally the Overview * and/or structure viewer if open * - * @param updateOverview + * @param updateStructsAndOverview */ - void changeColour(boolean updateOverview) + void changeColour(boolean updateStructsAndOverview) { // Check if combobox is still adjusting if (adjusting) @@ -433,7 +444,8 @@ public class FeatureColourChooser extends JalviewDialog /* * todo not yet implemented: visual indication of feature threshold */ - threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); + threshline = new GraphLine((max - min) / 2f, "Threshold", + Color.black); } if (hasThreshold) @@ -495,7 +507,7 @@ public class FeatureColourChooser extends JalviewDialog } fr.setColour(type, acg); cs = acg; - ap.paintAlignment(updateOverview); + ap.paintAlignment(updateStructsAndOverview, updateStructsAndOverview); } @Override @@ -527,7 +539,7 @@ public class FeatureColourChooser extends JalviewDialog void reset() { fr.setColour(type, oldcs); - ap.paintAlignment(true); + ap.paintAlignment(true, true); cs = null; } @@ -553,7 +565,7 @@ public class FeatureColourChooser extends JalviewDialog /* * force repaint of any Overview window or structure */ - ap.paintAlignment(true); + ap.paintAlignment(true, true); } catch (NumberFormatException ex) { } @@ -596,8 +608,8 @@ public class FeatureColourChooser extends JalviewDialog { if (colourEditor != null) { - System.err - .println("IMPLEMENTATION ISSUE: overwriting action listener for FeatureColourChooser"); + System.err.println( + "IMPLEMENTATION ISSUE: overwriting action listener for FeatureColourChooser"); } colourEditor = graduatedColorEditor; }