From 07ec13fe154f1cacb8faf90a980c2165ae07b244 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 24 Mar 2006 15:26:37 +0000 Subject: [PATCH] Called from AnnotationColourChooser and Feature Settings --- src/jalview/appletgui/UserDefinedColours.java | 55 ++++++++++++++++++------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 6544993..eb454d7 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -38,9 +38,10 @@ public class UserDefinedColours ColourSchemeI oldColourScheme; Frame frame; MCview.AppletPDBCanvas pdbcanvas; - FeatureSettings featureSettings; - String feature; - Color originalFeatureCol; + + Component caller; + String originalLabel; + Color originalColour; int R = 0, G = 0, B = 0; @@ -73,19 +74,20 @@ public class UserDefinedColours init(); } - public UserDefinedColours(FeatureSettings featureSettings, - String feature, - Color col) + public UserDefinedColours(Component caller, + String label, + Color colour) { - this.featureSettings = featureSettings; - this.feature = feature; + this.caller = caller; + originalColour = colour; + originalLabel = label; init(); remove(buttonPanel); - originalFeatureCol = col; - setTargetColour(col); + + setTargetColour(colour); okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35)); - frame.setTitle("User Defined Colours - "+feature); + frame.setTitle("User Defined Colours - "+label); frame.setSize(420, 200); } @@ -275,12 +277,24 @@ public class UserDefinedColours protected void applyButton_actionPerformed() { - if (featureSettings != null) + if (caller != null) { - featureSettings.setUserColour(feature, new Color(R,G,B)); + if(caller instanceof FeatureSettings) + ((FeatureSettings)caller).setUserColour + (originalLabel, new Color(R,G,B)); + else if(caller instanceof AnnotationColourChooser) + { + if (originalLabel.equals("Min Colour")) + ( (AnnotationColourChooser) caller).minColour_actionPerformed + (new Color(R, G, B)); + else + ( (AnnotationColourChooser) caller).maxColour_actionPerformed + (new Color(R, G, B)); + } return; } + Color[] newColours = new Color[24]; for (int i = 0; i < 24; i++) { @@ -315,9 +329,20 @@ public class UserDefinedColours protected void cancelButton_actionPerformed() { - if(featureSettings!=null) + if (caller != null) { - featureSettings.setUserColour(feature, originalFeatureCol); + if(caller instanceof FeatureSettings) + ((FeatureSettings)caller).setUserColour + (originalLabel, originalColour); + else if (caller instanceof AnnotationColourChooser) + { + if (originalLabel.equals("Min Colour")) + ( (AnnotationColourChooser) caller).minColour_actionPerformed + (originalColour); + else + ( (AnnotationColourChooser) caller).maxColour_actionPerformed + (originalColour); + } frame.setVisible(false); return; } -- 1.7.10.2