X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureSettings.java;h=bb15b555dacd223d777855ed697ce054af4f3418;hb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;hp=b49593a1697a2842b036a8a55d02a6a02c3cc905;hpb=006890b02106eb31841e6e84d75f1027434823e0;p=jalview.git diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index b49593a..bb15b55 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -150,7 +152,7 @@ public class FeatureSettings extends JPanel */ Object[][] originalData; - float originalTransparency; + private float originalTransparency; private ViewStyleI originalViewStyle; @@ -182,7 +184,7 @@ public class FeatureSettings extends JPanel /* * true when Feature Settings are updating from feature renderer */ - boolean handlingUpdate = false; + private boolean handlingUpdate = false; /* * a change listener to ensure the dialog is updated if @@ -215,6 +217,7 @@ public class FeatureSettings extends JPanel transparency.setValue(100 - transparencyAsPercent); inConstruction = incon; } + /** * Constructor * @@ -455,8 +458,8 @@ public class FeatureSettings extends JPanel }); frame.setLayer(JLayeredPane.PALETTE_LAYER); } - inConstruction = false; - } + inConstruction = false; + } /** * Sets the state of buttons to show complement features from viewport @@ -482,95 +485,21 @@ public class FeatureSettings extends JPanel change = null; } - /** - * Constructs and shows a popup menu of possible actions on the selected row and - * feature type - * - * @param rowSelected - * @param type - * @param typeCol - * @param pt - */ - protected void showPopupMenu(final int rowSelected, final String type, final Object typeCol, final Point pt) + /** + * Constructs and shows a popup menu of possible actions on the selected row + * and feature type + * + * @param rowSelected + * @param type + * @param typeCol + * @param pt + */ + protected void showPopupMenu(final int rowSelected, final String type, + final Object typeCol, final Point pt) { JPopupMenu men = new JPopupMenu(MessageManager .formatMessage("label.settings_for_param", new String[] { type })); - final FeatureColourI featureColour = (FeatureColourI) typeCol; - - /* - * menu option to select (or deselect) variable colour - */ - final JCheckBoxMenuItem variableColourCB = new JCheckBoxMenuItem( - MessageManager.getString("label.variable_colour")); - variableColourCB.setSelected(!featureColour.isSimpleColour()); - men.add(variableColourCB); - - /* - * checkbox action listener doubles up as listener to OK - * from the variable colour / filters dialog - */ - variableColourCB.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - if (e.getSource() == variableColourCB) - { - // BH 2018 for JavaScript because this is a checkbox - men.setVisible(true); - men.setVisible(false); - if (featureColour.isSimpleColour()) - { - /* - * toggle simple colour to variable colour - show dialog - */ - FeatureTypeSettings fc = new FeatureTypeSettings(fr, type); - fc.addActionListener(this); - } - else - { - /* - * toggle variable to simple colour - show colour chooser - */ - String title = MessageManager - .formatMessage("label.select_colour_for", type); - ColourChooserListener listener = new ColourChooserListener() - { - @Override - public void colourSelected(Color c) - { - table.setValueAt(new FeatureColour(c), rowSelected, - COLOUR_COLUMN); - table.validate(); - updateFeatureRenderer( - ((FeatureTableModel) table.getModel()).getData(), - false); - } - }; - JalviewColourChooser.showColourChooser(FeatureSettings.this, - title, featureColour.getMaxColour(), listener); - } - } - else - { - if (e.getSource() instanceof FeatureTypeSettings) - { - /* - * update after OK in feature colour dialog; the updated - * colour will have already been set in the FeatureRenderer - */ - FeatureColourI fci = fr.getFeatureColours().get(type); - table.setValueAt(fci, rowSelected, COLOUR_COLUMN); - // BH 2018 setting a table value does not invalidate it. - // System.out.println("FeatureSettings is valied" + - // table.validate(); - } - } - } - }); - - men.addSeparator(); JMenuItem scr = new JMenuItem( MessageManager.getString("label.sort_by_score")); @@ -1274,8 +1203,8 @@ public class FeatureSettings extends JPanel } /** - * close ourselves but leave any existing UI handlers (e.g a CDS/Protein tabbed - * feature settings dialog) intact + * close ourselves but leave any existing UI handlers (e.g a CDS/Protein + * tabbed feature settings dialog) intact */ public void closeOldSettings() { @@ -1391,7 +1320,8 @@ public class FeatureSettings extends JPanel } }); - final String byScoreLabel = MessageManager.getString("label.seq_sort_by_score"); + final String byScoreLabel = MessageManager + .getString("label.seq_sort_by_score"); JButton sortByScore = new JButton(byScoreLabel); sortByScore.setFont(JvSwingUtils.getLabelFont()); sortByScore.addActionListener(new ActionListener() @@ -1405,7 +1335,8 @@ public class FeatureSettings extends JPanel } } }); - final String byDensityLabel = MessageManager.getString("label.sequence_sort_by_density"); + final String byDensityLabel = MessageManager + .getString("label.sequence_sort_by_density"); JButton sortByDens = new JButton(byDensityLabel); sortByDens.setFont(JvSwingUtils.getLabelFont()); sortByDens.addActionListener(new ActionListener() @@ -1436,7 +1367,8 @@ public class FeatureSettings extends JPanel } } }); - // Cancel for a SplitFrame should just revert changes to the currently displayed + // Cancel for a SplitFrame should just revert changes to the currently + // displayed // settings. May want to do this for either or both - so need a splitview // feature settings cancel/OK. JButton cancel = new JButton(MessageManager @@ -1526,11 +1458,12 @@ public class FeatureSettings extends JPanel MessageManager.getString("label.transparency_tip")); boolean nucleotide = af.getViewport().getAlignment().isNucleotide(); - String text = MessageManager.formatMessage("label.show_linked_features", - nucleotide - ? MessageManager.getString("label.protein") - .toLowerCase() - : "CDS"); + String text = MessageManager + .formatMessage("label.show_linked_features", + nucleotide + ? MessageManager.getString("label.protein") + .toLowerCase(Locale.ROOT) + : "CDS"); showComplement = new JCheckBox(text); showComplement.addActionListener(new ActionListener() { @@ -1614,7 +1547,7 @@ public class FeatureSettings extends JPanel * * @param fcol * @param withHint - * if true include 'click to edit' and similar text + * if true include 'click to edit' and similar text * @return */ public static String getColorTooltip(FeatureColourI fcol,