X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjavax%2Fswing%2Ftree%2FTreePath.js;fp=site%2Fj2s%2Fjavax%2Fswing%2Ftree%2FTreePath.js;h=22b8dd7c31579a66d209137fb06a7036726852a3;hp=f63c650f42d1f2f945efe6c88fa43032772d1d0e;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/javax/swing/tree/TreePath.js b/site/j2s/javax/swing/tree/TreePath.js index f63c650..22b8dd7 100644 --- a/site/j2s/javax/swing/tree/TreePath.js +++ b/site/j2s/javax/swing/tree/TreePath.js @@ -1,114 +1,114 @@ -Clazz.declarePackage ("javax.swing.tree"); -Clazz.load (null, "javax.swing.tree.TreePath", ["java.lang.IllegalArgumentException", "$.NullPointerException", "$.StringBuffer"], function () { -c$ = Clazz.decorateAsClass (function () { -this.parentPath = null; -this.lastPathComponent = null; -Clazz.instantialize (this, arguments); -}, javax.swing.tree, "TreePath"); -Clazz.makeConstructor (c$, -function (path) { -if (path == null || path.length == 0) throw new IllegalArgumentException ("path in TreePath must be non null and not empty."); -this.lastPathComponent = path[path.length - 1]; -if (path.length > 1) this.parentPath = new javax.swing.tree.TreePath (path, path.length - 1); -}, "~A"); -Clazz.makeConstructor (c$, -function (singlePath) { -if (singlePath == null) throw new IllegalArgumentException ("path in TreePath must be non null."); -this.lastPathComponent = singlePath; -this.parentPath = null; -}, "~O"); -Clazz.makeConstructor (c$, -function (parent, lastElement) { -if (lastElement == null) throw new IllegalArgumentException ("path in TreePath must be non null."); -this.parentPath = parent; -this.lastPathComponent = lastElement; -}, "javax.swing.tree.TreePath,~O"); -Clazz.makeConstructor (c$, -function (path, length) { -this.lastPathComponent = path[length - 1]; -if (length > 1) this.parentPath = new javax.swing.tree.TreePath (path, length - 1); -}, "~A,~N"); -Clazz.makeConstructor (c$, -function () { -}); -Clazz.defineMethod (c$, "getPath", -function () { -var i = this.getPathCount (); -var result = new Array (i--); -for (var path = this; path != null; path = path.parentPath) { -result[i--] = path.lastPathComponent; -} -return result; -}); -Clazz.defineMethod (c$, "getLastPathComponent", -function () { -return this.lastPathComponent; -}); -Clazz.defineMethod (c$, "getPathCount", -function () { -var result = 0; -for (var path = this; path != null; path = path.parentPath) { -result++; -} -return result; -}); -Clazz.defineMethod (c$, "getPathComponent", -function (element) { -var pathLength = this.getPathCount (); -if (element < 0 || element >= pathLength) throw new IllegalArgumentException ("Index " + element + " is out of the specified range"); -var path = this; -for (var i = pathLength - 1; i != element; i--) { -path = path.parentPath; -} -return path.lastPathComponent; -}, "~N"); -Clazz.defineMethod (c$, "equals", -function (o) { -if (o === this) return true; -if (Clazz.instanceOf (o, javax.swing.tree.TreePath)) { -var oTreePath = o; -if (this.getPathCount () != oTreePath.getPathCount ()) return false; -for (var path = this; path != null; path = path.parentPath) { -if (!(path.lastPathComponent.equals (oTreePath.lastPathComponent))) { -return false; -}oTreePath = oTreePath.parentPath; -} -return true; -}return false; -}, "~O"); -Clazz.defineMethod (c$, "hashCode", -function () { -return this.lastPathComponent.hashCode (); -}); -Clazz.defineMethod (c$, "isDescendant", -function (aTreePath) { -if (aTreePath === this) return true; -if (aTreePath != null) { -var pathLength = this.getPathCount (); -var oPathLength = aTreePath.getPathCount (); -if (oPathLength < pathLength) return false; -while (oPathLength-- > pathLength) aTreePath = aTreePath.getParentPath (); - -return this.equals (aTreePath); -}return false; -}, "javax.swing.tree.TreePath"); -Clazz.defineMethod (c$, "pathByAddingChild", -function (child) { -if (child == null) throw new NullPointerException ("Null child not allowed"); -return new javax.swing.tree.TreePath (this, child); -}, "~O"); -Clazz.defineMethod (c$, "getParentPath", -function () { -return this.parentPath; -}); -Clazz.overrideMethod (c$, "toString", -function () { -var tempSpot = new StringBuffer ("["); -for (var counter = 0, maxCounter = this.getPathCount (); counter < maxCounter; counter++) { -if (counter > 0) tempSpot.append (", "); -tempSpot.append (this.getPathComponent (counter)); -} -tempSpot.append ("]"); -return tempSpot.toString (); -}); -}); +Clazz.declarePackage ("javax.swing.tree"); +Clazz.load (null, "javax.swing.tree.TreePath", ["java.lang.IllegalArgumentException", "$.NullPointerException", "$.StringBuffer"], function () { +c$ = Clazz.decorateAsClass (function () { +this.parentPath = null; +this.lastPathComponent = null; +Clazz.instantialize (this, arguments); +}, javax.swing.tree, "TreePath"); +Clazz.makeConstructor (c$, +function (path) { +if (path == null || path.length == 0) throw new IllegalArgumentException ("path in TreePath must be non null and not empty."); +this.lastPathComponent = path[path.length - 1]; +if (path.length > 1) this.parentPath = new javax.swing.tree.TreePath (path, path.length - 1); +}, "~A"); +Clazz.makeConstructor (c$, +function (singlePath) { +if (singlePath == null) throw new IllegalArgumentException ("path in TreePath must be non null."); +this.lastPathComponent = singlePath; +this.parentPath = null; +}, "~O"); +Clazz.makeConstructor (c$, +function (parent, lastElement) { +if (lastElement == null) throw new IllegalArgumentException ("path in TreePath must be non null."); +this.parentPath = parent; +this.lastPathComponent = lastElement; +}, "javax.swing.tree.TreePath,~O"); +Clazz.makeConstructor (c$, +function (path, length) { +this.lastPathComponent = path[length - 1]; +if (length > 1) this.parentPath = new javax.swing.tree.TreePath (path, length - 1); +}, "~A,~N"); +Clazz.makeConstructor (c$, +function () { +}); +Clazz.defineMethod (c$, "getPath", +function () { +var i = this.getPathCount (); +var result = new Array (i--); +for (var path = this; path != null; path = path.parentPath) { +result[i--] = path.lastPathComponent; +} +return result; +}); +Clazz.defineMethod (c$, "getLastPathComponent", +function () { +return this.lastPathComponent; +}); +Clazz.defineMethod (c$, "getPathCount", +function () { +var result = 0; +for (var path = this; path != null; path = path.parentPath) { +result++; +} +return result; +}); +Clazz.defineMethod (c$, "getPathComponent", +function (element) { +var pathLength = this.getPathCount (); +if (element < 0 || element >= pathLength) throw new IllegalArgumentException ("Index " + element + " is out of the specified range"); +var path = this; +for (var i = pathLength - 1; i != element; i--) { +path = path.parentPath; +} +return path.lastPathComponent; +}, "~N"); +Clazz.defineMethod (c$, "equals", +function (o) { +if (o === this) return true; +if (Clazz.instanceOf (o, javax.swing.tree.TreePath)) { +var oTreePath = o; +if (this.getPathCount () != oTreePath.getPathCount ()) return false; +for (var path = this; path != null; path = path.parentPath) { +if (!(path.lastPathComponent.equals (oTreePath.lastPathComponent))) { +return false; +}oTreePath = oTreePath.parentPath; +} +return true; +}return false; +}, "~O"); +Clazz.defineMethod (c$, "hashCode", +function () { +return this.lastPathComponent.hashCode (); +}); +Clazz.defineMethod (c$, "isDescendant", +function (aTreePath) { +if (aTreePath === this) return true; +if (aTreePath != null) { +var pathLength = this.getPathCount (); +var oPathLength = aTreePath.getPathCount (); +if (oPathLength < pathLength) return false; +while (oPathLength-- > pathLength) aTreePath = aTreePath.getParentPath (); + +return this.equals (aTreePath); +}return false; +}, "javax.swing.tree.TreePath"); +Clazz.defineMethod (c$, "pathByAddingChild", +function (child) { +if (child == null) throw new NullPointerException ("Null child not allowed"); +return new javax.swing.tree.TreePath (this, child); +}, "~O"); +Clazz.defineMethod (c$, "getParentPath", +function () { +return this.parentPath; +}); +Clazz.overrideMethod (c$, "toString", +function () { +var tempSpot = new StringBuffer ("["); +for (var counter = 0, maxCounter = this.getPathCount (); counter < maxCounter; counter++) { +if (counter > 0) tempSpot.append (", "); +tempSpot.append (this.getPathComponent (counter)); +} +tempSpot.append ("]"); +return tempSpot.toString (); +}); +});