From: gmungoc Date: Mon, 3 Dec 2018 11:30:09 +0000 (+0000) Subject: JAL-3168 include feature type in colour chooser dialog title X-Git-Tag: Release_2_11_4_0~45^2~18^2~361^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2bd87d696f010a6364fca99c3137d6a06b9af23b;p=jalview.git JAL-3168 include feature type in colour chooser dialog title --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 16c897e..b29edec 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1335,7 +1335,7 @@ label.join_conditions = Join conditions with label.score = Score label.colour_by_label = Colour by label label.variable_colour = Variable colour... -label.select_colour = Select colour +label.select_colour_for = Select colour for {0} option.enable_disable_autosearch = When ticked, search is performed automatically option.autosearch = Autosearch label.retrieve_ids = Retrieve IDs diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 2ea7a72..d1b763d 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1336,7 +1336,7 @@ label.join_conditions = Combinar condiciones con label.score = Puntuación label.colour_by_label = Colorear por texto label.variable_colour = Color variable... -label.select_colour = Seleccionar color +label.select_colour_for = Seleccionar color para {0} option.enable_disable_autosearch = Marcar para buscar automáticamente option.autosearch = Auto búsqueda label.retrieve_ids = Recuperar IDs diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index b82cf86..6a59e19 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -293,8 +293,7 @@ public class FeatureSettings extends JPanel if (evt.isPopupTrigger()) { Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN); - popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(), - evt.getY()); + showPopupMenu(selectedRow, type, colour, evt.getPoint()); } else if (evt.getClickCount() == 2) { @@ -315,8 +314,7 @@ public class FeatureSettings extends JPanel { String type = (String) table.getValueAt(selectedRow, TYPE_COLUMN); Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN); - popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(), - evt.getY()); + showPopupMenu(selectedRow, type, colour, evt.getPoint()); } } }); @@ -407,9 +405,17 @@ public class FeatureSettings extends JPanel inConstruction = false; } - protected void popupSort(final int rowSelected, final String type, - final Object typeCol, final Map minmax, int x, - int y) + /** + * 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) { final FeatureColourI featureColour = (FeatureColourI) typeCol; @@ -430,7 +436,6 @@ public class FeatureSettings extends JPanel .sortAlignmentByFeatureScore(Arrays.asList(new String[] { type })); } - }); JMenuItem dens = new JMenuItem( MessageManager.getString("label.sort_by_density")); @@ -444,7 +449,6 @@ public class FeatureSettings extends JPanel .sortAlignmentByFeatureDensity(Arrays.asList(new String[] { type })); } - }); men.add(dens); @@ -481,7 +485,7 @@ public class FeatureSettings extends JPanel /* * toggle variable to simple colour - show colour chooser */ - String title = MessageManager.getString("label.select_colour"); + String title = MessageManager.formatMessage("label.select_colour_for", type); ColourChooserListener listener = new ColourChooserListener() { @Override @@ -498,7 +502,8 @@ public class FeatureSettings extends JPanel JalviewColourChooser.showColourChooser(me, title, featureColour.getMaxColour(), listener); } } - else { + else + { if (e.getSource() instanceof FeatureTypeSettings) { /* @@ -511,7 +516,6 @@ public class FeatureSettings extends JPanel } } } - }); JMenuItem selCols = new JMenuItem( @@ -560,7 +564,7 @@ public class FeatureSettings extends JPanel men.add(clearCols); men.add(hideCols); men.add(hideOtherCols); - men.show(table, x, y); + men.show(table, pt.x, pt.y); } @Override @@ -1738,7 +1742,7 @@ public class FeatureSettings extends JPanel /* * simple colour chooser */ - String ttl = MessageManager.getString("label.select_colour"); + String ttl = MessageManager.formatMessage("label.select_colour_for", type); ColourChooserListener listener = new ColourChooserListener() { @Override diff --git a/src/jalview/gui/FeatureTypeSettings.java b/src/jalview/gui/FeatureTypeSettings.java index dac6bff..f59aa59 100644 --- a/src/jalview/gui/FeatureTypeSettings.java +++ b/src/jalview/gui/FeatureTypeSettings.java @@ -112,7 +112,7 @@ public class FeatureTypeSettings extends JalviewDialog */ final AlignmentViewPanel ap; - private final String featureType; + final String featureType; /* * the colour and filters to reset to on Cancel @@ -536,7 +536,8 @@ public class FeatureTypeSettings extends JalviewDialog { if (minColour.isEnabled()) { - showColourChooser(minColour, "label.select_colour_minimum_value"); + String ttl = MessageManager.getString("label.select_colour_minimum_value"); + showColourChooser(minColour, ttl); } } }); @@ -552,7 +553,8 @@ public class FeatureTypeSettings extends JalviewDialog { if (maxColour.isEnabled()) { - showColourChooser(maxColour, "label.select_colour_maximum_value"); + String ttl = MessageManager.getString("label.select_colour_maximum_value"); + showColourChooser(maxColour, ttl); } } }); @@ -760,7 +762,8 @@ public class FeatureTypeSettings extends JalviewDialog { if (simpleColour.isSelected()) { - showColourChooser(singleColour, "label.select_colour"); + String ttl = MessageManager.formatMessage("label.select_colour_for", featureType); + showColourChooser(singleColour, ttl); } } }); @@ -828,10 +831,9 @@ public class FeatureTypeSettings extends JalviewDialog * * @param colourPanel * the panel whose background colour is being picked - * @param key - * message bundle key for the dialog title + * @param title */ - void showColourChooser(JPanel colourPanel, String key) + void showColourChooser(JPanel colourPanel, String title) { ColourChooserListener listener = new ColourChooserListener() { @@ -844,9 +846,8 @@ public class FeatureTypeSettings extends JalviewDialog colourChanged(true); } }; - JalviewColourChooser.showColourChooser(this, - MessageManager.getString(key), colourPanel.getBackground(), - listener); + JalviewColourChooser.showColourChooser(this, title, + colourPanel.getBackground(), listener); } /**