From 11b2e9b16c3bb93d8788c2bc5d5654f6163402e6 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 9 Jun 2017 13:18:00 +0100 Subject: [PATCH] JAL-2592 distinguish "User Defined" (scheme name) from "User Defined..." menu item id --- src/jalview/gui/AlignFrame.java | 2 +- src/jalview/gui/ColourMenuHelper.java | 6 +++--- src/jalview/schemes/ResidueColourScheme.java | 8 ++++++++ src/jalview/schemes/UserColourScheme.java | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index a9a970f..060d7b1 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3344,7 +3344,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * 'User Defined' opens a panel to configure or load a * user-defined colour scheme */ - if (ResidueColourScheme.USER_DEFINED.equals(name)) + if (ResidueColourScheme.USER_DEFINED_MENU.equals(name)) { new UserDefinedColours(alignPanel); return; diff --git a/src/jalview/gui/ColourMenuHelper.java b/src/jalview/gui/ColourMenuHelper.java index b2b9574..8ffc070 100644 --- a/src/jalview/gui/ColourMenuHelper.java +++ b/src/jalview/gui/ColourMenuHelper.java @@ -177,13 +177,13 @@ public class ColourMenuHelper final String label = MessageManager.getString("action.user_defined"); JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem( label); - userDefinedColour.setName(ResidueColourScheme.USER_DEFINED); + userDefinedColour.setName(ResidueColourScheme.USER_DEFINED_MENU); userDefinedColour.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - client.changeColour_actionPerformed(ResidueColourScheme.USER_DEFINED); + client.changeColour_actionPerformed(ResidueColourScheme.USER_DEFINED_MENU); } }); colourMenu.add(userDefinedColour); @@ -230,7 +230,7 @@ public class ColourMenuHelper { none = radioButton; } - if (ResidueColourScheme.USER_DEFINED.equals(buttonName)) + if (ResidueColourScheme.USER_DEFINED_MENU.equals(buttonName)) { userDefined = radioButton; } diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index b47b82e..6aa798e 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -35,9 +35,17 @@ public abstract class ResidueColourScheme implements ColourSchemeI { public static final String NONE = "None"; + /* + * default display name for a user defined colour scheme + */ public static final String USER_DEFINED = "User Defined"; /* + * name for (new) "User Defined.." colour scheme menu item + */ + public static final String USER_DEFINED_MENU = "*User Defined*"; + + /* * lookup up by character value e.g. 'G' to the colors array index * e.g. if symbolIndex['K'] = 11 then colors[11] is the colour for K */ diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index 8e58c20..256862d 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -273,7 +273,7 @@ public class UserColourScheme extends ResidueColourScheme { return schemeName; } - return "User Defined"; + return ResidueColourScheme.USER_DEFINED; } /** -- 1.7.10.2