JAL-1807
[jalview.git] / site / j2s / swingjs / plaf / JSScrollPaneUI.js
diff --git a/site/j2s/swingjs/plaf/JSScrollPaneUI.js b/site/j2s/swingjs/plaf/JSScrollPaneUI.js
new file mode 100644 (file)
index 0000000..26ae222
--- /dev/null
@@ -0,0 +1,45 @@
+Clazz.declarePackage ("swingjs.plaf");
+Clazz.load (["swingjs.plaf.JSComponentUI"], "swingjs.plaf.JSScrollPaneUI", ["swingjs.JSToolkit", "swingjs.api.DOMNode"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.scrolledComponent = null;
+this.scrollpane = null;
+this.viewport = null;
+this.scrolledUI = null;
+Clazz.instantialize (this, arguments);
+}, swingjs.plaf, "JSScrollPaneUI", swingjs.plaf.JSComponentUI);
+Clazz.overrideMethod (c$, "getDOMObject", 
+function () {
+this.isContainer = true;
+this.scrollpane = this.c;
+if (this.domNode == null) {
+this.domNode = this.createDOMObject ("div", this.id, []);
+}var v = this.scrollpane.getViewport ();
+if (v != null) {
+this.viewport = v;
+System.out.println ("JSScrollPaneUI v=" + v);
+var sc = null;
+try {
+sc = v.getComponent (0);
+} catch (e) {
+if (Clazz.exceptionOf (e, Exception)) {
+} else {
+throw e;
+}
+}
+if (sc != null && sc !== this.scrolledComponent) {
+this.scrolledComponent = sc;
+this.scrolledUI = swingjs.JSToolkit.getUI (sc, false);
+this.scrollNode = this.scrolledUI.outerNode;
+if (this.scrollNode == null) this.scrollNode = this.scrolledUI.setHTMLElement ();
+swingjs.api.DOMNode.setSize (this.scrollNode, this.c.getWidth (), this.c.getHeight ());
+this.scrolledUI.scrollerNode = this;
+this.components =  Clazz.newArray (-1, [this.scrolledComponent]);
+}}return this.domNode;
+});
+Clazz.overrideMethod (c$, "installJSUI", 
+function () {
+});
+Clazz.overrideMethod (c$, "uninstallJSUI", 
+function () {
+});
+});