JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / datamodel / Annotation.js
1 Clazz.declarePackage ("jalview.datamodel");\r
2 Clazz.load (null, "jalview.datamodel.Annotation", ["java.lang.Float", "$.StringBuffer"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.displayCharacter = "";\r
5 this.description = "";\r
6 this.secondaryStructure = ' ';\r
7 this.value = 0;\r
8 this.colour = null;\r
9 Clazz.instantialize (this, arguments);\r
10 }, jalview.datamodel, "Annotation");\r
11 Clazz.makeConstructor (c$, \r
12 function (displayChar, desc, ss, val) {\r
13 this.displayCharacter = displayChar;\r
14 this.description = desc;\r
15 this.secondaryStructure = ss;\r
16 this.value = val;\r
17 }, "~S,~S,~S,~N");\r
18 Clazz.makeConstructor (c$, \r
19 function (displayChar, desc, ss, val, colour) {\r
20 this.construct (displayChar, desc, ss, val);\r
21 this.colour = colour;\r
22 }, "~S,~S,~S,~N,java.awt.Color");\r
23 Clazz.makeConstructor (c$, \r
24 function (that) {\r
25 if (that == null || this === that) {\r
26 return;\r
27 }if (that.displayCharacter != null) this.displayCharacter =  String.instantialize (that.displayCharacter);\r
28 if (that.description != null) this.description =  String.instantialize (that.description);\r
29 this.secondaryStructure = that.secondaryStructure;\r
30 this.value = that.value;\r
31 this.colour = that.colour;\r
32 }, "jalview.datamodel.Annotation");\r
33 Clazz.makeConstructor (c$, \r
34 function (val) {\r
35 this.construct (null, null, ' ', val, null);\r
36 }, "~N");\r
37 Clazz.overrideMethod (c$, "toString", \r
38 function () {\r
39 var sb =  new StringBuffer ();\r
40 if (this.displayCharacter != null) {\r
41 sb.append ("\'");\r
42 sb.append (this.displayCharacter);\r
43 sb.append ("\'");\r
44 }{\r
45 sb.append (",");\r
46 }if (this.secondaryStructure.charCodeAt (0) != 0 && !("" + this.displayCharacter).equals ("" + this.secondaryStructure)) {\r
47 sb.append ("\'");\r
48 sb.append (this.secondaryStructure);\r
49 sb.append ("\'");\r
50 }{\r
51 sb.append (",");\r
52 }if (this.description != null && this.description.length > 0) {\r
53 sb.append ("\"");\r
54 sb.append (this.description);\r
55 sb.append ("\"");\r
56 }{\r
57 sb.append (",");\r
58 }if (!Float.isNaN (this.value)) {\r
59 sb.append (this.value);\r
60 }if (this.colour != null) {\r
61 if (sb.length () > 0) {\r
62 sb.append (",");\r
63 }sb.append ("[");\r
64 sb.append (this.colour.getRed ());\r
65 sb.append (",");\r
66 sb.append (this.colour.getGreen ());\r
67 sb.append (",");\r
68 sb.append (this.colour.getBlue ());\r
69 sb.append ("]");\r
70 }return sb.toString ();\r
71 });\r
72 });\r