X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fswingjs%2Fapi%2FDOMNode.js;fp=site%2Fswingjs%2Fj2s%2Fswingjs%2Fapi%2FDOMNode.js;h=ad289428f4b470b7ab86f8d7d0651624d0123700;hp=f518093497372d905cd8423a10a2d34c21775f5e;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/swingjs/api/DOMNode.js b/site/swingjs/j2s/swingjs/api/DOMNode.js index f518093..ad28942 100644 --- a/site/swingjs/j2s/swingjs/api/DOMNode.js +++ b/site/swingjs/j2s/swingjs/api/DOMNode.js @@ -1,58 +1,58 @@ -Clazz.declarePackage ("swingjs.api"); -c$ = Clazz.declareType (swingjs.api, "DOMNode"); -c$.createElement = Clazz.defineMethod (c$, "createElement", -function (key, id) { -var obj = null; -{ -obj = document.createElement(key); -obj.id = id; -}return obj; -}, "~S,~S"); -c$.getParent = Clazz.defineMethod (c$, "getParent", -function (obj) { -{ -return obj.parentNode; -}}, "swingjs.api.DOMNode"); -c$.remove = Clazz.defineMethod (c$, "remove", -function (obj) { -{ -try { -var p = obj.parentNode; -p.removeNode(obj); -} catch(e) {}; -return p; -}}, "swingjs.api.DOMNode"); -c$.add = Clazz.defineMethod (c$, "add", -function (parent, child) { -{ -parent && parent.appendChild(child); -}}, "swingjs.api.DOMNode,swingjs.api.DOMNode"); -c$.getAttr = Clazz.defineMethod (c$, "getAttr", -function (obj, attr) { -{ -if (obj)return obj[attr]; -}}, "swingjs.api.DOMNode,~S"); -Clazz.defineMethod (c$, "getStyle", -function (style) { -{ -if (obj)return obj.style[style]; -}}, "~S"); -c$.setAttr = Clazz.defineMethod (c$, "setAttr", -function (obj, attr, val) { -{ -obj[attr] = (val == "TRUE" ? true : val); -}return obj; -}, "swingjs.api.DOMNode,~S,~O"); -c$.setStyles = Clazz.defineMethod (c$, "setStyles", -function (obj, attr) { -{ -for (var i = 0; i < attr.length;) { -//System.out.println(["DOMNode.setStyles ",attr[i],attr[i+1]]) -; -obj.style[attr[i++]] = attr[i++]; } -}return obj; -}, "swingjs.api.DOMNode,~A"); -c$.setSize = Clazz.defineMethod (c$, "setSize", -function (obj, width, height) { -return swingjs.api.DOMNode.setStyles (obj, ["width", width + "px", "height", height + "px"]); -}, "swingjs.api.DOMNode,~N,~N"); +Clazz.declarePackage ("swingjs.api"); +c$ = Clazz.declareType (swingjs.api, "DOMNode"); +c$.createElement = Clazz.defineMethod (c$, "createElement", +function (key, id) { +var obj = null; +{ +obj = document.createElement(key); +obj.id = id; +}return obj; +}, "~S,~S"); +c$.getParent = Clazz.defineMethod (c$, "getParent", +function (obj) { +{ +return obj.parentNode; +}}, "swingjs.api.DOMNode"); +c$.remove = Clazz.defineMethod (c$, "remove", +function (obj) { +{ +try { +var p = obj.parentNode; +p.removeNode(obj); +} catch(e) {}; +return p; +}}, "swingjs.api.DOMNode"); +c$.add = Clazz.defineMethod (c$, "add", +function (parent, child) { +{ +parent && parent.appendChild(child); +}}, "swingjs.api.DOMNode,swingjs.api.DOMNode"); +c$.getAttr = Clazz.defineMethod (c$, "getAttr", +function (obj, attr) { +{ +if (obj)return obj[attr]; +}}, "swingjs.api.DOMNode,~S"); +Clazz.defineMethod (c$, "getStyle", +function (style) { +{ +if (obj)return obj.style[style]; +}}, "~S"); +c$.setAttr = Clazz.defineMethod (c$, "setAttr", +function (obj, attr, val) { +{ +obj[attr] = (val == "TRUE" ? true : val); +}return obj; +}, "swingjs.api.DOMNode,~S,~O"); +c$.setStyles = Clazz.defineMethod (c$, "setStyles", +function (obj, attr) { +{ +for (var i = 0; i < attr.length;) { +//System.out.println(["DOMNode.setStyles ",attr[i],attr[i+1]]) +; +obj.style[attr[i++]] = attr[i++]; } +}return obj; +}, "swingjs.api.DOMNode,~A"); +c$.setSize = Clazz.defineMethod (c$, "setSize", +function (obj, width, height) { +return swingjs.api.DOMNode.setStyles (obj, ["width", width + "px", "height", height + "px"]); +}, "swingjs.api.DOMNode,~N,~N");