From 6ab383a26fe6e42b6a5dca4b2132322c660a4c37 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 28 Apr 2005 15:41:34 +0000 Subject: [PATCH] Updated for use by preferences panel --- src/jalview/schemes/ColourSchemeProperty.java | 105 ++++++++++++++++++------- 1 file changed, 77 insertions(+), 28 deletions(-) diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java index 518f7ab..169f35e 100755 --- a/src/jalview/schemes/ColourSchemeProperty.java +++ b/src/jalview/schemes/ColourSchemeProperty.java @@ -1,28 +1,77 @@ -package jalview.schemes; - -public class ColourSchemeProperty { - String description; - String className; - String menuString = null; - - public ColourSchemeProperty(String description, String className, String menuString) { - this.description = new String(description); - this.className = new String(className); - if (menuString != null) { - this.menuString = new String(menuString); - } - } - - public String getClassName() { - return className; - } - public String getDescription() { - return description; - } - public String getMenuString() { - return menuString; - } - public boolean isMenuItem() { - return (menuString != null); - } -} +package jalview.schemes; + +public class ColourSchemeProperty +{ + public static final int CLUSTAL = 0; + public static final int BLOSUM = 1; + public static final int PID = 2; + public static final int ZAPPO = 3; + public static final int HYDROPHOBIC=4; + public static final int HELIX=5; + public static final int STRAND=6; + public static final int TURN = 7; + public static final int BURIED = 8; + public static final int NUCLEOTIDE = 9; + public static final int USER_DEFINED = 10; + public static final int NONE = 11; + + + public static String getColourName(int index) + { + String ret=null; + switch(index) + { + case CLUSTAL: ret = "Clustal"; break; + case BLOSUM: ret = "Blosum62"; break; + case PID: ret = "% Identity"; break; + case ZAPPO: ret = "Zappo"; break; + case HYDROPHOBIC: ret="Hydrophobic";break; + case HELIX: ret="Helix Propensity";break; + case STRAND: ret="Strand Propensity";break; + case TURN: ret="Turn Propensity";break; + case BURIED: ret="Buried Index";break; + case NUCLEOTIDE:ret="Nucleotide"; break; + case USER_DEFINED:ret="User Defined";break; + default: ret = "None"; break; + } + return ret; + } + + public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, String name) + { + for(int i=0; i<12; i++) + { + if(getColourName(i).equals(name)) + return getColour(al, i); + } + return null; + } + + public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, int index) + { + ColourSchemeI cs = null; + switch(index) + { + case CLUSTAL: cs = new ClustalxColourScheme(al.getSequences(), al.getWidth()); break; + case BLOSUM: cs = new Blosum62ColourScheme(); break; + case PID: cs = new PIDColourScheme(); break; + case ZAPPO: cs = new ZappoColourScheme(); break; + case HYDROPHOBIC: cs = new HydrophobicColourScheme(); break; + case HELIX: cs = new HelixColourScheme(); break; + case STRAND: cs = new StrandColourScheme(); break; + case TURN: cs = new TurnColourScheme(); break; + case BURIED: cs = new BuriedColourScheme(); break; + case NUCLEOTIDE: cs = new NucleotideColourScheme(); break; + case USER_DEFINED: + if(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR")!=null) + { + cs = jalview.gui.UserDefinedColours.loadDefaultColours(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR")); + } + break; + + default: break; + } + + return cs; + } +} -- 1.7.10.2