Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / swingjs / plaf / JSComponentUI.js
index fc8f00e..c54839d 100644 (file)
-Clazz.declarePackage ("swingjs.plaf");\r
-Clazz.load (["javax.swing.plaf.ComponentUI", "swingjs.plaf.JSEventHandler"], "swingjs.plaf.JSComponentUI", ["java.lang.IllegalArgumentException", "$.NullPointerException", "java.awt.Color", "$.Component", "$.Dimension", "$.Point", "$.Toolkit", "java.awt.event.FocusEvent", "swingjs.JSToolkit", "swingjs.api.DOMNode"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.id = null;\r
-this.c = null;\r
-this.outerNode = null;\r
-this.domNode = null;\r
-this.enableNode = null;\r
-this.textNode = null;\r
-this.valueNode = null;\r
-this.scrollNode = null;\r
-this.focusNode = null;\r
-this.components = null;\r
-this.num = 0;\r
-this.isTainted = true;\r
-this.x = 0;\r
-this.y = 0;\r
-this.preferredSize = null;\r
-this.isContainer = false;\r
-this.parent = null;\r
-this.currentText = null;\r
-this.scrollerNode = null;\r
-this.classID = null;\r
-this.document = null;\r
-this.body = null;\r
-this.needPreferred = false;\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs.plaf, "JSComponentUI", javax.swing.plaf.ComponentUI, swingjs.plaf.JSEventHandler);\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-Clazz.superConstructor (this, swingjs.plaf.JSComponentUI, []);\r
-this.setDoc ();\r
-});\r
-Clazz.defineMethod (c$, "setDoc", \r
-function () {\r
-{\r
-this.document = document;\r
-this.body = document.body;\r
-}});\r
-Clazz.overrideMethod (c$, "installUI", \r
-function (c) {\r
-}, "javax.swing.JComponent");\r
-Clazz.overrideMethod (c$, "uninstallUI", \r
-function (c) {\r
-this.uninstallJSUI ();\r
-}, "javax.swing.JComponent");\r
-Clazz.defineMethod (c$, "$", \r
-function (node) {\r
-return swingjs.JSToolkit.getJQuery ().$ (node);\r
-}, "swingjs.api.DOMNode");\r
-Clazz.defineMethod (c$, "setTainted", \r
-function () {\r
-this.isTainted = true;\r
-});\r
-Clazz.defineMethod (c$, "set", \r
-function (target) {\r
-this.c = target;\r
-this.newID ();\r
-if (this.needPreferred) this.getPreferredSize (this.c);\r
-this.installJSUI ();\r
-return this;\r
-}, "javax.swing.JComponent");\r
-Clazz.defineMethod (c$, "newID", \r
-function () {\r
-this.classID = this.c.getUIClassID ();\r
-if (this.id == null) {\r
-this.num = ++swingjs.plaf.JSComponentUI.incr;\r
-this.id = this.c.getHTMLName (this.classID) + "_" + this.num;\r
-}});\r
-Clazz.defineMethod (c$, "setCssFont", \r
-function (obj, font) {\r
-if (font != null) {\r
-var istyle = font.getStyle ();\r
-var name = font.getFamily ();\r
-if (name === "Dialog") name = "Arial";\r
-swingjs.api.DOMNode.setStyles (obj, ["font-family", name, "font-size", font.getSize () + "px", "font-style", ((istyle & 2) == 0 ? "normal" : "italic"), "font-weight", ((istyle & 1) == 0 ? "normal" : "bold")]);\r
-}if (this.c.isBackgroundSet ()) this.setBackground (this.c.getBackground ());\r
-this.setForeground (this.c.getForeground ());\r
-return obj;\r
-}, "swingjs.api.DOMNode,java.awt.Font");\r
-Clazz.defineMethod (c$, "createDOMObject", \r
-function (key, id, attr) {\r
-var obj = swingjs.api.DOMNode.createElement (key, id);\r
-for (var i = 0; i < attr.length; ) swingjs.api.DOMNode.setAttr (obj, attr[i++], attr[i++]);\r
-\r
-if (!this.c.isEnabled ()) this.setEnabled (false);\r
-return obj;\r
-}, "~S,~S,~A");\r
-Clazz.defineMethod (c$, "bindMouse", \r
-function (node) {\r
-swingjs.api.DOMNode.setAttr (node, "data-UI", this);\r
-}, "swingjs.api.DOMNode");\r
-Clazz.overrideMethod (c$, "handleJSEvent", \r
-function (target, eventType, jQueryEvent) {\r
-return false;\r
-}, "~O,~N,~O");\r
-Clazz.defineMethod (c$, "wrap", \r
-function (type, id, elements) {\r
-return this.append (this.createDOMObject (type, id + type, []), elements);\r
-}, "~S,~S,~A");\r
-Clazz.defineMethod (c$, "append", \r
-function (obj, elements) {\r
-for (var i = 0; i < elements.length; i++) {\r
-obj.appendChild (elements[i]);\r
-}\r
-return obj;\r
-}, "swingjs.api.DOMNode,~A");\r
-Clazz.defineMethod (c$, "debugDump", \r
-function (d) {\r
-System.out.println (swingjs.api.DOMNode.getAttr (d, "outerHTML"));\r
-}, "swingjs.api.DOMNode");\r
-c$.vCenter = Clazz.defineMethod (c$, "vCenter", \r
-function (obj, offset) {\r
-swingjs.api.DOMNode.setStyles (obj, ["top", "50%", "transform", "translateY(" + offset + "%)"]);\r
-}, "swingjs.api.DOMNode,~N");\r
-Clazz.defineMethod (c$, "setHTMLSize", \r
-function (obj, addCSS) {\r
-return this.setHTMLSize1 (obj, addCSS, true);\r
-}, "swingjs.api.DOMNode,~B");\r
-Clazz.defineMethod (c$, "setHTMLSize1", \r
-function (node, addCSS, usePreferred) {\r
-if (node == null) return null;\r
-var h;\r
-var w;\r
-var w0 = null;\r
-var h0 = null;\r
-var parentNode = null;\r
-if (this.scrollerNode != null) {\r
-w = this.scrollerNode.c.getWidth ();\r
-h = this.scrollerNode.c.getHeight ();\r
-} else if (usePreferred && this.preferredSize != null) {\r
-w = this.preferredSize.width;\r
-h = this.preferredSize.height;\r
-} else {\r
-parentNode = swingjs.api.DOMNode.remove (node);\r
-{\r
-w0 = node.style.width;\r
-h0 = node.style.height;\r
-}swingjs.api.DOMNode.setStyles (node, ["position", null, "width", null, "height", null]);\r
-var div;\r
-if (swingjs.api.DOMNode.getAttr (node, "tagName") === "DIV") div = node;\r
- else div = this.wrap ("div", this.id + "_temp", [node]);\r
-swingjs.api.DOMNode.setStyles (div, ["position", "absolute"]);\r
-this.body.appendChild (div);\r
-w = Clazz.doubleToInt (Math.ceil (this.$ (div).width () + 0.5));\r
-h = Clazz.doubleToInt (Math.ceil (this.$ (div).height () + 0.5));\r
-this.body.removeChild (div);\r
-}var size = this.getCSSDimension (w, h);\r
-if (addCSS) {\r
-swingjs.api.DOMNode.setStyles (node, ["position", "absolute"]);\r
-swingjs.api.DOMNode.setSize (node, size.width, size.height);\r
-} else {\r
-swingjs.api.DOMNode.setStyles (node, ["position", null]);\r
-if (w0 != null) swingjs.api.DOMNode.setStyles (node, ["width", w0, "height", h0]);\r
-}if (parentNode != null) parentNode.appendChild (node);\r
-return size;\r
-}, "swingjs.api.DOMNode,~B,~B");\r
-Clazz.defineMethod (c$, "getCSSDimension", \r
-function (w, h) {\r
-return  new java.awt.Dimension (w, h);\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "setHTMLElement", \r
-function () {\r
-if (!this.isTainted) return this.outerNode;\r
-var root = (this.isContainer ? this.c.getRootPane () : null);\r
-if (this.c === root) {\r
-this.isTainted = false;\r
-return this.outerNode;\r
-}this.domNode = this.getDOMObject ();\r
-if (this.outerNode == null) {\r
-this.outerNode = this.wrap ("div", this.id, [this.domNode]);\r
-if (root != null && root.getContentPane () === this.c) swingjs.JSToolkit.getHTML5Applet (this.c)._getContentLayer ().appendChild (this.outerNode);\r
-}swingjs.api.DOMNode.setStyles (this.outerNode, ["position", "absolute", "left", (this.x = this.c.getX ()) + "px", "top", (this.y = this.c.getY ()) + "px"]);\r
-if (this.isContainer) {\r
-System.out.println ("JSComponentUI container " + this.id + " " + this.c.getBounds ());\r
-swingjs.api.DOMNode.setSize (this.outerNode, this.c.getWidth (), this.c.getHeight ());\r
-var children = (this.components == null ? this.c.getComponents () : this.components);\r
-for (var i = children.length; --i >= 0; ) {\r
-var ui = swingjs.JSToolkit.getUI (children[i], false);\r
-if (ui == null) {\r
-continue;\r
-}if (ui.outerNode == null) ui.setHTMLElement ();\r
-if (ui.outerNode == null) {\r
-System.out.println ("JSCUI could not add " + ui.c.getName () + " to " + this.c.getName ());\r
-} else {\r
-this.outerNode.appendChild (ui.outerNode);\r
-}ui.parent = this;\r
-}\r
-}this.isTainted = false;\r
-return this.outerNode;\r
-});\r
-Clazz.defineMethod (c$, "getPreferredSize", \r
-function (c) {\r
-var d = this.setHTMLSize (this.getDOMObject (), false);\r
-return d;\r
-}, "javax.swing.JComponent");\r
-Clazz.defineMethod (c$, "paint", \r
-function (g, c) {\r
-if (c.isOpaque ()) {\r
-g.setColor (c.getBackground ());\r
-g.fillRect (0, 0, c.getWidth (), c.getHeight ());\r
-}}, "java.awt.Graphics,javax.swing.JComponent");\r
-Clazz.overrideMethod (c$, "update", \r
-function (g, c) {\r
-var testing = false;\r
-if (testing) {\r
-g.setColor (java.awt.Color.red);\r
-g.drawRect (0, 0, c.getWidth (), c.getHeight ());\r
-System.out.println ("drawing " + c.getWidth () + " " + c.getHeight ());\r
-}this.setHTMLElement ();\r
-this.paint (g, c);\r
-}, "java.awt.Graphics,javax.swing.JComponent");\r
-Clazz.defineMethod (c$, "getMinimumSize", \r
-function (c) {\r
-return this.getPreferredSize (c);\r
-}, "javax.swing.JComponent");\r
-Clazz.overrideMethod (c$, "getMaximumSize", \r
-function (c) {\r
-return null;\r
-}, "javax.swing.JComponent");\r
-Clazz.overrideMethod (c$, "contains", \r
-function (c, x, y) {\r
-return c.inside (x, y);\r
-}, "javax.swing.JComponent,~N,~N");\r
-c$.createUI = Clazz.overrideMethod (c$, "createUI", \r
-function (c) {\r
-return null;\r
-}, "javax.swing.JComponent");\r
-Clazz.overrideMethod (c$, "getBaseline", \r
-function (c, width, height) {\r
-if (c == null) {\r
-throw  new NullPointerException ("Component must be non-null");\r
-}if (width < 0 || height < 0) {\r
-throw  new IllegalArgumentException ("Width and height must be >= 0");\r
-}return -1;\r
-}, "javax.swing.JComponent,~N,~N");\r
-Clazz.overrideMethod (c$, "getBaselineResizeBehavior", \r
-function (c) {\r
-if (c == null) {\r
-throw  new NullPointerException ("Component must be non-null");\r
-}return java.awt.Component.BaselineResizeBehavior.OTHER;\r
-}, "javax.swing.JComponent");\r
-Clazz.defineMethod (c$, "getJSTextValue", \r
-function () {\r
-return swingjs.api.DOMNode.getAttr (this.domNode, this.valueNode == null ? "innerHTML" : "value");\r
-});\r
-Clazz.defineMethod (c$, "notifyPropertyChanged", \r
-function (prop) {\r
-var obj = null;\r
-var val = null;\r
-if (prop === "text") {\r
-val = (this.c).getText ();\r
-if (val.equals (this.currentText)) return;\r
-this.currentText = val;\r
-if (this.textNode != null) {\r
-prop = "innerHTML";\r
-obj = this.textNode;\r
-} else if (this.valueNode != null) {\r
-prop = "value";\r
-obj = this.valueNode;\r
-}} else if (prop === "preferredSize") {\r
-this.preferredSize = this.c.getPreferredSize ();\r
-this.getPreferredSize ();\r
-return;\r
-}if (obj == null) {\r
-System.out.println ("JSComponentUI: unrecognized prop: " + prop);\r
-} else {\r
-System.out.println ("JSComponentUI: setting " + this.id + " " + prop);\r
-this.setProp (obj, prop, val);\r
-}}, "~S");\r
-Clazz.defineMethod (c$, "setProp", \r
-function (obj, prop, val) {\r
-return swingjs.api.DOMNode.setAttr (obj, prop, val);\r
-}, "swingjs.api.DOMNode,~S,~S");\r
-Clazz.overrideMethod (c$, "isObscured", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return false;\r
-});\r
-Clazz.overrideMethod (c$, "canDetermineObscurity", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return false;\r
-});\r
-Clazz.overrideMethod (c$, "setVisible", \r
-function (b) {\r
-swingjs.api.DOMNode.setStyles (this.outerNode, ["display", b ? "block" : "none"]);\r
-}, "~B");\r
-Clazz.overrideMethod (c$, "setEnabled", \r
-function (b) {\r
-if (this.enableNode != null) swingjs.api.DOMNode.setAttr (this.enableNode, "disabled", (b ? null : "TRUE"));\r
-}, "~B");\r
-Clazz.defineMethod (c$, "paint", \r
-function (g) {\r
-}, "java.awt.Graphics");\r
-Clazz.overrideMethod (c$, "repaint", \r
-function (tm, x, y, width, height) {\r
-}, "~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "print", \r
-function (g) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-}, "java.awt.Graphics");\r
-Clazz.overrideMethod (c$, "setBounds", \r
-function (x, y, width, height, op) {\r
-switch (op) {\r
-case 2:\r
-case 3:\r
-case 4:\r
-if (this.scrollerNode != null) {\r
-width = Math.min (width, this.scrollerNode.c.getWidth ());\r
-height = Math.min (height, this.scrollerNode.c.getHeight ());\r
-}System.out.println (this.id + " setBounds " + x + " " + y + " " + width + " " + height + " op=" + op);\r
-if (this.domNode != null) swingjs.api.DOMNode.setSize (this.domNode, width, height);\r
-break;\r
-}\r
-}, "~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "handleEvent", \r
-function (e) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-}, "java.awt.AWTEvent");\r
-Clazz.overrideMethod (c$, "coalescePaintEvent", \r
-function (e) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-}, "java.awt.event.PaintEvent");\r
-Clazz.overrideMethod (c$, "getLocationOnScreen", \r
-function () {\r
-var offset = this.$ (this.outerNode).offset ();\r
-return  new java.awt.Point (offset.left, offset.top);\r
-});\r
-Clazz.defineMethod (c$, "getPreferredSize", \r
-function () {\r
-return this.getPreferredSize (this.c);\r
-});\r
-Clazz.defineMethod (c$, "getMinimumSize", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return this.getPreferredSize (this.c);\r
-});\r
-Clazz.overrideMethod (c$, "getColorModel", \r
-function () {\r
-return java.awt.Toolkit.getDefaultToolkit ().getColorModel ();\r
-});\r
-Clazz.overrideMethod (c$, "getToolkit", \r
-function () {\r
-return java.awt.Toolkit.getDefaultToolkit ();\r
-});\r
-Clazz.overrideMethod (c$, "getGraphics", \r
-function () {\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "getFontMetrics", \r
-function (font) {\r
-return this.c.getFontMetrics (font);\r
-}, "java.awt.Font");\r
-Clazz.overrideMethod (c$, "dispose", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-});\r
-Clazz.overrideMethod (c$, "setForeground", \r
-function (color) {\r
-if (this.domNode != null) swingjs.api.DOMNode.setStyles (this.domNode, ["color", swingjs.JSToolkit.getCSSColor (color == null ? java.awt.Color.black : color)]);\r
-}, "java.awt.Color");\r
-Clazz.overrideMethod (c$, "setBackground", \r
-function (color) {\r
-if (this.domNode != null) swingjs.api.DOMNode.setStyles (this.domNode, ["background-color", swingjs.JSToolkit.getCSSColor (color == null ? java.awt.Color.white : color)]);\r
-}, "java.awt.Color");\r
-Clazz.overrideMethod (c$, "setFont", \r
-function (f) {\r
-if (this.domNode != null) this.setCssFont (this.domNode, f);\r
-}, "java.awt.Font");\r
-Clazz.overrideMethod (c$, "updateCursorImmediately", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-});\r
-Clazz.overrideMethod (c$, "requestFocus", \r
-function (lightweightChild, temporary, focusedWindowChangeAllowed, time, cause) {\r
-if (this.focusNode == null) return false;\r
-this.$ (this.focusNode).focus ();\r
-if (this.textNode != null) this.$ (this.textNode).select ();\r
-return true;\r
-}, "java.awt.Component,~B,~B,~N,jssun.awt.CausedFocusEvent.Cause");\r
-Clazz.overrideMethod (c$, "isFocusable", \r
-function () {\r
-return (this.focusNode != null);\r
-});\r
-Clazz.defineMethod (c$, "createImage", \r
-function (producer) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return null;\r
-}, "java.awt.image.ImageProducer");\r
-Clazz.defineMethod (c$, "createImage", \r
-function (width, height) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return null;\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "createVolatileImage", \r
-function (width, height) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return null;\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "prepareImage", \r
-function (img, w, h, o) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return false;\r
-}, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");\r
-Clazz.overrideMethod (c$, "checkImage", \r
-function (img, w, h, o) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return 0;\r
-}, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");\r
-Clazz.overrideMethod (c$, "getGraphicsConfiguration", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "handlesWheelScrolling", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return false;\r
-});\r
-Clazz.overrideMethod (c$, "getBackBuffer", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "destroyBuffers", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-});\r
-Clazz.overrideMethod (c$, "reparent", \r
-function (newContainer) {\r
-swingjs.JSToolkit.notImplemented ("");\r
-}, "java.awt.peer.ContainerPeer");\r
-Clazz.overrideMethod (c$, "isReparentSupported", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return false;\r
-});\r
-Clazz.overrideMethod (c$, "layout", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-});\r
-Clazz.overrideMethod (c$, "getBounds", \r
-function () {\r
-swingjs.JSToolkit.notImplemented ("");\r
-return null;\r
-});\r
-Clazz.defineMethod (c$, "hasFocus", \r
-function () {\r
-return this.focusNode != null && this.focusNode === swingjs.api.DOMNode.getAttr (this.document, "activeElement");\r
-});\r
-Clazz.defineMethod (c$, "notifyFocus", \r
-function (focusGained) {\r
-java.awt.Toolkit.getEventQueue ().postEvent ( new java.awt.event.FocusEvent (this.c, focusGained ? 1004 : 1005));\r
-}, "~B");\r
-Clazz.defineStatics (c$,\r
-"incr", 0);\r
-});\r
+Clazz.declarePackage ("swingjs.plaf");
+Clazz.load (["javax.swing.plaf.ComponentUI", "swingjs.plaf.JSEventHandler"], "swingjs.plaf.JSComponentUI", ["java.lang.IllegalArgumentException", "$.NullPointerException", "java.awt.Color", "$.Component", "$.Dimension", "$.Point", "$.Toolkit", "java.awt.event.FocusEvent", "swingjs.JSToolkit", "swingjs.api.DOMNode"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.id = null;
+this.c = null;
+this.outerNode = null;
+this.domNode = null;
+this.enableNode = null;
+this.textNode = null;
+this.valueNode = null;
+this.scrollNode = null;
+this.focusNode = null;
+this.components = null;
+this.num = 0;
+this.isTainted = true;
+this.x = 0;
+this.y = 0;
+this.preferredSize = null;
+this.isContainer = false;
+this.parent = null;
+this.currentText = null;
+this.scrollerNode = null;
+this.classID = null;
+this.document = null;
+this.body = null;
+this.needPreferred = false;
+Clazz.instantialize (this, arguments);
+}, swingjs.plaf, "JSComponentUI", javax.swing.plaf.ComponentUI, swingjs.plaf.JSEventHandler);
+Clazz.makeConstructor (c$, 
+function () {
+Clazz.superConstructor (this, swingjs.plaf.JSComponentUI, []);
+this.setDoc ();
+});
+Clazz.defineMethod (c$, "setDoc", 
+function () {
+{
+this.document = document;
+this.body = document.body;
+}});
+Clazz.overrideMethod (c$, "installUI", 
+function (c) {
+}, "javax.swing.JComponent");
+Clazz.overrideMethod (c$, "uninstallUI", 
+function (c) {
+this.uninstallJSUI ();
+}, "javax.swing.JComponent");
+Clazz.defineMethod (c$, "$", 
+function (node) {
+return swingjs.JSToolkit.getJQuery ().$ (node);
+}, "swingjs.api.DOMNode");
+Clazz.defineMethod (c$, "setTainted", 
+function () {
+this.isTainted = true;
+});
+Clazz.defineMethod (c$, "set", 
+function (target) {
+this.c = target;
+this.newID ();
+if (this.needPreferred) this.getPreferredSize (this.c);
+this.installJSUI ();
+return this;
+}, "javax.swing.JComponent");
+Clazz.defineMethod (c$, "newID", 
+function () {
+this.classID = this.c.getUIClassID ();
+if (this.id == null) {
+this.num = ++swingjs.plaf.JSComponentUI.incr;
+this.id = this.c.getHTMLName (this.classID) + "_" + this.num;
+}});
+Clazz.defineMethod (c$, "setCssFont", 
+function (obj, font) {
+if (font != null) {
+var istyle = font.getStyle ();
+var name = font.getFamily ();
+if (name === "Dialog") name = "Arial";
+swingjs.api.DOMNode.setStyles (obj, ["font-family", name, "font-size", font.getSize () + "px", "font-style", ((istyle & 2) == 0 ? "normal" : "italic"), "font-weight", ((istyle & 1) == 0 ? "normal" : "bold")]);
+}if (this.c.isBackgroundSet ()) this.setBackground (this.c.getBackground ());
+this.setForeground (this.c.getForeground ());
+return obj;
+}, "swingjs.api.DOMNode,java.awt.Font");
+Clazz.defineMethod (c$, "createDOMObject", 
+function (key, id, attr) {
+var obj = swingjs.api.DOMNode.createElement (key, id);
+for (var i = 0; i < attr.length; ) swingjs.api.DOMNode.setAttr (obj, attr[i++], attr[i++]);
+
+if (!this.c.isEnabled ()) this.setEnabled (false);
+return obj;
+}, "~S,~S,~A");
+Clazz.defineMethod (c$, "bindMouse", 
+function (node) {
+swingjs.api.DOMNode.setAttr (node, "data-UI", this);
+}, "swingjs.api.DOMNode");
+Clazz.overrideMethod (c$, "handleJSEvent", 
+function (target, eventType, jQueryEvent) {
+return false;
+}, "~O,~N,~O");
+Clazz.defineMethod (c$, "wrap", 
+function (type, id, elements) {
+return this.append (this.createDOMObject (type, id + type, []), elements);
+}, "~S,~S,~A");
+Clazz.defineMethod (c$, "append", 
+function (obj, elements) {
+for (var i = 0; i < elements.length; i++) {
+obj.appendChild (elements[i]);
+}
+return obj;
+}, "swingjs.api.DOMNode,~A");
+Clazz.defineMethod (c$, "debugDump", 
+function (d) {
+System.out.println (swingjs.api.DOMNode.getAttr (d, "outerHTML"));
+}, "swingjs.api.DOMNode");
+c$.vCenter = Clazz.defineMethod (c$, "vCenter", 
+function (obj, offset) {
+swingjs.api.DOMNode.setStyles (obj, ["top", "50%", "transform", "translateY(" + offset + "%)"]);
+}, "swingjs.api.DOMNode,~N");
+Clazz.defineMethod (c$, "setHTMLSize", 
+function (obj, addCSS) {
+return this.setHTMLSize1 (obj, addCSS, true);
+}, "swingjs.api.DOMNode,~B");
+Clazz.defineMethod (c$, "setHTMLSize1", 
+function (node, addCSS, usePreferred) {
+if (node == null) return null;
+var h;
+var w;
+var w0 = null;
+var h0 = null;
+var parentNode = null;
+if (this.scrollerNode != null) {
+w = this.scrollerNode.c.getWidth ();
+h = this.scrollerNode.c.getHeight ();
+} else if (usePreferred && this.preferredSize != null) {
+w = this.preferredSize.width;
+h = this.preferredSize.height;
+} else {
+parentNode = swingjs.api.DOMNode.remove (node);
+{
+w0 = node.style.width;
+h0 = node.style.height;
+}swingjs.api.DOMNode.setStyles (node, ["position", null, "width", null, "height", null]);
+var div;
+if (swingjs.api.DOMNode.getAttr (node, "tagName") === "DIV") div = node;
+ else div = this.wrap ("div", this.id + "_temp", [node]);
+swingjs.api.DOMNode.setStyles (div, ["position", "absolute"]);
+this.body.appendChild (div);
+w = Clazz.doubleToInt (Math.ceil (this.$ (div).width () + 0.5));
+h = Clazz.doubleToInt (Math.ceil (this.$ (div).height () + 0.5));
+this.body.removeChild (div);
+}var size = this.getCSSDimension (w, h);
+if (addCSS) {
+swingjs.api.DOMNode.setStyles (node, ["position", "absolute"]);
+swingjs.api.DOMNode.setSize (node, size.width, size.height);
+} else {
+swingjs.api.DOMNode.setStyles (node, ["position", null]);
+if (w0 != null) swingjs.api.DOMNode.setStyles (node, ["width", w0, "height", h0]);
+}if (parentNode != null) parentNode.appendChild (node);
+return size;
+}, "swingjs.api.DOMNode,~B,~B");
+Clazz.defineMethod (c$, "getCSSDimension", 
+function (w, h) {
+return  new java.awt.Dimension (w, h);
+}, "~N,~N");
+Clazz.defineMethod (c$, "setHTMLElement", 
+function () {
+if (!this.isTainted) return this.outerNode;
+var root = (this.isContainer ? this.c.getRootPane () : null);
+if (this.c === root) {
+this.isTainted = false;
+return this.outerNode;
+}this.domNode = this.getDOMObject ();
+if (this.outerNode == null) {
+this.outerNode = this.wrap ("div", this.id, [this.domNode]);
+if (root != null && root.getContentPane () === this.c) swingjs.JSToolkit.getHTML5Applet (this.c)._getContentLayer ().appendChild (this.outerNode);
+}swingjs.api.DOMNode.setStyles (this.outerNode, ["position", "absolute", "left", (this.x = this.c.getX ()) + "px", "top", (this.y = this.c.getY ()) + "px"]);
+if (this.isContainer) {
+System.out.println ("JSComponentUI container " + this.id + " " + this.c.getBounds ());
+swingjs.api.DOMNode.setSize (this.outerNode, this.c.getWidth (), this.c.getHeight ());
+var children = (this.components == null ? this.c.getComponents () : this.components);
+for (var i = children.length; --i >= 0; ) {
+var ui = swingjs.JSToolkit.getUI (children[i], false);
+if (ui == null) {
+continue;
+}if (ui.outerNode == null) ui.setHTMLElement ();
+if (ui.outerNode == null) {
+System.out.println ("JSCUI could not add " + ui.c.getName () + " to " + this.c.getName ());
+} else {
+this.outerNode.appendChild (ui.outerNode);
+}ui.parent = this;
+}
+}this.isTainted = false;
+return this.outerNode;
+});
+Clazz.defineMethod (c$, "getPreferredSize", 
+function (c) {
+var d = this.setHTMLSize (this.getDOMObject (), false);
+return d;
+}, "javax.swing.JComponent");
+Clazz.defineMethod (c$, "paint", 
+function (g, c) {
+if (c.isOpaque ()) {
+g.setColor (c.getBackground ());
+g.fillRect (0, 0, c.getWidth (), c.getHeight ());
+}}, "java.awt.Graphics,javax.swing.JComponent");
+Clazz.overrideMethod (c$, "update", 
+function (g, c) {
+var testing = false;
+if (testing) {
+g.setColor (java.awt.Color.red);
+g.drawRect (0, 0, c.getWidth (), c.getHeight ());
+System.out.println ("drawing " + c.getWidth () + " " + c.getHeight ());
+}this.setHTMLElement ();
+this.paint (g, c);
+}, "java.awt.Graphics,javax.swing.JComponent");
+Clazz.defineMethod (c$, "getMinimumSize", 
+function (c) {
+return this.getPreferredSize (c);
+}, "javax.swing.JComponent");
+Clazz.overrideMethod (c$, "getMaximumSize", 
+function (c) {
+return null;
+}, "javax.swing.JComponent");
+Clazz.overrideMethod (c$, "contains", 
+function (c, x, y) {
+return c.inside (x, y);
+}, "javax.swing.JComponent,~N,~N");
+c$.createUI = Clazz.overrideMethod (c$, "createUI", 
+function (c) {
+return null;
+}, "javax.swing.JComponent");
+Clazz.overrideMethod (c$, "getBaseline", 
+function (c, width, height) {
+if (c == null) {
+throw  new NullPointerException ("Component must be non-null");
+}if (width < 0 || height < 0) {
+throw  new IllegalArgumentException ("Width and height must be >= 0");
+}return -1;
+}, "javax.swing.JComponent,~N,~N");
+Clazz.overrideMethod (c$, "getBaselineResizeBehavior", 
+function (c) {
+if (c == null) {
+throw  new NullPointerException ("Component must be non-null");
+}return java.awt.Component.BaselineResizeBehavior.OTHER;
+}, "javax.swing.JComponent");
+Clazz.defineMethod (c$, "getJSTextValue", 
+function () {
+return swingjs.api.DOMNode.getAttr (this.domNode, this.valueNode == null ? "innerHTML" : "value");
+});
+Clazz.defineMethod (c$, "notifyPropertyChanged", 
+function (prop) {
+var obj = null;
+var val = null;
+if (prop === "text") {
+val = (this.c).getText ();
+if (val.equals (this.currentText)) return;
+this.currentText = val;
+if (this.textNode != null) {
+prop = "innerHTML";
+obj = this.textNode;
+} else if (this.valueNode != null) {
+prop = "value";
+obj = this.valueNode;
+}} else if (prop === "preferredSize") {
+this.preferredSize = this.c.getPreferredSize ();
+this.getPreferredSize ();
+return;
+}if (obj == null) {
+System.out.println ("JSComponentUI: unrecognized prop: " + prop);
+} else {
+System.out.println ("JSComponentUI: setting " + this.id + " " + prop);
+this.setProp (obj, prop, val);
+}}, "~S");
+Clazz.defineMethod (c$, "setProp", 
+function (obj, prop, val) {
+return swingjs.api.DOMNode.setAttr (obj, prop, val);
+}, "swingjs.api.DOMNode,~S,~S");
+Clazz.overrideMethod (c$, "isObscured", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return false;
+});
+Clazz.overrideMethod (c$, "canDetermineObscurity", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return false;
+});
+Clazz.overrideMethod (c$, "setVisible", 
+function (b) {
+swingjs.api.DOMNode.setStyles (this.outerNode, ["display", b ? "block" : "none"]);
+}, "~B");
+Clazz.overrideMethod (c$, "setEnabled", 
+function (b) {
+if (this.enableNode != null) swingjs.api.DOMNode.setAttr (this.enableNode, "disabled", (b ? null : "TRUE"));
+}, "~B");
+Clazz.defineMethod (c$, "paint", 
+function (g) {
+}, "java.awt.Graphics");
+Clazz.overrideMethod (c$, "repaint", 
+function (tm, x, y, width, height) {
+}, "~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "print", 
+function (g) {
+swingjs.JSToolkit.notImplemented ("");
+}, "java.awt.Graphics");
+Clazz.overrideMethod (c$, "setBounds", 
+function (x, y, width, height, op) {
+switch (op) {
+case 2:
+case 3:
+case 4:
+if (this.scrollerNode != null) {
+width = Math.min (width, this.scrollerNode.c.getWidth ());
+height = Math.min (height, this.scrollerNode.c.getHeight ());
+}System.out.println (this.id + " setBounds " + x + " " + y + " " + width + " " + height + " op=" + op);
+if (this.domNode != null) swingjs.api.DOMNode.setSize (this.domNode, width, height);
+break;
+}
+}, "~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "handleEvent", 
+function (e) {
+swingjs.JSToolkit.notImplemented ("");
+}, "java.awt.AWTEvent");
+Clazz.overrideMethod (c$, "coalescePaintEvent", 
+function (e) {
+swingjs.JSToolkit.notImplemented ("");
+}, "java.awt.event.PaintEvent");
+Clazz.overrideMethod (c$, "getLocationOnScreen", 
+function () {
+var offset = this.$ (this.outerNode).offset ();
+return  new java.awt.Point (offset.left, offset.top);
+});
+Clazz.defineMethod (c$, "getPreferredSize", 
+function () {
+return this.getPreferredSize (this.c);
+});
+Clazz.defineMethod (c$, "getMinimumSize", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return this.getPreferredSize (this.c);
+});
+Clazz.overrideMethod (c$, "getColorModel", 
+function () {
+return java.awt.Toolkit.getDefaultToolkit ().getColorModel ();
+});
+Clazz.overrideMethod (c$, "getToolkit", 
+function () {
+return java.awt.Toolkit.getDefaultToolkit ();
+});
+Clazz.overrideMethod (c$, "getGraphics", 
+function () {
+return null;
+});
+Clazz.overrideMethod (c$, "getFontMetrics", 
+function (font) {
+return this.c.getFontMetrics (font);
+}, "java.awt.Font");
+Clazz.overrideMethod (c$, "dispose", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+});
+Clazz.overrideMethod (c$, "setForeground", 
+function (color) {
+if (this.domNode != null) swingjs.api.DOMNode.setStyles (this.domNode, ["color", swingjs.JSToolkit.getCSSColor (color == null ? java.awt.Color.black : color)]);
+}, "java.awt.Color");
+Clazz.overrideMethod (c$, "setBackground", 
+function (color) {
+if (this.domNode != null) swingjs.api.DOMNode.setStyles (this.domNode, ["background-color", swingjs.JSToolkit.getCSSColor (color == null ? java.awt.Color.white : color)]);
+}, "java.awt.Color");
+Clazz.overrideMethod (c$, "setFont", 
+function (f) {
+if (this.domNode != null) this.setCssFont (this.domNode, f);
+}, "java.awt.Font");
+Clazz.overrideMethod (c$, "updateCursorImmediately", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+});
+Clazz.overrideMethod (c$, "requestFocus", 
+function (lightweightChild, temporary, focusedWindowChangeAllowed, time, cause) {
+if (this.focusNode == null) return false;
+this.$ (this.focusNode).focus ();
+if (this.textNode != null) this.$ (this.textNode).select ();
+return true;
+}, "java.awt.Component,~B,~B,~N,jssun.awt.CausedFocusEvent.Cause");
+Clazz.overrideMethod (c$, "isFocusable", 
+function () {
+return (this.focusNode != null);
+});
+Clazz.defineMethod (c$, "createImage", 
+function (producer) {
+swingjs.JSToolkit.notImplemented ("");
+return null;
+}, "java.awt.image.ImageProducer");
+Clazz.defineMethod (c$, "createImage", 
+function (width, height) {
+swingjs.JSToolkit.notImplemented ("");
+return null;
+}, "~N,~N");
+Clazz.overrideMethod (c$, "createVolatileImage", 
+function (width, height) {
+swingjs.JSToolkit.notImplemented ("");
+return null;
+}, "~N,~N");
+Clazz.overrideMethod (c$, "prepareImage", 
+function (img, w, h, o) {
+swingjs.JSToolkit.notImplemented ("");
+return false;
+}, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");
+Clazz.overrideMethod (c$, "checkImage", 
+function (img, w, h, o) {
+swingjs.JSToolkit.notImplemented ("");
+return 0;
+}, "java.awt.Image,~N,~N,java.awt.image.ImageObserver");
+Clazz.overrideMethod (c$, "getGraphicsConfiguration", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return null;
+});
+Clazz.overrideMethod (c$, "handlesWheelScrolling", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return false;
+});
+Clazz.overrideMethod (c$, "getBackBuffer", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return null;
+});
+Clazz.overrideMethod (c$, "destroyBuffers", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+});
+Clazz.overrideMethod (c$, "reparent", 
+function (newContainer) {
+swingjs.JSToolkit.notImplemented ("");
+}, "java.awt.peer.ContainerPeer");
+Clazz.overrideMethod (c$, "isReparentSupported", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return false;
+});
+Clazz.overrideMethod (c$, "layout", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+});
+Clazz.overrideMethod (c$, "getBounds", 
+function () {
+swingjs.JSToolkit.notImplemented ("");
+return null;
+});
+Clazz.defineMethod (c$, "hasFocus", 
+function () {
+return this.focusNode != null && this.focusNode === swingjs.api.DOMNode.getAttr (this.document, "activeElement");
+});
+Clazz.defineMethod (c$, "notifyFocus", 
+function (focusGained) {
+java.awt.Toolkit.getEventQueue ().postEvent ( new java.awt.event.FocusEvent (this.c, focusGained ? 1004 : 1005));
+}, "~B");
+Clazz.defineStatics (c$,
+"incr", 0);
+});