2633389a5c8a5bd4939d6905872cf7a6a3879539
[jalviewjs.git] / site / j2s / javax / swing / JTree.js
1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.JComponent", "$.Scrollable", "javax.swing.event.TreeModelListener", "$.TreeSelectionListener", "javax.swing.tree.DefaultMutableTreeNode", "$.DefaultTreeSelectionModel"], "javax.swing.JTree", ["java.lang.Boolean", "$.IllegalArgumentException", "java.util.Collections", "$.Hashtable", "$.Stack", "$.Vector", "java.awt.Dimension", "java.awt.event.MouseEvent", "javax.swing.JViewport", "$.SwingUtilities", "$.UIManager", "javax.swing.event.TreeExpansionEvent", "$.TreeExpansionListener", "$.TreeWillExpandListener", "javax.swing.text.Position", "javax.swing.tree.DefaultTreeModel", "$.TreePath"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.treeModel = null;
5 this.selectionModel = null;
6 this.rootVisible = false;
7 this.cellRenderer = null;
8 this.rowHeight = 0;
9 this.rowHeightSet = false;
10 this.expandedState = null;
11 this.showsRootHandles = false;
12 this.showsRootHandlesSet = false;
13 this.selectionRedirector = null;
14 this.cellEditor = null;
15 this.editable = false;
16 this.largeModel = false;
17 this.visibleRowCount = 0;
18 this.invokesStopCellEditing = false;
19 this.scrollsOnExpand = false;
20 this.scrollsOnExpandSet = false;
21 this.toggleClickCount = 0;
22 this.treeModelListener = null;
23 this.expandedStack = null;
24 this.leadPath = null;
25 this.anchorPath = null;
26 this.expandsSelectedPaths = false;
27 this.settingUI = false;
28 this.dragEnabled = false;
29 this.$expandRow = -1;
30 this.uiTreeExpansionListener = null;
31 if (!Clazz.isClassDefined ("javax.swing.JTree.TreeSelectionRedirector")) {
32 javax.swing.JTree.$JTree$TreeSelectionRedirector$ ();
33 }
34 if (!Clazz.isClassDefined ("javax.swing.JTree.TreeModelHandler")) {
35 javax.swing.JTree.$JTree$TreeModelHandler$ ();
36 }
37 Clazz.instantialize (this, arguments);
38 }, javax.swing, "JTree", javax.swing.JComponent, javax.swing.Scrollable);
39 c$.getDefaultTreeModel = Clazz.defineMethod (c$, "getDefaultTreeModel", 
40 function () {
41 var root =  new javax.swing.tree.DefaultMutableTreeNode ("JTree");
42 var parent;
43 parent =  new javax.swing.tree.DefaultMutableTreeNode ("colors");
44 root.add (parent);
45 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("blue"));
46 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("violet"));
47 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("red"));
48 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("yellow"));
49 parent =  new javax.swing.tree.DefaultMutableTreeNode ("sports");
50 root.add (parent);
51 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("basketball"));
52 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("soccer"));
53 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("football"));
54 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("hockey"));
55 parent =  new javax.swing.tree.DefaultMutableTreeNode ("food");
56 root.add (parent);
57 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("hot dogs"));
58 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("pizza"));
59 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("ravioli"));
60 parent.add ( new javax.swing.tree.DefaultMutableTreeNode ("bananas"));
61 return  new javax.swing.tree.DefaultTreeModel (root);
62 });
63 c$.createTreeModel = Clazz.defineMethod (c$, "createTreeModel", 
64 function (value) {
65 var root;
66 if ((Clazz.instanceOf (value, Array)) || (Clazz.instanceOf (value, java.util.Hashtable)) || (Clazz.instanceOf (value, java.util.Vector))) {
67 root =  new javax.swing.tree.DefaultMutableTreeNode ("root");
68 javax.swing.JTree.DynamicUtilTreeNode.createChildren (root, value);
69 } else {
70 root =  new javax.swing.JTree.DynamicUtilTreeNode ("root", value);
71 }return  new javax.swing.tree.DefaultTreeModel (root, false);
72 }, "~O");
73 Clazz.makeConstructor (c$, 
74 function () {
75 this.construct (javax.swing.JTree.getDefaultTreeModel ());
76 });
77 Clazz.makeConstructor (c$, 
78 function (value) {
79 this.construct (javax.swing.JTree.createTreeModel (value));
80 this.setRootVisible (false);
81 this.setShowsRootHandles (true);
82 this.expandRoot ();
83 }, "~A");
84 Clazz.makeConstructor (c$, 
85 function (value) {
86 this.construct (javax.swing.JTree.createTreeModel (value));
87 this.setRootVisible (false);
88 this.setShowsRootHandles (true);
89 this.expandRoot ();
90 }, "java.util.Vector");
91 Clazz.makeConstructor (c$, 
92 function (value) {
93 this.construct (javax.swing.JTree.createTreeModel (value));
94 this.setRootVisible (false);
95 this.setShowsRootHandles (true);
96 this.expandRoot ();
97 }, "java.util.Hashtable");
98 Clazz.makeConstructor (c$, 
99 function (root) {
100 this.construct (root, false);
101 }, "javax.swing.tree.TreeNode");
102 Clazz.makeConstructor (c$, 
103 function (root, asksAllowsChildren) {
104 this.construct ( new javax.swing.tree.DefaultTreeModel (root, asksAllowsChildren));
105 }, "javax.swing.tree.TreeNode,~B");
106 Clazz.makeConstructor (c$, 
107 function (newModel) {
108 Clazz.superConstructor (this, javax.swing.JTree);
109 this.expandedStack =  new java.util.Stack ();
110 this.toggleClickCount = 2;
111 this.expandedState =  new java.util.Hashtable ();
112 this.setLayout (null);
113 this.rowHeight = 16;
114 this.visibleRowCount = 20;
115 this.rootVisible = true;
116 this.selectionModel =  new javax.swing.tree.DefaultTreeSelectionModel ();
117 this.cellRenderer = null;
118 this.scrollsOnExpand = true;
119 this.setOpaque (true);
120 this.expandsSelectedPaths = true;
121 this.updateUI ();
122 this.setModel (newModel);
123 }, "javax.swing.tree.TreeModel");
124 Clazz.overrideMethod (c$, "getUI", 
125 function () {
126 return this.ui;
127 });
128 Clazz.defineMethod (c$, "setUI", 
129 function (ui) {
130 if (this.ui !== ui) {
131 this.settingUI = true;
132 this.uiTreeExpansionListener = null;
133 try {
134 Clazz.superCall (this, javax.swing.JTree, "setUI", [ui]);
135 } finally {
136 this.settingUI = false;
137 }
138 }}, "javax.swing.plaf.TreeUI");
139 Clazz.overrideMethod (c$, "updateUI", 
140 function () {
141 this.setUI (javax.swing.UIManager.getUI (this));
142 javax.swing.SwingUtilities.updateRendererOrEditorUI (this.getCellRenderer ());
143 javax.swing.SwingUtilities.updateRendererOrEditorUI (this.getCellEditor ());
144 });
145 Clazz.overrideMethod (c$, "getUIClassID", 
146 function () {
147 return "TreeUI";
148 });
149 Clazz.defineMethod (c$, "getCellRenderer", 
150 function () {
151 return this.cellRenderer;
152 });
153 Clazz.defineMethod (c$, "setCellRenderer", 
154 function (x) {
155 var oldValue = this.cellRenderer;
156 this.cellRenderer = x;
157 this.firePropertyChangeObject ("cellRenderer", oldValue, this.cellRenderer);
158 this.invalidate ();
159 }, "javax.swing.tree.TreeCellRenderer");
160 Clazz.defineMethod (c$, "setEditable", 
161 function (flag) {
162 var oldValue = this.editable;
163 this.editable = flag;
164 this.firePropertyChangeBool ("editable", oldValue, flag);
165 }, "~B");
166 Clazz.defineMethod (c$, "isEditable", 
167 function () {
168 return this.editable;
169 });
170 Clazz.defineMethod (c$, "setCellEditor", 
171 function (cellEditor) {
172 var oldEditor = this.cellEditor;
173 this.cellEditor = cellEditor;
174 this.firePropertyChangeObject ("cellEditor", oldEditor, cellEditor);
175 this.invalidate ();
176 }, "javax.swing.tree.TreeCellEditor");
177 Clazz.defineMethod (c$, "getCellEditor", 
178 function () {
179 return this.cellEditor;
180 });
181 Clazz.defineMethod (c$, "getModel", 
182 function () {
183 return this.treeModel;
184 });
185 Clazz.defineMethod (c$, "setModel", 
186 function (newModel) {
187 this.clearSelection ();
188 var oldModel = this.treeModel;
189 if (this.treeModel != null && this.treeModelListener != null) this.treeModel.removeTreeModelListener (this.treeModelListener);
190 this.treeModel = newModel;
191 this.clearToggledPaths ();
192 if (this.treeModel != null) {
193 if (this.treeModelListener == null) this.treeModelListener = this.createTreeModelListener ();
194 if (this.treeModelListener != null) this.treeModel.addTreeModelListener (this.treeModelListener);
195 if (this.treeModel.getRoot () != null && !this.treeModel.isLeaf (this.treeModel.getRoot ())) {
196 this.expandedState.put ( new javax.swing.tree.TreePath (this.treeModel.getRoot ()), Boolean.TRUE);
197 }}this.firePropertyChangeObject ("model", oldModel, this.treeModel);
198 this.invalidate ();
199 }, "javax.swing.tree.TreeModel");
200 Clazz.defineMethod (c$, "isRootVisible", 
201 function () {
202 return this.rootVisible;
203 });
204 Clazz.defineMethod (c$, "setRootVisible", 
205 function (rootVisible) {
206 var oldValue = this.rootVisible;
207 this.rootVisible = rootVisible;
208 this.firePropertyChangeBool ("rootVisible", oldValue, this.rootVisible);
209 }, "~B");
210 Clazz.defineMethod (c$, "setShowsRootHandles", 
211 function (newValue) {
212 var oldValue = this.showsRootHandles;
213 var model = this.getModel ();
214 this.showsRootHandles = newValue;
215 this.showsRootHandlesSet = true;
216 this.firePropertyChangeBool ("showsRootHandles", oldValue, this.showsRootHandles);
217 this.invalidate ();
218 }, "~B");
219 Clazz.defineMethod (c$, "getShowsRootHandles", 
220 function () {
221 return this.showsRootHandles;
222 });
223 Clazz.defineMethod (c$, "setRowHeight", 
224 function (rowHeight) {
225 var oldValue = this.rowHeight;
226 this.rowHeight = rowHeight;
227 this.rowHeightSet = true;
228 this.firePropertyChangeInt ("rowHeight", oldValue, this.rowHeight);
229 this.invalidate ();
230 }, "~N");
231 Clazz.defineMethod (c$, "getRowHeight", 
232 function () {
233 return this.rowHeight;
234 });
235 Clazz.defineMethod (c$, "isFixedRowHeight", 
236 function () {
237 return (this.rowHeight > 0);
238 });
239 Clazz.defineMethod (c$, "setLargeModel", 
240 function (newValue) {
241 var oldValue = this.largeModel;
242 this.largeModel = newValue;
243 this.firePropertyChangeBool ("largeModel", oldValue, newValue);
244 }, "~B");
245 Clazz.defineMethod (c$, "isLargeModel", 
246 function () {
247 return this.largeModel;
248 });
249 Clazz.defineMethod (c$, "setInvokesStopCellEditing", 
250 function (newValue) {
251 var oldValue = this.invokesStopCellEditing;
252 this.invokesStopCellEditing = newValue;
253 this.firePropertyChangeBool ("invokesStopCellEditing", oldValue, newValue);
254 }, "~B");
255 Clazz.defineMethod (c$, "getInvokesStopCellEditing", 
256 function () {
257 return this.invokesStopCellEditing;
258 });
259 Clazz.defineMethod (c$, "setScrollsOnExpand", 
260 function (newValue) {
261 var oldValue = this.scrollsOnExpand;
262 this.scrollsOnExpand = newValue;
263 this.scrollsOnExpandSet = true;
264 this.firePropertyChangeBool ("scrollsOnExpand", oldValue, newValue);
265 }, "~B");
266 Clazz.defineMethod (c$, "getScrollsOnExpand", 
267 function () {
268 return this.scrollsOnExpand;
269 });
270 Clazz.defineMethod (c$, "setToggleClickCount", 
271 function (clickCount) {
272 var oldCount = this.toggleClickCount;
273 this.toggleClickCount = clickCount;
274 this.firePropertyChangeInt ("toggleClickCount", oldCount, clickCount);
275 }, "~N");
276 Clazz.defineMethod (c$, "getToggleClickCount", 
277 function () {
278 return this.toggleClickCount;
279 });
280 Clazz.defineMethod (c$, "setExpandsSelectedPaths", 
281 function (newValue) {
282 var oldValue = this.expandsSelectedPaths;
283 this.expandsSelectedPaths = newValue;
284 this.firePropertyChangeBool ("expandsSelectedPaths", oldValue, newValue);
285 }, "~B");
286 Clazz.defineMethod (c$, "getExpandsSelectedPaths", 
287 function () {
288 return this.expandsSelectedPaths;
289 });
290 Clazz.defineMethod (c$, "setDragEnabled", 
291 function (b) {
292 this.dragEnabled = b;
293 }, "~B");
294 Clazz.defineMethod (c$, "getDragEnabled", 
295 function () {
296 return this.dragEnabled;
297 });
298 Clazz.defineMethod (c$, "isPathEditable", 
299 function (path) {
300 return this.isEditable ();
301 }, "javax.swing.tree.TreePath");
302 Clazz.defineMethod (c$, "getToolTipText", 
303 function (event) {
304 var tip = null;
305 if (event != null) {
306 var p = event.getPoint ();
307 var selRow = this.getRowForLocation (p.x, p.y);
308 var r = this.getCellRenderer ();
309 if (selRow != -1 && r != null) {
310 var path = this.getPathForRow (selRow);
311 var lastPath = path.getLastPathComponent ();
312 var rComponent = r.getTreeCellRendererComponent (this, lastPath, this.isRowSelected (selRow), this.isExpanded (selRow), this.getModel ().isLeaf (lastPath), selRow, true);
313 if (Clazz.instanceOf (rComponent, javax.swing.JComponent)) {
314 var newEvent;
315 var pathBounds = this.getPathBounds (path);
316 p.translate (-pathBounds.x, -pathBounds.y);
317 newEvent =  new java.awt.event.MouseEvent (rComponent, event.getID (), event.getWhen (), event.getModifiers (), p.x, p.y, event.getXOnScreen (), event.getYOnScreen (), event.getClickCount (), event.isPopupTrigger (), 0);
318 tip = (rComponent).getToolTipText (newEvent);
319 }}}if (tip == null) {
320 tip = this.getToolTipText ();
321 }return tip;
322 }, "java.awt.event.MouseEvent");
323 Clazz.defineMethod (c$, "convertValueToText", 
324 function (value, selected, expanded, leaf, row, hasFocus) {
325 if (value != null) {
326 var sValue = value.toString ();
327 if (sValue != null) {
328 return sValue;
329 }}return "";
330 }, "~O,~B,~B,~B,~N,~B");
331 Clazz.defineMethod (c$, "getRowCount", 
332 function () {
333 var tree = this.getUI ();
334 if (tree != null) return tree.getRowCount (this);
335 return 0;
336 });
337 Clazz.defineMethod (c$, "setSelectionPath", 
338 function (path) {
339 this.getSelectionModel ().setSelectionPath (path);
340 }, "javax.swing.tree.TreePath");
341 Clazz.defineMethod (c$, "setSelectionPaths", 
342 function (paths) {
343 this.getSelectionModel ().setSelectionPaths (paths);
344 }, "~A");
345 Clazz.defineMethod (c$, "setLeadSelectionPath", 
346 function (newPath) {
347 var oldValue = this.leadPath;
348 this.leadPath = newPath;
349 this.firePropertyChangeObject ("leadSelectionPath", oldValue, newPath);
350 }, "javax.swing.tree.TreePath");
351 Clazz.defineMethod (c$, "setAnchorSelectionPath", 
352 function (newPath) {
353 var oldValue = this.anchorPath;
354 this.anchorPath = newPath;
355 this.firePropertyChangeObject ("anchorSelectionPath", oldValue, newPath);
356 }, "javax.swing.tree.TreePath");
357 Clazz.defineMethod (c$, "setSelectionRow", 
358 function (row) {
359 var rows =  Clazz.newIntArray (-1, [row]);
360 this.setSelectionRows (rows);
361 }, "~N");
362 Clazz.defineMethod (c$, "setSelectionRows", 
363 function (rows) {
364 var ui = this.getUI ();
365 if (ui != null && rows != null) {
366 var numRows = rows.length;
367 var paths =  new Array (numRows);
368 for (var counter = 0; counter < numRows; counter++) {
369 paths[counter] = ui.getPathForRow (this, rows[counter]);
370 }
371 this.setSelectionPaths (paths);
372 }}, "~A");
373 Clazz.defineMethod (c$, "addSelectionPath", 
374 function (path) {
375 this.getSelectionModel ().addSelectionPath (path);
376 }, "javax.swing.tree.TreePath");
377 Clazz.defineMethod (c$, "addSelectionPaths", 
378 function (paths) {
379 this.getSelectionModel ().addSelectionPaths (paths);
380 }, "~A");
381 Clazz.defineMethod (c$, "addSelectionRow", 
382 function (row) {
383 var rows =  Clazz.newIntArray (-1, [row]);
384 this.addSelectionRows (rows);
385 }, "~N");
386 Clazz.defineMethod (c$, "addSelectionRows", 
387 function (rows) {
388 var ui = this.getUI ();
389 if (ui != null && rows != null) {
390 var numRows = rows.length;
391 var paths =  new Array (numRows);
392 for (var counter = 0; counter < numRows; counter++) paths[counter] = ui.getPathForRow (this, rows[counter]);
393
394 this.addSelectionPaths (paths);
395 }}, "~A");
396 Clazz.defineMethod (c$, "getLastSelectedPathComponent", 
397 function () {
398 var selPath = this.getSelectionModel ().getSelectionPath ();
399 if (selPath != null) return selPath.getLastPathComponent ();
400 return null;
401 });
402 Clazz.defineMethod (c$, "getLeadSelectionPath", 
403 function () {
404 return this.leadPath;
405 });
406 Clazz.defineMethod (c$, "getAnchorSelectionPath", 
407 function () {
408 return this.anchorPath;
409 });
410 Clazz.defineMethod (c$, "getSelectionPath", 
411 function () {
412 return this.getSelectionModel ().getSelectionPath ();
413 });
414 Clazz.defineMethod (c$, "getSelectionPaths", 
415 function () {
416 return this.getSelectionModel ().getSelectionPaths ();
417 });
418 Clazz.defineMethod (c$, "getSelectionRows", 
419 function () {
420 return this.getSelectionModel ().getSelectionRows ();
421 });
422 Clazz.defineMethod (c$, "getSelectionCount", 
423 function () {
424 return this.selectionModel.getSelectionCount ();
425 });
426 Clazz.defineMethod (c$, "getMinSelectionRow", 
427 function () {
428 return this.getSelectionModel ().getMinSelectionRow ();
429 });
430 Clazz.defineMethod (c$, "getMaxSelectionRow", 
431 function () {
432 return this.getSelectionModel ().getMaxSelectionRow ();
433 });
434 Clazz.defineMethod (c$, "getLeadSelectionRow", 
435 function () {
436 var leadPath = this.getLeadSelectionPath ();
437 if (leadPath != null) {
438 return this.getRowForPath (leadPath);
439 }return -1;
440 });
441 Clazz.defineMethod (c$, "isPathSelected", 
442 function (path) {
443 return this.getSelectionModel ().isPathSelected (path);
444 }, "javax.swing.tree.TreePath");
445 Clazz.defineMethod (c$, "isRowSelected", 
446 function (row) {
447 return this.getSelectionModel ().isRowSelected (row);
448 }, "~N");
449 Clazz.defineMethod (c$, "getExpandedDescendants", 
450 function (parent) {
451 if (!this.isExpanded (parent)) return null;
452 var toggledPaths = this.expandedState.keys ();
453 var elements = null;
454 var path;
455 var value;
456 if (toggledPaths != null) {
457 while (toggledPaths.hasMoreElements ()) {
458 path = toggledPaths.nextElement ();
459 value = this.expandedState.get (path);
460 if (path !== parent && value != null && (value).booleanValue () && parent.isDescendant (path) && this.isVisible (path)) {
461 if (elements == null) {
462 elements =  new java.util.Vector ();
463 }elements.addElement (path);
464 }}
465 }if (elements == null) {
466 var empty = java.util.Collections.emptySet ();
467 return java.util.Collections.enumeration (empty);
468 }return elements.elements ();
469 }, "javax.swing.tree.TreePath");
470 Clazz.defineMethod (c$, "hasBeenExpanded", 
471 function (path) {
472 return (path != null && this.expandedState.get (path) != null);
473 }, "javax.swing.tree.TreePath");
474 Clazz.defineMethod (c$, "isExpanded", 
475 function (path) {
476 if (path == null) return false;
477 var value = this.expandedState.get (path);
478 if (value == null || !(value).booleanValue ()) return false;
479 var parentPath = path.getParentPath ();
480 if (parentPath != null) return this.isExpanded (parentPath);
481 return true;
482 }, "javax.swing.tree.TreePath");
483 Clazz.defineMethod (c$, "isExpanded", 
484 function (row) {
485 var tree = this.getUI ();
486 if (tree != null) {
487 var path = tree.getPathForRow (this, row);
488 if (path != null) {
489 var value = this.expandedState.get (path);
490 return (value != null && value.booleanValue ());
491 }}return false;
492 }, "~N");
493 Clazz.defineMethod (c$, "isCollapsed", 
494 function (path) {
495 return !this.isExpanded (path);
496 }, "javax.swing.tree.TreePath");
497 Clazz.defineMethod (c$, "isCollapsed", 
498 function (row) {
499 return !this.isExpanded (row);
500 }, "~N");
501 Clazz.defineMethod (c$, "makeVisible", 
502 function (path) {
503 if (path != null) {
504 var parentPath = path.getParentPath ();
505 if (parentPath != null) {
506 this.expandPath (parentPath);
507 }}}, "javax.swing.tree.TreePath");
508 Clazz.defineMethod (c$, "isVisible", 
509 function (path) {
510 if (path != null) {
511 var parentPath = path.getParentPath ();
512 if (parentPath != null) return this.isExpanded (parentPath);
513 return true;
514 }return false;
515 }, "javax.swing.tree.TreePath");
516 Clazz.defineMethod (c$, "getPathBounds", 
517 function (path) {
518 var tree = this.getUI ();
519 if (tree != null) return tree.getPathBounds (this, path);
520 return null;
521 }, "javax.swing.tree.TreePath");
522 Clazz.defineMethod (c$, "getRowBounds", 
523 function (row) {
524 return this.getPathBounds (this.getPathForRow (row));
525 }, "~N");
526 Clazz.defineMethod (c$, "scrollPathToVisible", 
527 function (path) {
528 if (path != null) {
529 this.makeVisible (path);
530 var bounds = this.getPathBounds (path);
531 if (bounds != null) {
532 this.scrollRectToVisible (bounds);
533 }}}, "javax.swing.tree.TreePath");
534 Clazz.defineMethod (c$, "scrollRowToVisible", 
535 function (row) {
536 this.scrollPathToVisible (this.getPathForRow (row));
537 }, "~N");
538 Clazz.defineMethod (c$, "getPathForRow", 
539 function (row) {
540 var tree = this.getUI ();
541 if (tree != null) return tree.getPathForRow (this, row);
542 return null;
543 }, "~N");
544 Clazz.defineMethod (c$, "getRowForPath", 
545 function (path) {
546 var tree = this.getUI ();
547 if (tree != null) return tree.getRowForPath (this, path);
548 return -1;
549 }, "javax.swing.tree.TreePath");
550 Clazz.defineMethod (c$, "expandPath", 
551 function (path) {
552 var model = this.getModel ();
553 if (path != null && model != null && !model.isLeaf (path.getLastPathComponent ())) {
554 this.setExpandedState (path, true);
555 }}, "javax.swing.tree.TreePath");
556 Clazz.defineMethod (c$, "expandRow", 
557 function (row) {
558 this.expandPath (this.getPathForRow (row));
559 }, "~N");
560 Clazz.defineMethod (c$, "collapsePath", 
561 function (path) {
562 this.setExpandedState (path, false);
563 }, "javax.swing.tree.TreePath");
564 Clazz.defineMethod (c$, "collapseRow", 
565 function (row) {
566 this.collapsePath (this.getPathForRow (row));
567 }, "~N");
568 Clazz.defineMethod (c$, "getPathForLocation", 
569 function (x, y) {
570 var closestPath = this.getClosestPathForLocation (x, y);
571 if (closestPath != null) {
572 var pathBounds = this.getPathBounds (closestPath);
573 if (pathBounds != null && x >= pathBounds.x && x < (pathBounds.x + pathBounds.width) && y >= pathBounds.y && y < (pathBounds.y + pathBounds.height)) return closestPath;
574 }return null;
575 }, "~N,~N");
576 Clazz.defineMethod (c$, "getRowForLocation", 
577 function (x, y) {
578 return this.getRowForPath (this.getPathForLocation (x, y));
579 }, "~N,~N");
580 Clazz.defineMethod (c$, "getClosestPathForLocation", 
581 function (x, y) {
582 var tree = this.getUI ();
583 if (tree != null) return tree.getClosestPathForLocation (this, x, y);
584 return null;
585 }, "~N,~N");
586 Clazz.defineMethod (c$, "getClosestRowForLocation", 
587 function (x, y) {
588 return this.getRowForPath (this.getClosestPathForLocation (x, y));
589 }, "~N,~N");
590 Clazz.defineMethod (c$, "isEditing", 
591 function () {
592 var tree = this.getUI ();
593 if (tree != null) return tree.isEditing (this);
594 return false;
595 });
596 Clazz.defineMethod (c$, "stopEditing", 
597 function () {
598 var tree = this.getUI ();
599 if (tree != null) return tree.stopEditing (this);
600 return false;
601 });
602 Clazz.defineMethod (c$, "cancelEditing", 
603 function () {
604 var tree = this.getUI ();
605 if (tree != null) tree.cancelEditing (this);
606 });
607 Clazz.defineMethod (c$, "startEditingAtPath", 
608 function (path) {
609 var tree = this.getUI ();
610 if (tree != null) tree.startEditingAtPath (this, path);
611 }, "javax.swing.tree.TreePath");
612 Clazz.defineMethod (c$, "getEditingPath", 
613 function () {
614 var tree = this.getUI ();
615 if (tree != null) return tree.getEditingPath (this);
616 return null;
617 });
618 Clazz.defineMethod (c$, "setSelectionModel", 
619 function (selectionModel) {
620 if (selectionModel == null) selectionModel = javax.swing.JTree.EmptySelectionModel.sharedInstance ();
621 var oldValue = this.selectionModel;
622 if (this.selectionModel != null && this.selectionRedirector != null) {
623 this.selectionModel.removeTreeSelectionListener (this.selectionRedirector);
624 }this.selectionModel = selectionModel;
625 if (this.selectionRedirector != null) {
626 this.selectionModel.addTreeSelectionListener (this.selectionRedirector);
627 }this.firePropertyChangeObject ("selectionModel", oldValue, this.selectionModel);
628 }, "javax.swing.tree.TreeSelectionModel");
629 Clazz.defineMethod (c$, "getSelectionModel", 
630 function () {
631 return this.selectionModel;
632 });
633 Clazz.defineMethod (c$, "getPathBetweenRows", 
634 function (index0, index1) {
635 var newMinIndex;
636 var newMaxIndex;
637 var tree = this.getUI ();
638 newMinIndex = Math.min (index0, index1);
639 newMaxIndex = Math.max (index0, index1);
640 if (tree != null) {
641 var selection =  new Array (newMaxIndex - newMinIndex + 1);
642 for (var counter = newMinIndex; counter <= newMaxIndex; counter++) {
643 selection[counter - newMinIndex] = tree.getPathForRow (this, counter);
644 }
645 return selection;
646 }return null;
647 }, "~N,~N");
648 Clazz.defineMethod (c$, "setSelectionInterval", 
649 function (index0, index1) {
650 var paths = this.getPathBetweenRows (index0, index1);
651 this.getSelectionModel ().setSelectionPaths (paths);
652 }, "~N,~N");
653 Clazz.defineMethod (c$, "addSelectionInterval", 
654 function (index0, index1) {
655 var paths = this.getPathBetweenRows (index0, index1);
656 this.getSelectionModel ().addSelectionPaths (paths);
657 }, "~N,~N");
658 Clazz.defineMethod (c$, "removeSelectionInterval", 
659 function (index0, index1) {
660 var paths = this.getPathBetweenRows (index0, index1);
661 this.getSelectionModel ().removeSelectionPaths (paths);
662 }, "~N,~N");
663 Clazz.defineMethod (c$, "removeSelectionPath", 
664 function (path) {
665 this.getSelectionModel ().removeSelectionPath (path);
666 }, "javax.swing.tree.TreePath");
667 Clazz.defineMethod (c$, "removeSelectionPaths", 
668 function (paths) {
669 this.getSelectionModel ().removeSelectionPaths (paths);
670 }, "~A");
671 Clazz.defineMethod (c$, "removeSelectionRow", 
672 function (row) {
673 var rows =  Clazz.newIntArray (-1, [row]);
674 this.removeSelectionRows (rows);
675 }, "~N");
676 Clazz.defineMethod (c$, "removeSelectionRows", 
677 function (rows) {
678 var ui = this.getUI ();
679 if (ui != null && rows != null) {
680 var numRows = rows.length;
681 var paths =  new Array (numRows);
682 for (var counter = 0; counter < numRows; counter++) paths[counter] = ui.getPathForRow (this, rows[counter]);
683
684 this.removeSelectionPaths (paths);
685 }}, "~A");
686 Clazz.defineMethod (c$, "clearSelection", 
687 function () {
688 this.getSelectionModel ().clearSelection ();
689 });
690 Clazz.defineMethod (c$, "isSelectionEmpty", 
691 function () {
692 return this.getSelectionModel ().isSelectionEmpty ();
693 });
694 Clazz.defineMethod (c$, "addTreeExpansionListener", 
695 function (tel) {
696 if (this.settingUI) {
697 this.uiTreeExpansionListener = tel;
698 }this.listenerList.add (javax.swing.event.TreeExpansionListener, tel);
699 }, "javax.swing.event.TreeExpansionListener");
700 Clazz.defineMethod (c$, "removeTreeExpansionListener", 
701 function (tel) {
702 this.listenerList.remove (javax.swing.event.TreeExpansionListener, tel);
703 if (this.uiTreeExpansionListener === tel) {
704 this.uiTreeExpansionListener = null;
705 }}, "javax.swing.event.TreeExpansionListener");
706 Clazz.defineMethod (c$, "getTreeExpansionListeners", 
707 function () {
708 return this.listenerList.getListeners (javax.swing.event.TreeExpansionListener);
709 });
710 Clazz.defineMethod (c$, "addTreeWillExpandListener", 
711 function (tel) {
712 this.listenerList.add (javax.swing.event.TreeWillExpandListener, tel);
713 }, "javax.swing.event.TreeWillExpandListener");
714 Clazz.defineMethod (c$, "removeTreeWillExpandListener", 
715 function (tel) {
716 this.listenerList.remove (javax.swing.event.TreeWillExpandListener, tel);
717 }, "javax.swing.event.TreeWillExpandListener");
718 Clazz.defineMethod (c$, "getTreeWillExpandListeners", 
719 function () {
720 return this.listenerList.getListeners (javax.swing.event.TreeWillExpandListener);
721 });
722 Clazz.defineMethod (c$, "fireTreeExpanded", 
723 function (path) {
724 var listeners = this.listenerList.getListenerList ();
725 var e = null;
726 if (this.uiTreeExpansionListener != null) {
727 e =  new javax.swing.event.TreeExpansionEvent (this, path);
728 this.uiTreeExpansionListener.treeExpanded (e);
729 }for (var i = listeners.length - 2; i >= 0; i -= 2) {
730 if (listeners[i] === javax.swing.event.TreeExpansionListener && listeners[i + 1] !== this.uiTreeExpansionListener) {
731 if (e == null) e =  new javax.swing.event.TreeExpansionEvent (this, path);
732 (listeners[i + 1]).treeExpanded (e);
733 }}
734 }, "javax.swing.tree.TreePath");
735 Clazz.defineMethod (c$, "fireTreeCollapsed", 
736 function (path) {
737 var listeners = this.listenerList.getListenerList ();
738 var e = null;
739 if (this.uiTreeExpansionListener != null) {
740 e =  new javax.swing.event.TreeExpansionEvent (this, path);
741 this.uiTreeExpansionListener.treeCollapsed (e);
742 }for (var i = listeners.length - 2; i >= 0; i -= 2) {
743 if (listeners[i] === javax.swing.event.TreeExpansionListener && listeners[i + 1] !== this.uiTreeExpansionListener) {
744 if (e == null) e =  new javax.swing.event.TreeExpansionEvent (this, path);
745 (listeners[i + 1]).treeCollapsed (e);
746 }}
747 }, "javax.swing.tree.TreePath");
748 Clazz.defineMethod (c$, "fireTreeWillExpand", 
749 function (path) {
750 var listeners = this.listenerList.getListenerList ();
751 var e = null;
752 for (var i = listeners.length - 2; i >= 0; i -= 2) {
753 if (listeners[i] === javax.swing.event.TreeWillExpandListener) {
754 if (e == null) e =  new javax.swing.event.TreeExpansionEvent (this, path);
755 (listeners[i + 1]).treeWillExpand (e);
756 }}
757 }, "javax.swing.tree.TreePath");
758 Clazz.defineMethod (c$, "fireTreeWillCollapse", 
759 function (path) {
760 var listeners = this.listenerList.getListenerList ();
761 var e = null;
762 for (var i = listeners.length - 2; i >= 0; i -= 2) {
763 if (listeners[i] === javax.swing.event.TreeWillExpandListener) {
764 if (e == null) e =  new javax.swing.event.TreeExpansionEvent (this, path);
765 (listeners[i + 1]).treeWillCollapse (e);
766 }}
767 }, "javax.swing.tree.TreePath");
768 Clazz.defineMethod (c$, "addTreeSelectionListener", 
769 function (tsl) {
770 this.listenerList.add (javax.swing.event.TreeSelectionListener, tsl);
771 if (this.listenerList.getListenerCount (javax.swing.event.TreeSelectionListener) != 0 && this.selectionRedirector == null) {
772 this.selectionRedirector = Clazz.innerTypeInstance (javax.swing.JTree.TreeSelectionRedirector, this, null);
773 this.selectionModel.addTreeSelectionListener (this.selectionRedirector);
774 }}, "javax.swing.event.TreeSelectionListener");
775 Clazz.defineMethod (c$, "removeTreeSelectionListener", 
776 function (tsl) {
777 this.listenerList.remove (javax.swing.event.TreeSelectionListener, tsl);
778 if (this.listenerList.getListenerCount (javax.swing.event.TreeSelectionListener) == 0 && this.selectionRedirector != null) {
779 this.selectionModel.removeTreeSelectionListener (this.selectionRedirector);
780 this.selectionRedirector = null;
781 }}, "javax.swing.event.TreeSelectionListener");
782 Clazz.defineMethod (c$, "getTreeSelectionListeners", 
783 function () {
784 return this.listenerList.getListeners (javax.swing.event.TreeSelectionListener);
785 });
786 Clazz.defineMethod (c$, "fireValueChanged", 
787 function (e) {
788 var listeners = this.listenerList.getListenerList ();
789 for (var i = listeners.length - 2; i >= 0; i -= 2) {
790 if (listeners[i] === javax.swing.event.TreeSelectionListener) {
791 (listeners[i + 1]).valueChanged (e);
792 }}
793 }, "javax.swing.event.TreeSelectionEvent");
794 Clazz.defineMethod (c$, "treeDidChange", 
795 function () {
796 this.revalidate ();
797 this.repaint ();
798 });
799 Clazz.defineMethod (c$, "setVisibleRowCount", 
800 function (newCount) {
801 var oldCount = this.visibleRowCount;
802 this.visibleRowCount = newCount;
803 this.firePropertyChangeInt ("visibleRowCount", oldCount, this.visibleRowCount);
804 this.invalidate ();
805 }, "~N");
806 Clazz.defineMethod (c$, "getVisibleRowCount", 
807 function () {
808 return this.visibleRowCount;
809 });
810 Clazz.defineMethod (c$, "expandRoot", 
811  function () {
812 var model = this.getModel ();
813 if (model != null && model.getRoot () != null) {
814 this.expandPath ( new javax.swing.tree.TreePath (model.getRoot ()));
815 }});
816 Clazz.defineMethod (c$, "getNextMatch", 
817 function (prefix, startingRow, bias) {
818 var max = this.getRowCount ();
819 if (prefix == null) {
820 throw  new IllegalArgumentException ();
821 }if (startingRow < 0 || startingRow >= max) {
822 throw  new IllegalArgumentException ();
823 }prefix = prefix.toUpperCase ();
824 var increment = (bias === javax.swing.text.Position.Bias.Forward) ? 1 : -1;
825 var row = startingRow;
826 do {
827 var path = this.getPathForRow (row);
828 var text = this.convertValueToText (path.getLastPathComponent (), this.isRowSelected (row), this.isExpanded (row), true, row, false);
829 if (text.toUpperCase ().startsWith (prefix)) {
830 return path;
831 }row = (row + increment + max) % max;
832 } while (row != startingRow);
833 return null;
834 }, "~S,~N,javax.swing.text.Position.Bias");
835 Clazz.overrideMethod (c$, "getPreferredScrollableViewportSize", 
836 function () {
837 var width = this.getPreferredSize ().width;
838 var visRows = this.getVisibleRowCount ();
839 var height = -1;
840 if (this.isFixedRowHeight ()) height = visRows * this.getRowHeight ();
841  else {
842 var ui = this.getUI ();
843 if (ui != null && visRows > 0) {
844 var rc = ui.getRowCount (this);
845 if (rc >= visRows) {
846 var bounds = this.getRowBounds (visRows - 1);
847 if (bounds != null) {
848 height = bounds.y + bounds.height;
849 }} else if (rc > 0) {
850 var bounds = this.getRowBounds (0);
851 if (bounds != null) {
852 height = bounds.height * visRows;
853 }}}if (height == -1) {
854 height = 16 * visRows;
855 }}return  new java.awt.Dimension (width, height);
856 });
857 Clazz.overrideMethod (c$, "getScrollableUnitIncrement", 
858 function (visibleRect, orientation, direction) {
859 if (orientation == 1) {
860 var rowBounds;
861 var firstIndex = this.getClosestRowForLocation (0, visibleRect.y);
862 if (firstIndex != -1) {
863 rowBounds = this.getRowBounds (firstIndex);
864 if (rowBounds.y != visibleRect.y) {
865 if (direction < 0) {
866 return Math.max (0, (visibleRect.y - rowBounds.y));
867 }return (rowBounds.y + rowBounds.height - visibleRect.y);
868 }if (direction < 0) {
869 if (firstIndex != 0) {
870 rowBounds = this.getRowBounds (firstIndex - 1);
871 return rowBounds.height;
872 }} else {
873 return rowBounds.height;
874 }}return 0;
875 }return 4;
876 }, "java.awt.Rectangle,~N,~N");
877 Clazz.overrideMethod (c$, "getScrollableBlockIncrement", 
878 function (visibleRect, orientation, direction) {
879 return (orientation == 1) ? visibleRect.height : visibleRect.width;
880 }, "java.awt.Rectangle,~N,~N");
881 Clazz.overrideMethod (c$, "getScrollableTracksViewportWidth", 
882 function () {
883 if (Clazz.instanceOf (this.getParent (), javax.swing.JViewport)) {
884 return ((this.getParent ()).getWidth () > this.getPreferredSize ().width);
885 }return false;
886 });
887 Clazz.overrideMethod (c$, "getScrollableTracksViewportHeight", 
888 function () {
889 if (Clazz.instanceOf (this.getParent (), javax.swing.JViewport)) {
890 return ((this.getParent ()).getHeight () > this.getPreferredSize ().height);
891 }return false;
892 });
893 Clazz.defineMethod (c$, "setExpandedState", 
894 function (path, state) {
895 if (path != null) {
896 var stack;
897 var parentPath = path.getParentPath ();
898 if (this.expandedStack.size () == 0) {
899 stack =  new java.util.Stack ();
900 } else {
901 stack = this.expandedStack.pop ();
902 }try {
903 while (parentPath != null) {
904 if (this.isExpanded (parentPath)) {
905 parentPath = null;
906 } else {
907 stack.push (parentPath);
908 parentPath = parentPath.getParentPath ();
909 }}
910 for (var counter = stack.size () - 1; counter >= 0; counter--) {
911 parentPath = stack.pop ();
912 if (!this.isExpanded (parentPath)) {
913 try {
914 this.fireTreeWillExpand (parentPath);
915 } catch (eve) {
916 if (Clazz.exceptionOf (eve, javax.swing.tree.ExpandVetoException)) {
917 return;
918 } else {
919 throw eve;
920 }
921 }
922 this.expandedState.put (parentPath, Boolean.TRUE);
923 this.fireTreeExpanded (parentPath);
924 }}
925 } finally {
926 if (this.expandedStack.size () < javax.swing.JTree.TEMP_STACK_SIZE) {
927 stack.removeAllElements ();
928 this.expandedStack.push (stack);
929 }}
930 if (!state) {
931 var cValue = this.expandedState.get (path);
932 if (cValue != null && (cValue).booleanValue ()) {
933 try {
934 this.fireTreeWillCollapse (path);
935 } catch (eve) {
936 if (Clazz.exceptionOf (eve, javax.swing.tree.ExpandVetoException)) {
937 return;
938 } else {
939 throw eve;
940 }
941 }
942 this.expandedState.put (path, Boolean.FALSE);
943 this.fireTreeCollapsed (path);
944 if (this.removeDescendantSelectedPaths (path, false) && !this.isPathSelected (path)) {
945 this.addSelectionPath (path);
946 }}} else {
947 var cValue = this.expandedState.get (path);
948 if (cValue == null || !(cValue).booleanValue ()) {
949 try {
950 this.fireTreeWillExpand (path);
951 } catch (eve) {
952 if (Clazz.exceptionOf (eve, javax.swing.tree.ExpandVetoException)) {
953 return;
954 } else {
955 throw eve;
956 }
957 }
958 this.expandedState.put (path, Boolean.TRUE);
959 this.fireTreeExpanded (path);
960 }}}}, "javax.swing.tree.TreePath,~B");
961 Clazz.defineMethod (c$, "getDescendantToggledPaths", 
962 function (parent) {
963 if (parent == null) return null;
964 var descendants =  new java.util.Vector ();
965 var nodes = this.expandedState.keys ();
966 var path;
967 while (nodes.hasMoreElements ()) {
968 path = nodes.nextElement ();
969 if (parent.isDescendant (path)) descendants.addElement (path);
970 }
971 return descendants.elements ();
972 }, "javax.swing.tree.TreePath");
973 Clazz.defineMethod (c$, "removeDescendantToggledPaths", 
974 function (toRemove) {
975 if (toRemove != null) {
976 while (toRemove.hasMoreElements ()) {
977 var descendants = this.getDescendantToggledPaths (toRemove.nextElement ());
978 if (descendants != null) {
979 while (descendants.hasMoreElements ()) {
980 this.expandedState.remove (descendants.nextElement ());
981 }
982 }}
983 }}, "java.util.Enumeration");
984 Clazz.defineMethod (c$, "clearToggledPaths", 
985 function () {
986 this.expandedState.clear ();
987 });
988 Clazz.defineMethod (c$, "createTreeModelListener", 
989 function () {
990 return Clazz.innerTypeInstance (javax.swing.JTree.TreeModelHandler, this, null);
991 });
992 Clazz.defineMethod (c$, "removeDescendantSelectedPaths", 
993 function (path, includePath) {
994 var toRemove = this.getDescendantSelectedPaths (path, includePath);
995 if (toRemove != null) {
996 this.getSelectionModel ().removeSelectionPaths (toRemove);
997 return true;
998 }return false;
999 }, "javax.swing.tree.TreePath,~B");
1000 Clazz.defineMethod (c$, "getDescendantSelectedPaths", 
1001  function (path, includePath) {
1002 var sm = this.getSelectionModel ();
1003 var selPaths = (sm != null) ? sm.getSelectionPaths () : null;
1004 if (selPaths != null) {
1005 var shouldRemove = false;
1006 for (var counter = selPaths.length - 1; counter >= 0; counter--) {
1007 if (selPaths[counter] != null && path.isDescendant (selPaths[counter]) && (!path.equals (selPaths[counter]) || includePath)) shouldRemove = true;
1008  else selPaths[counter] = null;
1009 }
1010 if (!shouldRemove) {
1011 selPaths = null;
1012 }return selPaths;
1013 }return null;
1014 }, "javax.swing.tree.TreePath,~B");
1015 Clazz.defineMethod (c$, "removeDescendantSelectedPaths", 
1016 function (e) {
1017 var pPath = e.getTreePath ();
1018 var oldChildren = e.getChildren ();
1019 var sm = this.getSelectionModel ();
1020 if (sm != null && pPath != null && oldChildren != null && oldChildren.length > 0) {
1021 for (var counter = oldChildren.length - 1; counter >= 0; counter--) {
1022 this.removeDescendantSelectedPaths (pPath.pathByAddingChild (oldChildren[counter]), true);
1023 }
1024 }}, "javax.swing.event.TreeModelEvent");
1025 Clazz.defineMethod (c$, "setUIProperty", 
1026 function (propertyName, value) {
1027 if (propertyName === "rowHeight") {
1028 if (!this.rowHeightSet) {
1029 this.setRowHeight ((value).intValue ());
1030 this.rowHeightSet = false;
1031 }} else if (propertyName === "scrollsOnExpand") {
1032 if (!this.scrollsOnExpandSet) {
1033 this.setScrollsOnExpand ((value).booleanValue ());
1034 this.scrollsOnExpandSet = false;
1035 }} else if (propertyName === "showsRootHandles") {
1036 if (!this.showsRootHandlesSet) {
1037 this.setShowsRootHandles ((value).booleanValue ());
1038 this.showsRootHandlesSet = false;
1039 }} else {
1040 Clazz.superCall (this, javax.swing.JTree, "setUIProperty", [propertyName, value]);
1041 }}, "~S,~O");
1042 Clazz.defineMethod (c$, "paramString", 
1043 function () {
1044 var rootVisibleString = (this.rootVisible ? "true" : "false");
1045 var showsRootHandlesString = (this.showsRootHandles ? "true" : "false");
1046 var editableString = (this.editable ? "true" : "false");
1047 var largeModelString = (this.largeModel ? "true" : "false");
1048 var invokesStopCellEditingString = (this.invokesStopCellEditing ? "true" : "false");
1049 var scrollsOnExpandString = (this.scrollsOnExpand ? "true" : "false");
1050 return Clazz.superCall (this, javax.swing.JTree, "paramString", []) + ",editable=" + editableString + ",invokesStopCellEditing=" + invokesStopCellEditingString + ",largeModel=" + largeModelString + ",rootVisible=" + rootVisibleString + ",rowHeight=" + this.rowHeight + ",scrollsOnExpand=" + scrollsOnExpandString + ",showsRootHandles=" + showsRootHandlesString + ",toggleClickCount=" + this.toggleClickCount + ",visibleRowCount=" + this.visibleRowCount;
1051 });
1052 c$.$JTree$TreeSelectionRedirector$ = function () {
1053 Clazz.pu$h(self.c$);
1054 c$ = Clazz.decorateAsClass (function () {
1055 Clazz.prepareCallback (this, arguments);
1056 Clazz.instantialize (this, arguments);
1057 }, javax.swing.JTree, "TreeSelectionRedirector", null, javax.swing.event.TreeSelectionListener);
1058 Clazz.overrideMethod (c$, "valueChanged", 
1059 function (a) {
1060 var b;
1061 b = a.cloneWithSource (this.b$["javax.swing.JTree"]);
1062 this.b$["javax.swing.JTree"].fireValueChanged (b);
1063 }, "javax.swing.event.TreeSelectionEvent");
1064 c$ = Clazz.p0p ();
1065 };
1066 c$.$JTree$TreeModelHandler$ = function () {
1067 Clazz.pu$h(self.c$);
1068 c$ = Clazz.decorateAsClass (function () {
1069 Clazz.prepareCallback (this, arguments);
1070 Clazz.instantialize (this, arguments);
1071 }, javax.swing.JTree, "TreeModelHandler", null, javax.swing.event.TreeModelListener);
1072 Clazz.overrideMethod (c$, "treeNodesChanged", 
1073 function (a) {
1074 }, "javax.swing.event.TreeModelEvent");
1075 Clazz.overrideMethod (c$, "treeNodesInserted", 
1076 function (a) {
1077 }, "javax.swing.event.TreeModelEvent");
1078 Clazz.overrideMethod (c$, "treeStructureChanged", 
1079 function (a) {
1080 if (a == null) return;
1081 var b = a.getTreePath ();
1082 if (b == null) return;
1083 if (b.getPathCount () == 1) {
1084 this.b$["javax.swing.JTree"].clearToggledPaths ();
1085 if (this.b$["javax.swing.JTree"].treeModel.getRoot () != null && !this.b$["javax.swing.JTree"].treeModel.isLeaf (this.b$["javax.swing.JTree"].treeModel.getRoot ())) {
1086 this.b$["javax.swing.JTree"].expandedState.put (b, Boolean.TRUE);
1087 }} else if (this.b$["javax.swing.JTree"].expandedState.get (b) != null) {
1088 var c =  new java.util.Vector (1);
1089 var d = this.b$["javax.swing.JTree"].isExpanded (b);
1090 c.addElement (b);
1091 this.b$["javax.swing.JTree"].removeDescendantToggledPaths (c.elements ());
1092 if (d) {
1093 var e = this.b$["javax.swing.JTree"].getModel ();
1094 if (e == null || e.isLeaf (b.getLastPathComponent ())) this.b$["javax.swing.JTree"].collapsePath (b);
1095  else this.b$["javax.swing.JTree"].expandedState.put (b, Boolean.TRUE);
1096 }}this.b$["javax.swing.JTree"].removeDescendantSelectedPaths (b, false);
1097 }, "javax.swing.event.TreeModelEvent");
1098 Clazz.overrideMethod (c$, "treeNodesRemoved", 
1099 function (a) {
1100 if (a == null) return;
1101 var b = a.getTreePath ();
1102 var c = a.getChildren ();
1103 if (c == null) return;
1104 var d;
1105 var e =  new java.util.Vector (Math.max (1, c.length));
1106 for (var f = c.length - 1; f >= 0; f--) {
1107 d = b.pathByAddingChild (c[f]);
1108 if (this.b$["javax.swing.JTree"].expandedState.get (d) != null) e.addElement (d);
1109 }
1110 if (e.size () > 0) this.b$["javax.swing.JTree"].removeDescendantToggledPaths (e.elements ());
1111 var g = this.b$["javax.swing.JTree"].getModel ();
1112 if (g == null || g.isLeaf (b.getLastPathComponent ())) this.b$["javax.swing.JTree"].expandedState.remove (b);
1113 this.b$["javax.swing.JTree"].removeDescendantSelectedPaths (a);
1114 }, "javax.swing.event.TreeModelEvent");
1115 c$ = Clazz.p0p ();
1116 };
1117 Clazz.pu$h(self.c$);
1118 c$ = Clazz.declareType (javax.swing.JTree, "EmptySelectionModel", javax.swing.tree.DefaultTreeSelectionModel);
1119 c$.sharedInstance = Clazz.defineMethod (c$, "sharedInstance", 
1120 function () {
1121 return javax.swing.JTree.EmptySelectionModel.$sharedInstance;
1122 });
1123 Clazz.overrideMethod (c$, "setSelectionPaths", 
1124 function (a) {
1125 }, "~A");
1126 Clazz.overrideMethod (c$, "addSelectionPaths", 
1127 function (a) {
1128 }, "~A");
1129 Clazz.overrideMethod (c$, "removeSelectionPaths", 
1130 function (a) {
1131 }, "~A");
1132 c$.$sharedInstance = c$.prototype.$sharedInstance =  new javax.swing.JTree.EmptySelectionModel ();
1133 c$ = Clazz.p0p ();
1134 Clazz.pu$h(self.c$);
1135 c$ = Clazz.decorateAsClass (function () {
1136 this.hasChildren = false;
1137 this.childValue = null;
1138 this.loadedChildren = false;
1139 Clazz.instantialize (this, arguments);
1140 }, javax.swing.JTree, "DynamicUtilTreeNode", javax.swing.tree.DefaultMutableTreeNode);
1141 c$.createChildren = Clazz.defineMethod (c$, "createChildren", 
1142 function (a, b) {
1143 if (Clazz.instanceOf (b, java.util.Vector)) {
1144 var c = b;
1145 for (var d = 0, e = c.size (); d < e; d++) a.add ( new javax.swing.JTree.DynamicUtilTreeNode (c.elementAt (d), c.elementAt (d)));
1146
1147 } else if (Clazz.instanceOf (b, java.util.Hashtable)) {
1148 var c = b;
1149 var d = c.keys ();
1150 var e;
1151 while (d.hasMoreElements ()) {
1152 e = d.nextElement ();
1153 a.add ( new javax.swing.JTree.DynamicUtilTreeNode (e, c.get (e)));
1154 }
1155 } else if (Clazz.instanceOf (b, Array)) {
1156 var c = b;
1157 for (var d = 0, e = c.length; d < e; d++) a.add ( new javax.swing.JTree.DynamicUtilTreeNode (c[d], c[d]));
1158
1159 }}, "javax.swing.tree.DefaultMutableTreeNode,~O");
1160 Clazz.makeConstructor (c$, 
1161 function (a, b) {
1162 Clazz.superConstructor (this, javax.swing.JTree.DynamicUtilTreeNode, [a]);
1163 this.loadedChildren = false;
1164 this.childValue = b;
1165 if (b != null) {
1166 if (Clazz.instanceOf (b, java.util.Vector)) this.setAllowsChildren (true);
1167  else if (Clazz.instanceOf (b, java.util.Hashtable)) this.setAllowsChildren (true);
1168  else if (Clazz.instanceOf (b, Array)) this.setAllowsChildren (true);
1169  else this.setAllowsChildren (false);
1170 } else this.setAllowsChildren (false);
1171 }, "~O,~O");
1172 Clazz.overrideMethod (c$, "isLeaf", 
1173 function () {
1174 return !this.getAllowsChildren ();
1175 });
1176 Clazz.defineMethod (c$, "getChildCount", 
1177 function () {
1178 if (!this.loadedChildren) this.loadChildren ();
1179 return Clazz.superCall (this, javax.swing.JTree.DynamicUtilTreeNode, "getChildCount", []);
1180 });
1181 Clazz.defineMethod (c$, "loadChildren", 
1182 function () {
1183 this.loadedChildren = true;
1184 javax.swing.JTree.DynamicUtilTreeNode.createChildren (this, this.childValue);
1185 });
1186 Clazz.defineMethod (c$, "getChildAt", 
1187 function (a) {
1188 if (!this.loadedChildren) this.loadChildren ();
1189 return Clazz.superCall (this, javax.swing.JTree.DynamicUtilTreeNode, "getChildAt", [a]);
1190 }, "~N");
1191 Clazz.defineMethod (c$, "children", 
1192 function () {
1193 if (!this.loadedChildren) this.loadChildren ();
1194 return Clazz.superCall (this, javax.swing.JTree.DynamicUtilTreeNode, "children", []);
1195 });
1196 c$ = Clazz.p0p ();
1197 Clazz.defineStatics (c$,
1198 "$uiClassID", "TreeUI",
1199 "TEMP_STACK_SIZE", 11,
1200 "CELL_RENDERER_PROPERTY", "cellRenderer",
1201 "TREE_MODEL_PROPERTY", "model",
1202 "ROOT_VISIBLE_PROPERTY", "rootVisible",
1203 "SHOWS_ROOT_HANDLES_PROPERTY", "showsRootHandles",
1204 "ROW_HEIGHT_PROPERTY", "rowHeight",
1205 "CELL_EDITOR_PROPERTY", "cellEditor",
1206 "EDITABLE_PROPERTY", "editable",
1207 "LARGE_MODEL_PROPERTY", "largeModel",
1208 "SELECTION_MODEL_PROPERTY", "selectionModel",
1209 "VISIBLE_ROW_COUNT_PROPERTY", "visibleRowCount",
1210 "INVOKES_STOP_CELL_EDITING_PROPERTY", "invokesStopCellEditing",
1211 "SCROLLS_ON_EXPAND_PROPERTY", "scrollsOnExpand",
1212 "TOGGLE_CLICK_COUNT_PROPERTY", "toggleClickCount",
1213 "LEAD_SELECTION_PATH_PROPERTY", "leadSelectionPath",
1214 "ANCHOR_SELECTION_PATH_PROPERTY", "anchorSelectionPath",
1215 "EXPANDS_SELECTED_PATHS_PROPERTY", "expandsSelectedPaths");
1216 });