1 Clazz.declarePackage ("javax.swing.tree");
2 Clazz.load (["javax.swing.tree.RowMapper"], "javax.swing.tree.AbstractLayoutCache", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.nodeDimensions = null;
6 this.treeSelectionModel = null;
7 this.rootVisible = false;
9 Clazz.instantialize (this, arguments);
10 }, javax.swing.tree, "AbstractLayoutCache", null, javax.swing.tree.RowMapper);
11 Clazz.defineMethod (c$, "setNodeDimensions",
13 this.nodeDimensions = nd;
14 }, "javax.swing.tree.AbstractLayoutCache.NodeDimensions");
15 Clazz.defineMethod (c$, "getNodeDimensions",
17 return this.nodeDimensions;
19 Clazz.defineMethod (c$, "setModel",
21 this.treeModel = newModel;
22 }, "javax.swing.tree.TreeModel");
23 Clazz.defineMethod (c$, "getModel",
25 return this.treeModel;
27 Clazz.defineMethod (c$, "setRootVisible",
28 function (rootVisible) {
29 this.rootVisible = rootVisible;
31 Clazz.defineMethod (c$, "isRootVisible",
33 return this.rootVisible;
35 Clazz.defineMethod (c$, "setRowHeight",
36 function (rowHeight) {
37 this.rowHeight = rowHeight;
39 Clazz.defineMethod (c$, "getRowHeight",
41 return this.rowHeight;
43 Clazz.defineMethod (c$, "setSelectionModel",
45 if (this.treeSelectionModel != null) this.treeSelectionModel.setRowMapper (null);
46 this.treeSelectionModel = newLSM;
47 if (this.treeSelectionModel != null) this.treeSelectionModel.setRowMapper (this);
48 }, "javax.swing.tree.TreeSelectionModel");
49 Clazz.defineMethod (c$, "getSelectionModel",
51 return this.treeSelectionModel;
53 Clazz.defineMethod (c$, "getPreferredHeight",
55 var rowCount = this.getRowCount ();
57 var bounds = this.getBounds (this.getPathForRow (rowCount - 1), null);
58 if (bounds != null) return bounds.y + bounds.height;
61 Clazz.defineMethod (c$, "getPreferredWidth",
63 var rowCount = this.getRowCount ();
68 firstPath = this.getPathForRow (0);
71 firstPath = this.getPathClosestTo (bounds.x, bounds.y);
72 endY = bounds.height + bounds.y;
73 }var paths = this.getVisiblePathsFrom (firstPath);
74 if (paths != null && paths.hasMoreElements ()) {
75 var pBounds = this.getBounds (paths.nextElement (), null);
77 if (pBounds != null) {
78 width = pBounds.x + pBounds.width;
79 if (pBounds.y >= endY) {
82 while (pBounds != null && paths.hasMoreElements ()) {
83 pBounds = this.getBounds (paths.nextElement (), pBounds);
84 if (pBounds != null && pBounds.y < endY) {
85 width = Math.max (width, pBounds.x + pBounds.width);
91 }, "java.awt.Rectangle");
92 Clazz.overrideMethod (c$, "getRowsForPaths",
94 if (paths == null) return null;
95 var numPaths = paths.length;
96 var rows = Clazz.newIntArray (numPaths, 0);
97 for (var counter = 0; counter < numPaths; counter++) rows[counter] = this.getRowForPath (paths[counter]);
101 Clazz.defineMethod (c$, "getNodeDimensions",
102 function (value, row, depth, expanded, placeIn) {
103 var nd = this.getNodeDimensions ();
105 return nd.getNodeDimensions (value, row, depth, expanded, placeIn);
107 }, "~O,~N,~N,~B,java.awt.Rectangle");
108 Clazz.defineMethod (c$, "isFixedRowHeight",
110 return (this.rowHeight > 0);
113 c$ = Clazz.declareType (javax.swing.tree.AbstractLayoutCache, "NodeDimensions");