1 Clazz.declarePackage ("javajs.swing");
2 Clazz.load (["javajs.api.SC", "javajs.swing.JComponent"], "javajs.swing.AbstractButton", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.itemListener = null;
10 Clazz.instantialize (this, arguments);
11 }, javajs.swing, "AbstractButton", javajs.swing.JComponent, javajs.api.SC);
12 Clazz.makeConstructor (c$,
14 Clazz.superConstructor (this, javajs.swing.AbstractButton, [type]);
17 Clazz.overrideMethod (c$, "setSelected",
19 this.selected = selected;
21 SwingController.setSelected(this);
23 Clazz.overrideMethod (c$, "isSelected",
27 Clazz.overrideMethod (c$, "addItemListener",
29 this.itemListener = listener;
31 Clazz.overrideMethod (c$, "getIcon",
35 Clazz.overrideMethod (c$, "setIcon",
39 Clazz.overrideMethod (c$, "init",
40 function (text, icon, actionCommand, popupMenu) {
43 this.actionCommand = actionCommand;
44 this.popupMenu = popupMenu;
46 SwingController.initMenuItem(this);
47 }}, "~S,~O,~S,javajs.api.SC");
48 Clazz.defineMethod (c$, "getTopPopupMenu",
50 return this.popupMenu;
52 Clazz.defineMethod (c$, "add",
54 this.addComponent (item);
56 Clazz.overrideMethod (c$, "insert",
57 function (subMenu, index) {
58 this.insertComponent (subMenu, index);
59 }, "javajs.api.SC,~N");
60 Clazz.overrideMethod (c$, "getPopupMenu",
64 Clazz.defineMethod (c$, "getMenuHTML",
66 var label = (this.icon != null ? this.icon : this.text != null ? this.text : null);
67 var s = (label == null ? "" : "<li><a>" + label + "</a>" + this.htmlMenuOpener ("ul"));
68 var n = this.getComponentCount ();
69 if (n > 0) for (var i = 0; i < n; i++) s += this.getComponent (i).toHTML ();
71 if (label != null) s += "</ul></li>";
74 Clazz.defineMethod (c$, "htmlMenuOpener",
76 return "<" + type + " id=\"" + this.id + "\"" + (this.enabled ? "" : this.getHtmlDisabled ()) + ">";
78 Clazz.defineMethod (c$, "getHtmlDisabled",
80 return " disabled=\"disabled\"";