1 Clazz.declarePackage ("swingjs.api");
2 c$ = Clazz.declareType (swingjs.api, "DOMNode");
3 c$.createElement = Clazz.defineMethod (c$, "createElement",
7 obj = document.createElement(key);
11 c$.getParent = Clazz.defineMethod (c$, "getParent",
14 return obj.parentNode;
15 }}, "swingjs.api.DOMNode");
16 c$.remove = Clazz.defineMethod (c$, "remove",
20 var p = obj.parentNode;
24 }}, "swingjs.api.DOMNode");
25 c$.add = Clazz.defineMethod (c$, "add",
26 function (parent, child) {
28 parent && parent.appendChild(child);
29 }}, "swingjs.api.DOMNode,swingjs.api.DOMNode");
30 c$.getAttr = Clazz.defineMethod (c$, "getAttr",
31 function (obj, attr) {
33 if (obj)return obj[attr];
34 }}, "swingjs.api.DOMNode,~S");
35 Clazz.defineMethod (c$, "getStyle",
38 if (obj)return obj.style[style];
40 c$.setAttr = Clazz.defineMethod (c$, "setAttr",
41 function (obj, attr, val) {
43 obj[attr] = (val == "TRUE" ? true : val);
45 }, "swingjs.api.DOMNode,~S,~O");
46 c$.setStyles = Clazz.defineMethod (c$, "setStyles",
47 function (obj, attr) {
49 for (var i = 0; i < attr.length;) {
50 //System.out.println(["DOMNode.setStyles ",attr[i],attr[i+1]])
52 obj.style[attr[i++]] = attr[i++]; }
54 }, "swingjs.api.DOMNode,~A");
55 c$.setSize = Clazz.defineMethod (c$, "setSize",
56 function (obj, width, height) {
57 return swingjs.api.DOMNode.setStyles (obj, ["width", width + "px", "height", height + "px"]);
58 }, "swingjs.api.DOMNode,~N,~N");