X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2Ftree%2FAbstractLayoutCache.js;fp=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2Ftree%2FAbstractLayoutCache.js;h=fbd556d882a28d5814b2414374e850f703e94103;hb=4231d40261fef32ce4570a6bbad0d35df44e8baf;hp=0000000000000000000000000000000000000000;hpb=c07eb2c5794833bd0241000d6844d783fe10cb82;p=jalview.git diff --git a/site/swingjs/j2s/javax/swing/tree/AbstractLayoutCache.js b/site/swingjs/j2s/javax/swing/tree/AbstractLayoutCache.js new file mode 100644 index 0000000..fbd556d --- /dev/null +++ b/site/swingjs/j2s/javax/swing/tree/AbstractLayoutCache.js @@ -0,0 +1,115 @@ +Clazz.declarePackage ("javax.swing.tree"); +Clazz.load (["javax.swing.tree.RowMapper"], "javax.swing.tree.AbstractLayoutCache", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.nodeDimensions = null; +this.treeModel = null; +this.treeSelectionModel = null; +this.rootVisible = false; +this.rowHeight = 0; +Clazz.instantialize (this, arguments); +}, javax.swing.tree, "AbstractLayoutCache", null, javax.swing.tree.RowMapper); +Clazz.defineMethod (c$, "setNodeDimensions", +function (nd) { +this.nodeDimensions = nd; +}, "javax.swing.tree.AbstractLayoutCache.NodeDimensions"); +Clazz.defineMethod (c$, "getNodeDimensions", +function () { +return this.nodeDimensions; +}); +Clazz.defineMethod (c$, "setModel", +function (newModel) { +this.treeModel = newModel; +}, "javax.swing.tree.TreeModel"); +Clazz.defineMethod (c$, "getModel", +function () { +return this.treeModel; +}); +Clazz.defineMethod (c$, "setRootVisible", +function (rootVisible) { +this.rootVisible = rootVisible; +}, "~B"); +Clazz.defineMethod (c$, "isRootVisible", +function () { +return this.rootVisible; +}); +Clazz.defineMethod (c$, "setRowHeight", +function (rowHeight) { +this.rowHeight = rowHeight; +}, "~N"); +Clazz.defineMethod (c$, "getRowHeight", +function () { +return this.rowHeight; +}); +Clazz.defineMethod (c$, "setSelectionModel", +function (newLSM) { +if (this.treeSelectionModel != null) this.treeSelectionModel.setRowMapper (null); +this.treeSelectionModel = newLSM; +if (this.treeSelectionModel != null) this.treeSelectionModel.setRowMapper (this); +}, "javax.swing.tree.TreeSelectionModel"); +Clazz.defineMethod (c$, "getSelectionModel", +function () { +return this.treeSelectionModel; +}); +Clazz.defineMethod (c$, "getPreferredHeight", +function () { +var rowCount = this.getRowCount (); +if (rowCount > 0) { +var bounds = this.getBounds (this.getPathForRow (rowCount - 1), null); +if (bounds != null) return bounds.y + bounds.height; +}return 0; +}); +Clazz.defineMethod (c$, "getPreferredWidth", +function (bounds) { +var rowCount = this.getRowCount (); +if (rowCount > 0) { +var firstPath; +var endY; +if (bounds == null) { +firstPath = this.getPathForRow (0); +endY = 2147483647; +} else { +firstPath = this.getPathClosestTo (bounds.x, bounds.y); +endY = bounds.height + bounds.y; +}var paths = this.getVisiblePathsFrom (firstPath); +if (paths != null && paths.hasMoreElements ()) { +var pBounds = this.getBounds (paths.nextElement (), null); +var width; +if (pBounds != null) { +width = pBounds.x + pBounds.width; +if (pBounds.y >= endY) { +return width; +}} else width = 0; +while (pBounds != null && paths.hasMoreElements ()) { +pBounds = this.getBounds (paths.nextElement (), pBounds); +if (pBounds != null && pBounds.y < endY) { +width = Math.max (width, pBounds.x + pBounds.width); +} else { +pBounds = null; +}} +return width; +}}return 0; +}, "java.awt.Rectangle"); +Clazz.overrideMethod (c$, "getRowsForPaths", +function (paths) { +if (paths == null) return null; +var numPaths = paths.length; +var rows = Clazz.newIntArray (numPaths, 0); +for (var counter = 0; counter < numPaths; counter++) rows[counter] = this.getRowForPath (paths[counter]); + +return rows; +}, "~A"); +Clazz.defineMethod (c$, "getNodeDimensions", +function (value, row, depth, expanded, placeIn) { +var nd = this.getNodeDimensions (); +if (nd != null) { +return nd.getNodeDimensions (value, row, depth, expanded, placeIn); +}return null; +}, "~O,~N,~N,~B,java.awt.Rectangle"); +Clazz.defineMethod (c$, "isFixedRowHeight", +function () { +return (this.rowHeight > 0); +}); +Clazz.pu$h(self.c$); +c$ = Clazz.declareType (javax.swing.tree.AbstractLayoutCache, "NodeDimensions"); +c$ = Clazz.p0p (); +});