93a00981141023a21d767760849e5cc3a0c13b58
[jalviewjs.git] / site / j2s / javax / swing / tree / DefaultTreeSelectionModel.js
1 Clazz.declarePackage ("javax.swing.tree");\r
2 Clazz.load (["javax.swing.tree.TreeSelectionModel", "javax.swing.event.EventListenerList"], ["javax.swing.tree.PathPlaceHolder", "$.DefaultTreeSelectionModel"], ["java.lang.Boolean", "$.StringBuffer", "java.util.BitSet", "$.Hashtable", "$.Vector", "javax.swing.DefaultListSelectionModel", "javax.swing.event.SwingPropertyChangeSupport", "$.TreeSelectionEvent", "$.TreeSelectionListener"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.changeSupport = null;\r
5 this.selection = null;\r
6 this.listenerList = null;\r
7 this.rowMapper = null;\r
8 this.listSelectionModel = null;\r
9 this.selectionMode = 0;\r
10 this.leadPath = null;\r
11 this.leadIndex = 0;\r
12 this.leadRow = 0;\r
13 this.uniquePaths = null;\r
14 this.lastPaths = null;\r
15 this.tempPaths = null;\r
16 Clazz.instantialize (this, arguments);\r
17 }, javax.swing.tree, "DefaultTreeSelectionModel", null, [Cloneable, javax.swing.tree.TreeSelectionModel]);\r
18 Clazz.prepareFields (c$, function () {\r
19 this.listenerList =  new javax.swing.event.EventListenerList ();\r
20 });\r
21 Clazz.makeConstructor (c$, \r
22 function () {\r
23 this.listSelectionModel =  new javax.swing.DefaultListSelectionModel ();\r
24 this.selectionMode = 4;\r
25 this.leadIndex = this.leadRow = -1;\r
26 this.uniquePaths =  new java.util.Hashtable ();\r
27 this.lastPaths =  new java.util.Hashtable ();\r
28 this.tempPaths =  new Array (1);\r
29 });\r
30 Clazz.overrideMethod (c$, "setRowMapper", \r
31 function (newMapper) {\r
32 this.rowMapper = newMapper;\r
33 this.resetRowSelection ();\r
34 }, "javax.swing.tree.RowMapper");\r
35 Clazz.overrideMethod (c$, "getRowMapper", \r
36 function () {\r
37 return this.rowMapper;\r
38 });\r
39 Clazz.overrideMethod (c$, "setSelectionMode", \r
40 function (mode) {\r
41 var oldMode = this.selectionMode;\r
42 this.selectionMode = mode;\r
43 if (this.selectionMode != 1 && this.selectionMode != 2 && this.selectionMode != 4) this.selectionMode = 4;\r
44 if (oldMode != this.selectionMode && this.changeSupport != null) this.changeSupport.firePropertyChange ("selectionMode",  new Integer (oldMode),  new Integer (this.selectionMode));\r
45 }, "~N");\r
46 Clazz.overrideMethod (c$, "getSelectionMode", \r
47 function () {\r
48 return this.selectionMode;\r
49 });\r
50 Clazz.overrideMethod (c$, "setSelectionPath", \r
51 function (path) {\r
52 if (path == null) this.setSelectionPaths (null);\r
53  else {\r
54 var newPaths =  new Array (1);\r
55 newPaths[0] = path;\r
56 this.setSelectionPaths (newPaths);\r
57 }}, "javax.swing.tree.TreePath");\r
58 Clazz.overrideMethod (c$, "setSelectionPaths", \r
59 function (pPaths) {\r
60 var newCount;\r
61 var newCounter;\r
62 var oldCount;\r
63 var oldCounter;\r
64 var paths = pPaths;\r
65 if (paths == null) newCount = 0;\r
66  else newCount = paths.length;\r
67 if (this.selection == null) oldCount = 0;\r
68  else oldCount = this.selection.length;\r
69 if ((newCount + oldCount) != 0) {\r
70 if (this.selectionMode == 1) {\r
71 if (newCount > 1) {\r
72 paths =  new Array (1);\r
73 paths[0] = pPaths[0];\r
74 newCount = 1;\r
75 }} else if (this.selectionMode == 2) {\r
76 if (newCount > 0 && !this.arePathsContiguous (paths)) {\r
77 paths =  new Array (1);\r
78 paths[0] = pPaths[0];\r
79 newCount = 1;\r
80 }}var validCount = 0;\r
81 var beginLeadPath = this.leadPath;\r
82 var cPaths =  new java.util.Vector (newCount + oldCount);\r
83 this.lastPaths.clear ();\r
84 this.leadPath = null;\r
85 for (newCounter = 0; newCounter < newCount; newCounter++) {\r
86 if (paths[newCounter] != null && this.lastPaths.get (paths[newCounter]) == null) {\r
87 validCount++;\r
88 this.lastPaths.put (paths[newCounter], Boolean.TRUE);\r
89 if (this.uniquePaths.get (paths[newCounter]) == null) {\r
90 cPaths.addElement ( new javax.swing.tree.PathPlaceHolder (paths[newCounter], true));\r
91 }this.leadPath = paths[newCounter];\r
92 }}\r
93 var newSelection;\r
94 if (validCount == 0) {\r
95 newSelection = null;\r
96 } else if (validCount != newCount) {\r
97 var keys = this.lastPaths.keys ();\r
98 newSelection =  new Array (validCount);\r
99 validCount = 0;\r
100 while (keys.hasMoreElements ()) {\r
101 newSelection[validCount++] = keys.nextElement ();\r
102 }\r
103 } else {\r
104 newSelection =  new Array (paths.length);\r
105 System.arraycopy (paths, 0, newSelection, 0, paths.length);\r
106 }for (oldCounter = 0; oldCounter < oldCount; oldCounter++) if (this.selection[oldCounter] != null && this.lastPaths.get (this.selection[oldCounter]) == null) cPaths.addElement ( new javax.swing.tree.PathPlaceHolder (this.selection[oldCounter], false));\r
107 \r
108 this.selection = newSelection;\r
109 var tempHT = this.uniquePaths;\r
110 this.uniquePaths = this.lastPaths;\r
111 this.lastPaths = tempHT;\r
112 this.lastPaths.clear ();\r
113 if (this.selection != null) this.insureUniqueness ();\r
114 this.updateLeadIndex ();\r
115 this.resetRowSelection ();\r
116 if (cPaths.size () > 0) this.notifyPathChange (cPaths, beginLeadPath);\r
117 }}, "~A");\r
118 Clazz.overrideMethod (c$, "addSelectionPath", \r
119 function (path) {\r
120 if (path != null) {\r
121 var toAdd =  new Array (1);\r
122 toAdd[0] = path;\r
123 this.addSelectionPaths (toAdd);\r
124 }}, "javax.swing.tree.TreePath");\r
125 Clazz.overrideMethod (c$, "addSelectionPaths", \r
126 function (paths) {\r
127 var newPathLength = ((paths == null) ? 0 : paths.length);\r
128 if (newPathLength > 0) {\r
129 if (this.selectionMode == 1) {\r
130 this.setSelectionPaths (paths);\r
131 } else if (this.selectionMode == 2 && !this.canPathsBeAdded (paths)) {\r
132 if (this.arePathsContiguous (paths)) {\r
133 this.setSelectionPaths (paths);\r
134 } else {\r
135 var newPaths =  new Array (1);\r
136 newPaths[0] = paths[0];\r
137 this.setSelectionPaths (newPaths);\r
138 }} else {\r
139 var counter;\r
140 var validCount;\r
141 var oldCount;\r
142 var beginLeadPath = this.leadPath;\r
143 var cPaths = null;\r
144 if (this.selection == null) oldCount = 0;\r
145  else oldCount = this.selection.length;\r
146 this.lastPaths.clear ();\r
147 for (counter = 0, validCount = 0; counter < newPathLength; counter++) {\r
148 if (paths[counter] != null) {\r
149 if (this.uniquePaths.get (paths[counter]) == null) {\r
150 validCount++;\r
151 if (cPaths == null) cPaths =  new java.util.Vector ();\r
152 cPaths.addElement ( new javax.swing.tree.PathPlaceHolder (paths[counter], true));\r
153 this.uniquePaths.put (paths[counter], Boolean.TRUE);\r
154 this.lastPaths.put (paths[counter], Boolean.TRUE);\r
155 }this.leadPath = paths[counter];\r
156 }}\r
157 if (this.leadPath == null) {\r
158 this.leadPath = beginLeadPath;\r
159 }if (validCount > 0) {\r
160 var newSelection =  new Array (oldCount + validCount);\r
161 if (oldCount > 0) System.arraycopy (this.selection, 0, newSelection, 0, oldCount);\r
162 if (validCount != paths.length) {\r
163 var newPaths = this.lastPaths.keys ();\r
164 counter = oldCount;\r
165 while (newPaths.hasMoreElements ()) {\r
166 newSelection[counter++] = newPaths.nextElement ();\r
167 }\r
168 } else {\r
169 System.arraycopy (paths, 0, newSelection, oldCount, validCount);\r
170 }this.selection = newSelection;\r
171 this.insureUniqueness ();\r
172 this.updateLeadIndex ();\r
173 this.resetRowSelection ();\r
174 this.notifyPathChange (cPaths, beginLeadPath);\r
175 } else this.leadPath = beginLeadPath;\r
176 this.lastPaths.clear ();\r
177 }}}, "~A");\r
178 Clazz.overrideMethod (c$, "removeSelectionPath", \r
179 function (path) {\r
180 if (path != null) {\r
181 var rPath =  new Array (1);\r
182 rPath[0] = path;\r
183 this.removeSelectionPaths (rPath);\r
184 }}, "javax.swing.tree.TreePath");\r
185 Clazz.overrideMethod (c$, "removeSelectionPaths", \r
186 function (paths) {\r
187 if (paths != null && this.selection != null && paths.length > 0) {\r
188 if (!this.canPathsBeRemoved (paths)) {\r
189 this.clearSelection ();\r
190 } else {\r
191 var pathsToRemove = null;\r
192 for (var removeCounter = paths.length - 1; removeCounter >= 0; removeCounter--) {\r
193 if (paths[removeCounter] != null) {\r
194 if (this.uniquePaths.get (paths[removeCounter]) != null) {\r
195 if (pathsToRemove == null) pathsToRemove =  new java.util.Vector (paths.length);\r
196 this.uniquePaths.remove (paths[removeCounter]);\r
197 pathsToRemove.addElement ( new javax.swing.tree.PathPlaceHolder (paths[removeCounter], false));\r
198 }}}\r
199 if (pathsToRemove != null) {\r
200 var removeCount = pathsToRemove.size ();\r
201 var beginLeadPath = this.leadPath;\r
202 if (removeCount == this.selection.length) {\r
203 this.selection = null;\r
204 } else {\r
205 var pEnum = this.uniquePaths.keys ();\r
206 var validCount = 0;\r
207 this.selection =  new Array (this.selection.length - removeCount);\r
208 while (pEnum.hasMoreElements ()) {\r
209 this.selection[validCount++] = pEnum.nextElement ();\r
210 }\r
211 }if (this.leadPath != null && this.uniquePaths.get (this.leadPath) == null) {\r
212 if (this.selection != null) {\r
213 this.leadPath = this.selection[this.selection.length - 1];\r
214 } else {\r
215 this.leadPath = null;\r
216 }} else if (this.selection != null) {\r
217 this.leadPath = this.selection[this.selection.length - 1];\r
218 } else {\r
219 this.leadPath = null;\r
220 }this.updateLeadIndex ();\r
221 this.resetRowSelection ();\r
222 this.notifyPathChange (pathsToRemove, beginLeadPath);\r
223 }}}}, "~A");\r
224 Clazz.overrideMethod (c$, "getSelectionPath", \r
225 function () {\r
226 if (this.selection != null) return this.selection[0];\r
227 return null;\r
228 });\r
229 Clazz.overrideMethod (c$, "getSelectionPaths", \r
230 function () {\r
231 if (this.selection != null) {\r
232 var pathSize = this.selection.length;\r
233 var result =  new Array (pathSize);\r
234 System.arraycopy (this.selection, 0, result, 0, pathSize);\r
235 return result;\r
236 }return null;\r
237 });\r
238 Clazz.overrideMethod (c$, "getSelectionCount", \r
239 function () {\r
240 return (this.selection == null) ? 0 : this.selection.length;\r
241 });\r
242 Clazz.overrideMethod (c$, "isPathSelected", \r
243 function (path) {\r
244 return (path != null) ? (this.uniquePaths.get (path) != null) : false;\r
245 }, "javax.swing.tree.TreePath");\r
246 Clazz.overrideMethod (c$, "isSelectionEmpty", \r
247 function () {\r
248 return (this.selection == null);\r
249 });\r
250 Clazz.overrideMethod (c$, "clearSelection", \r
251 function () {\r
252 if (this.selection != null) {\r
253 var selSize = this.selection.length;\r
254 var newness =  Clazz.newBooleanArray (selSize, false);\r
255 for (var counter = 0; counter < selSize; counter++) newness[counter] = false;\r
256 \r
257 var event =  new javax.swing.event.TreeSelectionEvent (this, this.selection, newness, this.leadPath, null);\r
258 this.leadPath = null;\r
259 this.leadIndex = this.leadRow = -1;\r
260 this.uniquePaths.clear ();\r
261 this.selection = null;\r
262 this.resetRowSelection ();\r
263 this.fireValueChanged (event);\r
264 }});\r
265 Clazz.overrideMethod (c$, "addTreeSelectionListener", \r
266 function (x) {\r
267 this.listenerList.add (javax.swing.event.TreeSelectionListener, x);\r
268 }, "javax.swing.event.TreeSelectionListener");\r
269 Clazz.overrideMethod (c$, "removeTreeSelectionListener", \r
270 function (x) {\r
271 this.listenerList.remove (javax.swing.event.TreeSelectionListener, x);\r
272 }, "javax.swing.event.TreeSelectionListener");\r
273 Clazz.defineMethod (c$, "getTreeSelectionListeners", \r
274 function () {\r
275 return this.listenerList.getListeners (javax.swing.event.TreeSelectionListener);\r
276 });\r
277 Clazz.defineMethod (c$, "fireValueChanged", \r
278 function (e) {\r
279 var listeners = this.listenerList.getListenerList ();\r
280 for (var i = listeners.length - 2; i >= 0; i -= 2) {\r
281 if (listeners[i] === javax.swing.event.TreeSelectionListener) {\r
282 (listeners[i + 1]).valueChanged (e);\r
283 }}\r
284 }, "javax.swing.event.TreeSelectionEvent");\r
285 Clazz.defineMethod (c$, "getListeners", \r
286 function (listenerType) {\r
287 return this.listenerList.getListeners (listenerType);\r
288 }, "Class");\r
289 Clazz.overrideMethod (c$, "getSelectionRows", \r
290 function () {\r
291 if (this.rowMapper != null && this.selection != null) {\r
292 var rows = this.rowMapper.getRowsForPaths (this.selection);\r
293 if (rows != null) {\r
294 var invisCount = 0;\r
295 for (var counter = rows.length - 1; counter >= 0; counter--) {\r
296 if (rows[counter] == -1) {\r
297 invisCount++;\r
298 }}\r
299 if (invisCount > 0) {\r
300 if (invisCount == rows.length) {\r
301 rows = null;\r
302 } else {\r
303 var tempRows =  Clazz.newIntArray (rows.length - invisCount, 0);\r
304 for (var counter = rows.length - 1, visCounter = 0; counter >= 0; counter--) {\r
305 if (rows[counter] != -1) {\r
306 tempRows[visCounter++] = rows[counter];\r
307 }}\r
308 rows = tempRows;\r
309 }}}return rows;\r
310 }return null;\r
311 });\r
312 Clazz.overrideMethod (c$, "getMinSelectionRow", \r
313 function () {\r
314 return this.listSelectionModel.getMinSelectionIndex ();\r
315 });\r
316 Clazz.overrideMethod (c$, "getMaxSelectionRow", \r
317 function () {\r
318 return this.listSelectionModel.getMaxSelectionIndex ();\r
319 });\r
320 Clazz.overrideMethod (c$, "isRowSelected", \r
321 function (row) {\r
322 return this.listSelectionModel.isSelectedIndex (row);\r
323 }, "~N");\r
324 Clazz.overrideMethod (c$, "resetRowSelection", \r
325 function () {\r
326 this.listSelectionModel.clearSelection ();\r
327 if (this.selection != null && this.rowMapper != null) {\r
328 var aRow;\r
329 var validCount = 0;\r
330 var rows = this.rowMapper.getRowsForPaths (this.selection);\r
331 for (var counter = 0, maxCounter = this.selection.length; counter < maxCounter; counter++) {\r
332 aRow = rows[counter];\r
333 if (aRow != -1) {\r
334 this.listSelectionModel.addSelectionInterval (aRow, aRow);\r
335 }}\r
336 if (this.leadIndex != -1 && rows != null) {\r
337 this.leadRow = rows[this.leadIndex];\r
338 } else if (this.leadPath != null) {\r
339 this.tempPaths[0] = this.leadPath;\r
340 rows = this.rowMapper.getRowsForPaths (this.tempPaths);\r
341 this.leadRow = (rows != null) ? rows[0] : -1;\r
342 } else {\r
343 this.leadRow = -1;\r
344 }this.insureRowContinuity ();\r
345 } else this.leadRow = -1;\r
346 });\r
347 Clazz.overrideMethod (c$, "getLeadSelectionRow", \r
348 function () {\r
349 return this.leadRow;\r
350 });\r
351 Clazz.overrideMethod (c$, "getLeadSelectionPath", \r
352 function () {\r
353 return this.leadPath;\r
354 });\r
355 Clazz.overrideMethod (c$, "addPropertyChangeListener", \r
356 function (listener) {\r
357 if (this.changeSupport == null) {\r
358 this.changeSupport =  new javax.swing.event.SwingPropertyChangeSupport (this);\r
359 }this.changeSupport.addPropertyChangeListener (listener);\r
360 }, "java.beans.PropertyChangeListener");\r
361 Clazz.overrideMethod (c$, "removePropertyChangeListener", \r
362 function (listener) {\r
363 if (this.changeSupport == null) {\r
364 return;\r
365 }this.changeSupport.removePropertyChangeListener (listener);\r
366 }, "java.beans.PropertyChangeListener");\r
367 Clazz.defineMethod (c$, "getPropertyChangeListeners", \r
368 function () {\r
369 if (this.changeSupport == null) {\r
370 return  new Array (0);\r
371 }return this.changeSupport.getPropertyChangeListeners ();\r
372 });\r
373 Clazz.defineMethod (c$, "insureRowContinuity", \r
374 function () {\r
375 if (this.selectionMode == 2 && this.selection != null && this.rowMapper != null) {\r
376 var lModel = this.listSelectionModel;\r
377 var min = lModel.getMinSelectionIndex ();\r
378 if (min != -1) {\r
379 for (var counter = min, maxCounter = lModel.getMaxSelectionIndex (); counter <= maxCounter; counter++) {\r
380 if (!lModel.isSelectedIndex (counter)) {\r
381 if (counter == min) {\r
382 this.clearSelection ();\r
383 } else {\r
384 var newSel =  new Array (counter - min);\r
385 var selectionIndex = this.rowMapper.getRowsForPaths (this.selection);\r
386 for (var i = 0; i < selectionIndex.length; i++) {\r
387 if (selectionIndex[i] < counter) {\r
388 newSel[selectionIndex[i] - min] = this.selection[i];\r
389 }}\r
390 this.setSelectionPaths (newSel);\r
391 break;\r
392 }}}\r
393 }} else if (this.selectionMode == 1 && this.selection != null && this.selection.length > 1) {\r
394 this.setSelectionPath (this.selection[0]);\r
395 }});\r
396 Clazz.defineMethod (c$, "arePathsContiguous", \r
397 function (paths) {\r
398 if (this.rowMapper == null || paths.length < 2) return true;\r
399  else {\r
400 var bitSet =  new java.util.BitSet (32);\r
401 var anIndex;\r
402 var counter;\r
403 var min;\r
404 var pathCount = paths.length;\r
405 var validCount = 0;\r
406 var tempPath =  new Array (1);\r
407 tempPath[0] = paths[0];\r
408 min = this.rowMapper.getRowsForPaths (tempPath)[0];\r
409 for (counter = 0; counter < pathCount; counter++) {\r
410 if (paths[counter] != null) {\r
411 tempPath[0] = paths[counter];\r
412 var rows = this.rowMapper.getRowsForPaths (tempPath);\r
413 if (rows == null) {\r
414 return false;\r
415 }anIndex = rows[0];\r
416 if (anIndex == -1 || anIndex < (min - pathCount) || anIndex > (min + pathCount)) return false;\r
417 if (anIndex < min) min = anIndex;\r
418 if (!bitSet.get (anIndex)) {\r
419 bitSet.set (anIndex);\r
420 validCount++;\r
421 }}}\r
422 var maxCounter = validCount + min;\r
423 for (counter = min; counter < maxCounter; counter++) if (!bitSet.get (counter)) return false;\r
424 \r
425 }return true;\r
426 }, "~A");\r
427 Clazz.defineMethod (c$, "canPathsBeAdded", \r
428 function (paths) {\r
429 if (paths == null || paths.length == 0 || this.rowMapper == null || this.selection == null || this.selectionMode == 4) return true;\r
430  else {\r
431 var bitSet =  new java.util.BitSet ();\r
432 var lModel = this.listSelectionModel;\r
433 var anIndex;\r
434 var counter;\r
435 var min = lModel.getMinSelectionIndex ();\r
436 var max = lModel.getMaxSelectionIndex ();\r
437 var tempPath =  new Array (1);\r
438 if (min != -1) {\r
439 for (counter = min; counter <= max; counter++) {\r
440 if (lModel.isSelectedIndex (counter)) bitSet.set (counter);\r
441 }\r
442 } else {\r
443 tempPath[0] = paths[0];\r
444 min = max = this.rowMapper.getRowsForPaths (tempPath)[0];\r
445 }for (counter = paths.length - 1; counter >= 0; counter--) {\r
446 if (paths[counter] != null) {\r
447 tempPath[0] = paths[counter];\r
448 var rows = this.rowMapper.getRowsForPaths (tempPath);\r
449 if (rows == null) {\r
450 return false;\r
451 }anIndex = rows[0];\r
452 min = Math.min (anIndex, min);\r
453 max = Math.max (anIndex, max);\r
454 if (anIndex == -1) return false;\r
455 bitSet.set (anIndex);\r
456 }}\r
457 for (counter = min; counter <= max; counter++) if (!bitSet.get (counter)) return false;\r
458 \r
459 }return true;\r
460 }, "~A");\r
461 Clazz.defineMethod (c$, "canPathsBeRemoved", \r
462 function (paths) {\r
463 if (this.rowMapper == null || this.selection == null || this.selectionMode == 4) return true;\r
464  else {\r
465 var bitSet =  new java.util.BitSet ();\r
466 var counter;\r
467 var pathCount = paths.length;\r
468 var anIndex;\r
469 var min = -1;\r
470 var validCount = 0;\r
471 var tempPath =  new Array (1);\r
472 var rows;\r
473 this.lastPaths.clear ();\r
474 for (counter = 0; counter < pathCount; counter++) {\r
475 if (paths[counter] != null) {\r
476 this.lastPaths.put (paths[counter], Boolean.TRUE);\r
477 }}\r
478 for (counter = this.selection.length - 1; counter >= 0; counter--) {\r
479 if (this.lastPaths.get (this.selection[counter]) == null) {\r
480 tempPath[0] = this.selection[counter];\r
481 rows = this.rowMapper.getRowsForPaths (tempPath);\r
482 if (rows != null && rows[0] != -1 && !bitSet.get (rows[0])) {\r
483 validCount++;\r
484 if (min == -1) min = rows[0];\r
485  else min = Math.min (min, rows[0]);\r
486 bitSet.set (rows[0]);\r
487 }}}\r
488 this.lastPaths.clear ();\r
489 if (validCount > 1) {\r
490 for (counter = min + validCount - 1; counter >= min; counter--) if (!bitSet.get (counter)) return false;\r
491 \r
492 }}return true;\r
493 }, "~A");\r
494 Clazz.defineMethod (c$, "notifyPathChange", \r
495 function (changedPaths, oldLeadSelection) {\r
496 var cPathCount = changedPaths.size ();\r
497 var newness =  Clazz.newBooleanArray (cPathCount, false);\r
498 var paths =  new Array (cPathCount);\r
499 var placeholder;\r
500 for (var counter = 0; counter < cPathCount; counter++) {\r
501 placeholder = changedPaths.elementAt (counter);\r
502 newness[counter] = placeholder.isNew;\r
503 paths[counter] = placeholder.path;\r
504 }\r
505 var event =  new javax.swing.event.TreeSelectionEvent (this, paths, newness, oldLeadSelection, this.leadPath);\r
506 this.fireValueChanged (event);\r
507 }, "java.util.Vector,javax.swing.tree.TreePath");\r
508 Clazz.defineMethod (c$, "updateLeadIndex", \r
509 function () {\r
510 if (this.leadPath != null) {\r
511 if (this.selection == null) {\r
512 this.leadPath = null;\r
513 this.leadIndex = this.leadRow = -1;\r
514 } else {\r
515 this.leadRow = this.leadIndex = -1;\r
516 for (var counter = this.selection.length - 1; counter >= 0; counter--) {\r
517 if (this.selection[counter] === this.leadPath) {\r
518 this.leadIndex = counter;\r
519 break;\r
520 }}\r
521 }} else {\r
522 this.leadIndex = -1;\r
523 }});\r
524 Clazz.defineMethod (c$, "insureUniqueness", \r
525 function () {\r
526 });\r
527 Clazz.overrideMethod (c$, "toString", \r
528 function () {\r
529 var selCount = this.getSelectionCount ();\r
530 var retBuffer =  new StringBuffer ();\r
531 var rows;\r
532 if (this.rowMapper != null) rows = this.rowMapper.getRowsForPaths (this.selection);\r
533  else rows = null;\r
534 retBuffer.append (this.getClass ().getName () + " " + this.hashCode () + " [ ");\r
535 for (var counter = 0; counter < selCount; counter++) {\r
536 if (rows != null) retBuffer.append (this.selection[counter].toString () + "@" + Integer.toString (rows[counter]) + " ");\r
537  else retBuffer.append (this.selection[counter].toString () + " ");\r
538 }\r
539 retBuffer.append ("]");\r
540 return retBuffer.toString ();\r
541 });\r
542 Clazz.defineMethod (c$, "clone", \r
543 function () {\r
544 var clone = Clazz.superCall (this, javax.swing.tree.DefaultTreeSelectionModel, "clone", []);\r
545 clone.changeSupport = null;\r
546 if (this.selection != null) {\r
547 var selLength = this.selection.length;\r
548 clone.selection =  new Array (selLength);\r
549 System.arraycopy (this.selection, 0, clone.selection, 0, selLength);\r
550 }clone.listenerList =  new javax.swing.event.EventListenerList ();\r
551 clone.listSelectionModel = this.listSelectionModel.clone ();\r
552 clone.uniquePaths =  new java.util.Hashtable ();\r
553 clone.lastPaths =  new java.util.Hashtable ();\r
554 clone.tempPaths =  new Array (1);\r
555 return clone;\r
556 });\r
557 Clazz.defineStatics (c$,\r
558 "SELECTION_MODE_PROPERTY", "selectionMode");\r
559 c$ = Clazz.decorateAsClass (function () {\r
560 this.isNew = false;\r
561 this.path = null;\r
562 Clazz.instantialize (this, arguments);\r
563 }, javax.swing.tree, "PathPlaceHolder");\r
564 Clazz.makeConstructor (c$, \r
565 function (path, isNew) {\r
566 this.path = path;\r
567 this.isNew = isNew;\r
568 }, "javax.swing.tree.TreePath,~B");\r
569 });\r