JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / javajs / swing / JMenuItem.js
1 Clazz.declarePackage ("javajs.swing");
2 Clazz.load (["javajs.swing.AbstractButton"], "javajs.swing.JMenuItem", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.btnType = 0;
5 Clazz.instantialize (this, arguments);
6 }, javajs.swing, "JMenuItem", javajs.swing.AbstractButton);
7 Clazz.makeConstructor (c$, 
8 function (text) {
9 Clazz.superConstructor (this, javajs.swing.JMenuItem, ["btn"]);
10 this.setText (text);
11 this.btnType = (text == null ? 0 : 1);
12 }, "~S");
13 Clazz.makeConstructor (c$, 
14 function (type, i) {
15 Clazz.superConstructor (this, javajs.swing.JMenuItem, [type]);
16 this.btnType = i;
17 }, "~S,~N");
18 Clazz.overrideMethod (c$, "toHTML", 
19 function () {
20 return this.htmlMenuOpener ("li") + (this.text == null ? "" : "<a>" + this.htmlLabel () + "</a>") + "</li>";
21 });
22 Clazz.overrideMethod (c$, "getHtmlDisabled", 
23 function () {
24 return " class=\"ui-state-disabled\"";
25 });
26 Clazz.defineMethod (c$, "htmlLabel", 
27 ($fz = function () {
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>");
29 }, $fz.isPrivate = true, $fz));
30 Clazz.defineStatics (c$,
31 "TYPE_SEPARATOR", 0,
32 "TYPE_BUTTON", 1,
33 "TYPE_CHECKBOX", 2,
34 "TYPE_RADIO", 3,
35 "TYPE_MENU", 4);
36 });