From fddbe4cfde483f487a99b30f4a44100112995193 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 17 Mar 2009 16:50:48 +0000 Subject: [PATCH] fixes launchApp bug where user defined colourscheme defined in applet parameter does not get passed to application --- src/jalview/schemes/ColourSchemeProperty.java | 63 +++++++++++++++---------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java index 6fc4e2b..dd4eb53 100755 --- a/src/jalview/schemes/ColourSchemeProperty.java +++ b/src/jalview/schemes/ColourSchemeProperty.java @@ -77,7 +77,7 @@ public class ColourSchemeProperty * DOCUMENT ME! * * @param name - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -145,7 +145,7 @@ public class ColourSchemeProperty * DOCUMENT ME! * * @param cs - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -216,7 +216,7 @@ public class ColourSchemeProperty * DOCUMENT ME! * * @param index - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -298,9 +298,9 @@ public class ColourSchemeProperty * DOCUMENT ME! * * @param al - * DOCUMENT ME! + * DOCUMENT ME! * @param name - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ @@ -313,33 +313,46 @@ public class ColourSchemeProperty /** * retrieve or create colourscheme associated with name * - * @param seqs sequences to colour - * @param width range of sequences to colour - * @param name colourscheme name, applet colour parameter specification, or string to parse as colour for new coloursheme + * @param seqs + * sequences to colour + * @param width + * range of sequences to colour + * @param name + * colourscheme name, applet colour parameter specification, or + * string to parse as colour for new coloursheme * @return Valid Colourscheme */ public static ColourSchemeI getColour(java.util.Vector seqs, int width, String name) { int colindex = getColourIndexFromName(name); - if (colindex == UNDEFINED) // USER_DEFINED) + if (colindex == UNDEFINED) { - try + if (name.indexOf('=') == -1) { - return new UserColourScheme(name); - } catch (Exception e) - { - // System.err.println("Ignoring unknown colourscheme name"); + // try to build a colour from the string directly + try + { + return new UserColourScheme(name); + } catch (Exception e) + { + // System.err.println("Ignoring unknown colourscheme name"); + } } - try { - // fix the launchApp user defined coloursheme transfer bug - jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme( - "white"); - ucs.parseAppletParameter(name); - - } catch (Exception e) + else { - // System.err.println("Ignoring exception when parsing colourscheme as applet-parameter"); + // try to parse the string as a residue colourscheme + try + { + // fix the launchApp user defined coloursheme transfer bug + jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme( + "white"); + ucs.parseAppletParameter(name); + + } catch (Exception e) + { + // System.err.println("Ignoring exception when parsing colourscheme as applet-parameter"); + } } } return getColour(seqs, width, getColourIndexFromName(name)); @@ -349,11 +362,11 @@ public class ColourSchemeProperty * DOCUMENT ME! * * @param seqs - * DOCUMENT ME! + * DOCUMENT ME! * @param width - * DOCUMENT ME! + * DOCUMENT ME! * @param index - * DOCUMENT ME! + * DOCUMENT ME! * * @return DOCUMENT ME! */ -- 1.7.10.2