JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / javax / swing / tree / AbstractLayoutCache.js
1 Clazz.declarePackage ("javax.swing.tree");\r
2 Clazz.load (["javax.swing.tree.RowMapper"], "javax.swing.tree.AbstractLayoutCache", null, function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.nodeDimensions = null;\r
5 this.treeModel = null;\r
6 this.treeSelectionModel = null;\r
7 this.rootVisible = false;\r
8 this.rowHeight = 0;\r
9 Clazz.instantialize (this, arguments);\r
10 }, javax.swing.tree, "AbstractLayoutCache", null, javax.swing.tree.RowMapper);\r
11 Clazz.defineMethod (c$, "setNodeDimensions", \r
12 function (nd) {\r
13 this.nodeDimensions = nd;\r
14 }, "javax.swing.tree.AbstractLayoutCache.NodeDimensions");\r
15 Clazz.defineMethod (c$, "getNodeDimensions", \r
16 function () {\r
17 return this.nodeDimensions;\r
18 });\r
19 Clazz.defineMethod (c$, "setModel", \r
20 function (newModel) {\r
21 this.treeModel = newModel;\r
22 }, "javax.swing.tree.TreeModel");\r
23 Clazz.defineMethod (c$, "getModel", \r
24 function () {\r
25 return this.treeModel;\r
26 });\r
27 Clazz.defineMethod (c$, "setRootVisible", \r
28 function (rootVisible) {\r
29 this.rootVisible = rootVisible;\r
30 }, "~B");\r
31 Clazz.defineMethod (c$, "isRootVisible", \r
32 function () {\r
33 return this.rootVisible;\r
34 });\r
35 Clazz.defineMethod (c$, "setRowHeight", \r
36 function (rowHeight) {\r
37 this.rowHeight = rowHeight;\r
38 }, "~N");\r
39 Clazz.defineMethod (c$, "getRowHeight", \r
40 function () {\r
41 return this.rowHeight;\r
42 });\r
43 Clazz.defineMethod (c$, "setSelectionModel", \r
44 function (newLSM) {\r
45 if (this.treeSelectionModel != null) this.treeSelectionModel.setRowMapper (null);\r
46 this.treeSelectionModel = newLSM;\r
47 if (this.treeSelectionModel != null) this.treeSelectionModel.setRowMapper (this);\r
48 }, "javax.swing.tree.TreeSelectionModel");\r
49 Clazz.defineMethod (c$, "getSelectionModel", \r
50 function () {\r
51 return this.treeSelectionModel;\r
52 });\r
53 Clazz.defineMethod (c$, "getPreferredHeight", \r
54 function () {\r
55 var rowCount = this.getRowCount ();\r
56 if (rowCount > 0) {\r
57 var bounds = this.getBounds (this.getPathForRow (rowCount - 1), null);\r
58 if (bounds != null) return bounds.y + bounds.height;\r
59 }return 0;\r
60 });\r
61 Clazz.defineMethod (c$, "getPreferredWidth", \r
62 function (bounds) {\r
63 var rowCount = this.getRowCount ();\r
64 if (rowCount > 0) {\r
65 var firstPath;\r
66 var endY;\r
67 if (bounds == null) {\r
68 firstPath = this.getPathForRow (0);\r
69 endY = 2147483647;\r
70 } else {\r
71 firstPath = this.getPathClosestTo (bounds.x, bounds.y);\r
72 endY = bounds.height + bounds.y;\r
73 }var paths = this.getVisiblePathsFrom (firstPath);\r
74 if (paths != null && paths.hasMoreElements ()) {\r
75 var pBounds = this.getBounds (paths.nextElement (), null);\r
76 var width;\r
77 if (pBounds != null) {\r
78 width = pBounds.x + pBounds.width;\r
79 if (pBounds.y >= endY) {\r
80 return width;\r
81 }} else width = 0;\r
82 while (pBounds != null && paths.hasMoreElements ()) {\r
83 pBounds = this.getBounds (paths.nextElement (), pBounds);\r
84 if (pBounds != null && pBounds.y < endY) {\r
85 width = Math.max (width, pBounds.x + pBounds.width);\r
86 } else {\r
87 pBounds = null;\r
88 }}\r
89 return width;\r
90 }}return 0;\r
91 }, "java.awt.Rectangle");\r
92 Clazz.overrideMethod (c$, "getRowsForPaths", \r
93 function (paths) {\r
94 if (paths == null) return null;\r
95 var numPaths = paths.length;\r
96 var rows =  Clazz.newIntArray (numPaths, 0);\r
97 for (var counter = 0; counter < numPaths; counter++) rows[counter] = this.getRowForPath (paths[counter]);\r
98 \r
99 return rows;\r
100 }, "~A");\r
101 Clazz.defineMethod (c$, "getNodeDimensions", \r
102 function (value, row, depth, expanded, placeIn) {\r
103 var nd = this.getNodeDimensions ();\r
104 if (nd != null) {\r
105 return nd.getNodeDimensions (value, row, depth, expanded, placeIn);\r
106 }return null;\r
107 }, "~O,~N,~N,~B,java.awt.Rectangle");\r
108 Clazz.defineMethod (c$, "isFixedRowHeight", \r
109 function () {\r
110 return (this.rowHeight > 0);\r
111 });\r
112 Clazz.pu$h(self.c$);\r
113 c$ = Clazz.declareType (javax.swing.tree.AbstractLayoutCache, "NodeDimensions");\r
114 c$ = Clazz.p0p ();\r
115 });\r