JAL-1807 still testing
[jalviewjs.git] / bin / jalview / schemes / UserColourScheme.js
index ee83987..dcf5f86 100644 (file)
-Clazz.declarePackage ("jalview.schemes");
-Clazz.load (["jalview.schemes.ResidueColourScheme"], "jalview.schemes.UserColourScheme", ["jalview.schemes.ColourSchemeProperty", "$.ResidueProperties", "java.awt.Color", "java.util.StringTokenizer"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.lowerCaseColours = null;
-this.schemeName = null;
-Clazz.instantialize (this, arguments);
-}, jalview.schemes, "UserColourScheme", jalview.schemes.ResidueColourScheme);
-Clazz.makeConstructor (c$, 
-function () {
-Clazz.superConstructor (this, jalview.schemes.UserColourScheme, [jalview.schemes.ResidueProperties.aaIndex]);
-});
-Clazz.makeConstructor (c$, 
-function (newColors) {
-Clazz.superConstructor (this, jalview.schemes.UserColourScheme, [jalview.schemes.ResidueProperties.aaIndex]);
-this.colors = newColors;
-}, "~A");
-Clazz.overrideMethod (c$, "applyTo", 
-function (sg, hiddenRepSequences) {
-var usc =  new jalview.schemes.UserColourScheme (this.colors);
-if (this.lowerCaseColours != null) {
-usc.schemeName =  String.instantialize (this.schemeName);
-usc.lowerCaseColours =  new Array (this.lowerCaseColours.length);
-System.arraycopy (this.lowerCaseColours, 0, usc.lowerCaseColours, 0, this.lowerCaseColours.length);
-}return usc;
-}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
-Clazz.makeConstructor (c$, 
-function (colour) {
-Clazz.superConstructor (this, jalview.schemes.UserColourScheme, [jalview.schemes.ResidueProperties.aaIndex]);
-var col = this.getColourFromString (colour);
-if (col == null) {
-System.out.println ("Unknown colour!! " + colour);
-col = this.createColourFromName (colour);
-}this.colors =  new Array (24);
-for (var i = 0; i < 24; i++) {
-this.colors[i] = col;
-}
-this.schemeName = colour;
-}, "~S");
-Clazz.defineMethod (c$, "getColours", 
-function () {
-return this.colors;
-});
-Clazz.defineMethod (c$, "getLowerCaseColours", 
-function () {
-return this.lowerCaseColours;
-});
-Clazz.defineMethod (c$, "setName", 
-function (name) {
-this.schemeName = name;
-}, "~S");
-Clazz.defineMethod (c$, "getName", 
-function () {
-return this.schemeName;
-});
-Clazz.defineMethod (c$, "getColourFromString", 
-function (colour) {
-colour = colour.trim ();
-var col = null;
-try {
-var value = Integer.parseInt (colour, 16);
-col =  new java.awt.Color (value);
-} catch (ex) {
-if (Clazz.exceptionOf (ex, NumberFormatException)) {
-} else {
-throw ex;
-}
-}
-if (col == null) {
-col = jalview.schemes.ColourSchemeProperty.getAWTColorFromName (colour);
-}if (col == null) {
-try {
-var st =  new java.util.StringTokenizer (colour, ",");
-var r = Integer.parseInt (st.nextToken ());
-var g = Integer.parseInt (st.nextToken ());
-var b = Integer.parseInt (st.nextToken ());
-col =  new java.awt.Color (r, g, b);
-} catch (ex) {
-if (Clazz.exceptionOf (ex, Exception)) {
-} else {
-throw ex;
-}
-}
-}return col;
-}, "~S");
-Clazz.defineMethod (c$, "createColourFromName", 
-function (name) {
-var r;
-var g;
-var b;
-var lsize = name.length;
-var start = 0;
-var end = Clazz.doubleToInt (lsize / 3);
-var rgbOffset = Math.abs (name.hashCode () % 10) * 15;
-r = Math.abs (name.substring (start, end).hashCode () + rgbOffset) % 210 + 20;
-start = end;
-end += Clazz.doubleToInt (lsize / 3);
-if (end > lsize) {
-end = lsize;
-}g = Math.abs (name.substring (start, end).hashCode () + rgbOffset) % 210 + 20;
-b = Math.abs (name.substring (end).hashCode () + rgbOffset) % 210 + 20;
-var color =  new java.awt.Color (r, g, b);
-return color;
-}, "~S");
-Clazz.defineMethod (c$, "parseAppletParameter", 
-function (paramValue) {
-var st =  new java.util.StringTokenizer (paramValue, ";");
-var st2;
-var token = null;
-var colour;
-var residues;
-try {
-while (st.hasMoreElements ()) {
-token = st.nextToken ().trim ();
-residues = token.substring (0, token.indexOf ("="));
-colour = token.substring (token.indexOf ("=") + 1);
-st2 =  new java.util.StringTokenizer (residues, " ,");
-while (st2.hasMoreTokens ()) {
-token = st2.nextToken ();
-if (jalview.schemes.ResidueProperties.aaIndex[token.charCodeAt (0)] == -1) {
-continue;
-}var colIndex = jalview.schemes.ResidueProperties.aaIndex[token.charCodeAt (0)];
-if (token.equalsIgnoreCase ("lowerCase")) {
-if (this.lowerCaseColours == null) {
-this.lowerCaseColours =  new Array (23);
-}for (var i = 0; i < 23; i++) {
-if (this.lowerCaseColours[i] == null) {
-this.lowerCaseColours[i] = this.getColourFromString (colour);
-}}
-continue;
-}if (token.equals (token.toLowerCase ())) {
-if (this.lowerCaseColours == null) {
-this.lowerCaseColours =  new Array (23);
-}this.lowerCaseColours[colIndex] = this.getColourFromString (colour);
-} else {
-this.colors[colIndex] = this.getColourFromString (colour);
-}}
-}
-} catch (ex) {
-if (Clazz.exceptionOf (ex, Exception)) {
-System.out.println ("Error parsing userDefinedColours:\n" + token + "\n" + ex);
-} else {
-throw ex;
-}
-}
-}, "~S");
-Clazz.defineMethod (c$, "findColour", 
-function (c, j, seq) {
-var currentColour;
-var index = jalview.schemes.ResidueProperties.aaIndex[c.charCodeAt (0)];
-if ((this.threshold == 0) || this.aboveThreshold (c, j)) {
-if (this.lowerCaseColours != null && 'a' <= c && c <= 'z') {
-currentColour = this.lowerCaseColours[index];
-} else {
-currentColour = this.colors[index];
-}} else {
-currentColour = java.awt.Color.white;
-}if (this.conservationColouring) {
-currentColour = this.applyConservation (currentColour, j);
-}return currentColour;
-}, "~S,~N,jalview.datamodel.SequenceI");
-Clazz.defineMethod (c$, "setLowerCaseColours", 
-function (lcolours) {
-this.lowerCaseColours = lcolours;
-}, "~A");
-});
+Clazz.declarePackage ("jalview.schemes");\r
+Clazz.load (["jalview.schemes.ResidueColourScheme"], "jalview.schemes.UserColourScheme", ["jalview.schemes.ColourSchemeProperty", "$.ResidueProperties", "java.awt.Color", "java.util.StringTokenizer"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.lowerCaseColours = null;\r
+this.schemeName = null;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.schemes, "UserColourScheme", jalview.schemes.ResidueColourScheme);\r
+Clazz.makeConstructor (c$, \r
+function () {\r
+Clazz.superConstructor (this, jalview.schemes.UserColourScheme, [jalview.schemes.ResidueProperties.aaIndex]);\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (newColors) {\r
+Clazz.superConstructor (this, jalview.schemes.UserColourScheme, [jalview.schemes.ResidueProperties.aaIndex]);\r
+this.colors = newColors;\r
+}, "~A");\r
+Clazz.overrideMethod (c$, "applyTo", \r
+function (sg, hiddenRepSequences) {\r
+var usc =  new jalview.schemes.UserColourScheme (this.colors);\r
+if (this.lowerCaseColours != null) {\r
+usc.schemeName =  String.instantialize (this.schemeName);\r
+usc.lowerCaseColours =  new Array (this.lowerCaseColours.length);\r
+System.arraycopy (this.lowerCaseColours, 0, usc.lowerCaseColours, 0, this.lowerCaseColours.length);\r
+}return usc;\r
+}, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");\r
+Clazz.makeConstructor (c$, \r
+function (colour) {\r
+Clazz.superConstructor (this, jalview.schemes.UserColourScheme, [jalview.schemes.ResidueProperties.aaIndex]);\r
+var col = this.getColourFromString (colour);\r
+if (col == null) {\r
+System.out.println ("Unknown colour!! " + colour);\r
+col = this.createColourFromName (colour);\r
+}this.colors =  new Array (24);\r
+for (var i = 0; i < 24; i++) {\r
+this.colors[i] = col;\r
+}\r
+this.schemeName = colour;\r
+}, "~S");\r
+Clazz.defineMethod (c$, "getColours", \r
+function () {\r
+return this.colors;\r
+});\r
+Clazz.defineMethod (c$, "getLowerCaseColours", \r
+function () {\r
+return this.lowerCaseColours;\r
+});\r
+Clazz.defineMethod (c$, "setName", \r
+function (name) {\r
+this.schemeName = name;\r
+}, "~S");\r
+Clazz.defineMethod (c$, "getName", \r
+function () {\r
+return this.schemeName;\r
+});\r
+Clazz.defineMethod (c$, "getColourFromString", \r
+function (colour) {\r
+colour = colour.trim ();\r
+var col = null;\r
+try {\r
+var value = Integer.parseInt (colour, 16);\r
+col =  new java.awt.Color (value);\r
+} catch (ex) {\r
+if (Clazz.exceptionOf (ex, NumberFormatException)) {\r
+} else {\r
+throw ex;\r
+}\r
+}\r
+if (col == null) {\r
+col = jalview.schemes.ColourSchemeProperty.getAWTColorFromName (colour);\r
+}if (col == null) {\r
+try {\r
+var st =  new java.util.StringTokenizer (colour, ",");\r
+var r = Integer.parseInt (st.nextToken ());\r
+var g = Integer.parseInt (st.nextToken ());\r
+var b = Integer.parseInt (st.nextToken ());\r
+col =  new java.awt.Color (r, g, b);\r
+} catch (ex) {\r
+if (Clazz.exceptionOf (ex, Exception)) {\r
+} else {\r
+throw ex;\r
+}\r
+}\r
+}return col;\r
+}, "~S");\r
+Clazz.defineMethod (c$, "createColourFromName", \r
+function (name) {\r
+var r;\r
+var g;\r
+var b;\r
+var lsize = name.length;\r
+var start = 0;\r
+var end = Clazz.doubleToInt (lsize / 3);\r
+var rgbOffset = Math.abs (name.hashCode () % 10) * 15;\r
+r = Math.abs (name.substring (start, end).hashCode () + rgbOffset) % 210 + 20;\r
+start = end;\r
+end += Clazz.doubleToInt (lsize / 3);\r
+if (end > lsize) {\r
+end = lsize;\r
+}g = Math.abs (name.substring (start, end).hashCode () + rgbOffset) % 210 + 20;\r
+b = Math.abs (name.substring (end).hashCode () + rgbOffset) % 210 + 20;\r
+var color =  new java.awt.Color (r, g, b);\r
+return color;\r
+}, "~S");\r
+Clazz.defineMethod (c$, "parseAppletParameter", \r
+function (paramValue) {\r
+var st =  new java.util.StringTokenizer (paramValue, ";");\r
+var st2;\r
+var token = null;\r
+var colour;\r
+var residues;\r
+try {\r
+while (st.hasMoreElements ()) {\r
+token = st.nextToken ().trim ();\r
+residues = token.substring (0, token.indexOf ("="));\r
+colour = token.substring (token.indexOf ("=") + 1);\r
+st2 =  new java.util.StringTokenizer (residues, " ,");\r
+while (st2.hasMoreTokens ()) {\r
+token = st2.nextToken ();\r
+if (jalview.schemes.ResidueProperties.aaIndex[token.charCodeAt (0)] == -1) {\r
+continue;\r
+}var colIndex = jalview.schemes.ResidueProperties.aaIndex[token.charCodeAt (0)];\r
+if (token.equalsIgnoreCase ("lowerCase")) {\r
+if (this.lowerCaseColours == null) {\r
+this.lowerCaseColours =  new Array (23);\r
+}for (var i = 0; i < 23; i++) {\r
+if (this.lowerCaseColours[i] == null) {\r
+this.lowerCaseColours[i] = this.getColourFromString (colour);\r
+}}\r
+continue;\r
+}if (token.equals (token.toLowerCase ())) {\r
+if (this.lowerCaseColours == null) {\r
+this.lowerCaseColours =  new Array (23);\r
+}this.lowerCaseColours[colIndex] = this.getColourFromString (colour);\r
+} else {\r
+this.colors[colIndex] = this.getColourFromString (colour);\r
+}}\r
+}\r
+} catch (ex) {\r
+if (Clazz.exceptionOf (ex, Exception)) {\r
+System.out.println ("Error parsing userDefinedColours:\n" + token + "\n" + ex);\r
+} else {\r
+throw ex;\r
+}\r
+}\r
+}, "~S");\r
+Clazz.defineMethod (c$, "findColour", \r
+function (c, j, seq) {\r
+var currentColour;\r
+var index = jalview.schemes.ResidueProperties.aaIndex[c.charCodeAt (0)];\r
+if ((this.threshold == 0) || this.aboveThreshold (c, j)) {\r
+if (this.lowerCaseColours != null && 'a' <= c && c <= 'z') {\r
+currentColour = this.lowerCaseColours[index];\r
+} else {\r
+currentColour = this.colors[index];\r
+}} else {\r
+currentColour = java.awt.Color.white;\r
+}if (this.conservationColouring) {\r
+currentColour = this.applyConservation (currentColour, j);\r
+}return currentColour;\r
+}, "~S,~N,jalview.datamodel.SequenceI");\r
+Clazz.defineMethod (c$, "setLowerCaseColours", \r
+function (lcolours) {\r
+this.lowerCaseColours = lcolours;\r
+}, "~A");\r
+});\r