7f00bf12a0bcc56c449a52a4d0df1e65ee29693c
[jalviewjs.git] / site / swingjs / j2s / javax / swing / event / TreeSelectionEvent.js
1 Clazz.declarePackage ("javax.swing.event");
2 Clazz.load (["java.util.EventObject"], "javax.swing.event.TreeSelectionEvent", ["java.lang.IllegalArgumentException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.paths = null;
5 this.areNew = null;
6 this.oldLeadSelectionPath = null;
7 this.newLeadSelectionPath = null;
8 Clazz.instantialize (this, arguments);
9 }, javax.swing.event, "TreeSelectionEvent", java.util.EventObject);
10 Clazz.makeConstructor (c$, 
11 function (source, paths, areNew, oldLeadSelectionPath, newLeadSelectionPath) {
12 Clazz.superConstructor (this, javax.swing.event.TreeSelectionEvent, [source]);
13 this.paths = paths;
14 this.areNew = areNew;
15 this.oldLeadSelectionPath = oldLeadSelectionPath;
16 this.newLeadSelectionPath = newLeadSelectionPath;
17 }, "~O,~A,~A,javax.swing.tree.TreePath,javax.swing.tree.TreePath");
18 Clazz.makeConstructor (c$, 
19 function (source, path, isNew, oldLeadSelectionPath, newLeadSelectionPath) {
20 Clazz.superConstructor (this, javax.swing.event.TreeSelectionEvent, [source]);
21 this.paths =  new Array (1);
22 this.paths[0] = path;
23 this.areNew =  Clazz.newBooleanArray (1, false);
24 this.areNew[0] = isNew;
25 this.oldLeadSelectionPath = oldLeadSelectionPath;
26 this.newLeadSelectionPath = newLeadSelectionPath;
27 }, "~O,javax.swing.tree.TreePath,~B,javax.swing.tree.TreePath,javax.swing.tree.TreePath");
28 Clazz.defineMethod (c$, "getPaths", 
29 function () {
30 var numPaths;
31 var retPaths;
32 numPaths = this.paths.length;
33 retPaths =  new Array (numPaths);
34 System.arraycopy (this.paths, 0, retPaths, 0, numPaths);
35 return retPaths;
36 });
37 Clazz.defineMethod (c$, "getPath", 
38 function () {
39 return this.paths[0];
40 });
41 Clazz.defineMethod (c$, "isAddedPath", 
42 function () {
43 return this.areNew[0];
44 });
45 Clazz.defineMethod (c$, "isAddedPath", 
46 function (path) {
47 for (var counter = this.paths.length - 1; counter >= 0; counter--) if (this.paths[counter].equals (path)) return this.areNew[counter];
48
49 throw  new IllegalArgumentException ("path is not a path identified by the TreeSelectionEvent");
50 }, "javax.swing.tree.TreePath");
51 Clazz.defineMethod (c$, "isAddedPath", 
52 function (index) {
53 if (this.paths == null || index < 0 || index >= this.paths.length) {
54 throw  new IllegalArgumentException ("index is beyond range of added paths identified by TreeSelectionEvent");
55 }return this.areNew[index];
56 }, "~N");
57 Clazz.defineMethod (c$, "getOldLeadSelectionPath", 
58 function () {
59 return this.oldLeadSelectionPath;
60 });
61 Clazz.defineMethod (c$, "getNewLeadSelectionPath", 
62 function () {
63 return this.newLeadSelectionPath;
64 });
65 Clazz.defineMethod (c$, "cloneWithSource", 
66 function (newSource) {
67 return  new javax.swing.event.TreeSelectionEvent (newSource, this.paths, this.areNew, this.oldLeadSelectionPath, this.newLeadSelectionPath);
68 }, "~O");
69 });