1 Clazz.declarePackage ("swingjs.plaf");
2 Clazz.load (["swingjs.plaf.JSButtonUI"], "swingjs.plaf.JSRadioButtonUI", ["java.util.HashMap", "javax.swing.DefaultButtonModel", "swingjs.api.DOMNode"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 Clazz.instantialize (this, arguments);
6 }, swingjs.plaf, "JSRadioButtonUI", swingjs.plaf.JSButtonUI);
7 Clazz.overrideMethod (c$, "getDOMObject",
9 return this.getButtonObject ("radio");
11 Clazz.overrideMethod (c$, "getPropertyPrefix",
13 return "RadioButton.";
15 Clazz.overrideMethod (c$, "setHTMLSize",
16 function (obj, addCSS) {
17 swingjs.api.DOMNode.setStyles (this.domBtn, ["position", null]);
18 swingjs.api.DOMNode.setStyles (this.label, ["position", null]);
19 var d = this.setHTMLSize1 (obj, addCSS, false);
20 swingjs.api.DOMNode.setStyles (this.domBtn, ["position", "absolute"]);
21 swingjs.api.DOMNode.setStyles (this.label, ["position", "absolute"]);
23 }, "swingjs.api.DOMNode,~B");
24 Clazz.defineMethod (c$, "getButtonObject",
29 if (this.domNode == null) {
31 if (swingjs.plaf.JSRadioButtonUI.groupNames == null) swingjs.plaf.JSRadioButtonUI.groupNames = new java.util.HashMap ();
35 if (Clazz.instanceOf (b.getModel (), javax.swing.DefaultButtonModel)) {
36 bg = (b.getModel ()).getGroup ();
37 name = swingjs.plaf.JSRadioButtonUI.groupNames.get (bg);
38 if (name == null) swingjs.plaf.JSRadioButtonUI.groupNames.put (bg, name = this.id);
40 }this.domBtn = this.enableNode = this.createDOMObject ("input", this.id, ["type", myType, "name", name]);
41 this.label = this.textNode = this.createDOMObject ("label", this.id + "l", ["htmlFor", this.id]);
42 }if (b.isSelected () || isNew) swingjs.api.DOMNode.setAttr (this.domBtn, "checked", "true");
43 this.setCssFont (swingjs.api.DOMNode.setAttr (this.label, "innerHTML", (this.c).getText ()), this.c.getFont ());
44 var drad = this.setHTMLSize1 (this.domBtn, false, false);
45 this.setHTMLSize1 (this.label, false, false);
46 var obj = this.wrap ("div", "", [this.domBtn, this.label]);
47 var dobj = this.setHTMLSize1 (obj, true, true);
48 swingjs.plaf.JSComponentUI.vCenter (this.domBtn, -75);
49 swingjs.plaf.JSComponentUI.vCenter (this.label, -50);
50 swingjs.api.DOMNode.setStyles (this.label, ["position", "absolute", "left", drad.width + "px"]);
51 swingjs.api.DOMNode.setStyles (this.domBtn, ["position", "absolute"]);
53 obj = this.wrap ("div", this.id + "_0", [this.domBtn, this.label]);
54 swingjs.api.DOMNode.setStyles (obj, ["position", "absolute"]);
57 obj.appendChild (this.domBtn);
58 obj.appendChild (this.label);
59 }return swingjs.api.DOMNode.setSize (obj, dobj.width, dobj.height);
61 Clazz.defineStatics (c$,