JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / bin / javajs / swing / JMenuItem.js
1 Clazz.declarePackage ("javajs.swing");\r
2 Clazz.load (["javajs.swing.AbstractButton"], "javajs.swing.JMenuItem", null, function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.btnType = 0;\r
5 Clazz.instantialize (this, arguments);\r
6 }, javajs.swing, "JMenuItem", javajs.swing.AbstractButton);\r
7 Clazz.makeConstructor (c$, \r
8 function (text) {\r
9 Clazz.superConstructor (this, javajs.swing.JMenuItem, ["btn"]);\r
10 this.setText (text);\r
11 this.btnType = (text == null ? 0 : 1);\r
12 }, "~S");\r
13 Clazz.makeConstructor (c$, \r
14 function (type, i) {\r
15 Clazz.superConstructor (this, javajs.swing.JMenuItem, [type]);\r
16 this.btnType = i;\r
17 }, "~S,~N");\r
18 Clazz.overrideMethod (c$, "toHTML", \r
19 function () {\r
20 return this.htmlMenuOpener ("li") + (this.text == null ? "" : "<a>" + this.htmlLabel () + "</a>") + "</li>";\r
21 });\r
22 Clazz.overrideMethod (c$, "getHtmlDisabled", \r
23 function () {\r
24 return " class=\"ui-state-disabled\"";\r
25 });\r
26 Clazz.defineMethod (c$, "htmlLabel", \r
27 ($fz = function () {\r
28 return (this.btnType == 1 ? this.text : "<label><input id=\"" + this.id + "-" + (this.btnType == 3 ? "r" : "c") + "b\" type=\"" + (this.btnType == 3 ? "radio\" name=\"" + this.htmlName : "checkbox") + "\" " + (this.selected ? "checked" : "") + " />" + this.text + "</label>");\r
29 }, $fz.isPrivate = true, $fz));\r
30 Clazz.defineStatics (c$,\r
31 "TYPE_SEPARATOR", 0,\r
32 "TYPE_BUTTON", 1,\r
33 "TYPE_CHECKBOX", 2,\r
34 "TYPE_RADIO", 3,\r
35 "TYPE_MENU", 4);\r
36 });\r