JAL-1807 Bob
[jalviewjs.git] / site / j2s / swingjs / plaf / JSScrollPaneUI.js
1 Clazz.declarePackage ("swingjs.plaf");
2 Clazz.load (["swingjs.plaf.JSComponentUI"], "swingjs.plaf.JSScrollPaneUI", ["swingjs.JSToolkit", "swingjs.api.DOMNode"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.scrolledComponent = null;
5 this.scrollpane = null;
6 this.viewport = null;
7 this.scrolledUI = null;
8 Clazz.instantialize (this, arguments);
9 }, swingjs.plaf, "JSScrollPaneUI", swingjs.plaf.JSComponentUI);
10 Clazz.overrideMethod (c$, "getDOMObject", 
11 function () {
12 this.isContainer = true;
13 this.scrollpane = this.c;
14 if (this.domNode == null) {
15 this.domNode = this.createDOMObject ("div", this.id, []);
16 }var v = this.scrollpane.getViewport ();
17 if (v != null) {
18 this.viewport = v;
19 System.out.println ("JSScrollPaneUI v=" + v);
20 var sc = null;
21 try {
22 sc = v.getComponent (0);
23 } catch (e) {
24 if (Clazz.exceptionOf (e, Exception)) {
25 } else {
26 throw e;
27 }
28 }
29 if (sc != null && sc !== this.scrolledComponent) {
30 this.scrolledComponent = sc;
31 this.scrolledUI = swingjs.JSToolkit.getUI (sc, false);
32 this.scrollNode = this.scrolledUI.outerNode;
33 if (this.scrollNode == null) this.scrollNode = this.scrolledUI.setHTMLElement ();
34 swingjs.api.DOMNode.setSize (this.scrollNode, this.c.getWidth (), this.c.getHeight ());
35 this.scrolledUI.scrollerNode = this;
36 this.components =  Clazz.newArray (-1, [this.scrolledComponent]);
37 }}return this.domNode;
38 });
39 Clazz.overrideMethod (c$, "installJSUI", 
40 function () {
41 });
42 Clazz.overrideMethod (c$, "uninstallJSUI", 
43 function () {
44 });
45 });