67 |
public static final String SELECTION_MODE_PROPERTY = "selectionMode"; |
public static final String SELECTION_MODE_PROPERTY = "selectionMode"; |
68 |
|
|
69 |
/** |
/** |
70 |
* changeSupport |
* Our Swing property change support. |
71 |
*/ |
*/ |
72 |
protected SwingPropertyChangeSupport changeSupport; |
protected SwingPropertyChangeSupport changeSupport; |
73 |
|
|
74 |
/** |
/** |
75 |
* selection |
* The current selection. |
76 |
*/ |
*/ |
77 |
protected TreePath[] selection; |
protected TreePath[] selection; |
78 |
|
|
79 |
/** |
/** |
80 |
* listenerList |
* Our TreeSelectionListeners. |
81 |
*/ |
*/ |
82 |
protected EventListenerList listenerList; |
protected EventListenerList listenerList; |
83 |
|
|
84 |
/** |
/** |
85 |
* rowMapper |
* The current RowMapper. |
86 |
*/ |
*/ |
87 |
protected transient RowMapper rowMapper; |
protected transient RowMapper rowMapper; |
88 |
|
|
89 |
/** |
/** |
90 |
* listSelectionModel |
* The current listSelectionModel. |
91 |
*/ |
*/ |
92 |
protected DefaultListSelectionModel listSelectionModel; |
protected DefaultListSelectionModel listSelectionModel; |
93 |
|
|
94 |
/** |
/** |
95 |
* selectionMode |
* The current selection mode. |
96 |
*/ |
*/ |
97 |
protected int selectionMode; |
protected int selectionMode; |
98 |
|
|
99 |
/** |
/** |
100 |
* leadPath |
* The path that has been added last. |
101 |
*/ |
*/ |
102 |
protected TreePath leadPath; |
protected TreePath leadPath; |
103 |
|
|
104 |
/** |
/** |
105 |
* leadIndex |
* The index of the last added path. |
106 |
*/ |
*/ |
107 |
protected int leadIndex; |
protected int leadIndex; |
108 |
|
|
109 |
/** |
/** |
110 |
* leadRow |
* The row of the last added path according to the RowMapper. |
111 |
*/ |
*/ |
112 |
protected int leadRow; |
protected int leadRow; |
113 |
|
|
114 |
/** |
/** |
115 |
* Constructor DefaultTreeSelectionModel |
* Constructs a new DefaultTreeSelectionModel. |
116 |
*/ |
*/ |
117 |
public DefaultTreeSelectionModel() |
public DefaultTreeSelectionModel() |
118 |
{ |
{ |
120 |
} |
} |
121 |
|
|
122 |
/** |
/** |
123 |
* clone |
* Creates a clone of this DefaultTreeSelectionModel with the same |
124 |
* @exception CloneNotSupportedException TODO |
* selection. |
125 |
* @return Object |
* |
126 |
|
* @exception CloneNotSupportedException should not be thrown here |
127 |
|
* |
128 |
|
* @return a clone of this DefaultTreeSelectionModel |
129 |
*/ |
*/ |
130 |
public Object clone() throws CloneNotSupportedException |
public Object clone() throws CloneNotSupportedException |
131 |
{ |
{ |
133 |
} |
} |
134 |
|
|
135 |
/** |
/** |
136 |
* toString |
* Returns a string that shows this object's properties. |
137 |
* @return String |
* |
138 |
|
* @return a string that shows this object's properties |
139 |
*/ |
*/ |
140 |
public String toString() |
public String toString() |
141 |
{ |
{ |
165 |
} |
} |
166 |
|
|
167 |
/** |
/** |
168 |
* setRowMapper |
* Sets the RowMapper that should be used to map between paths and their |
169 |
* @param value0 TODO |
* rows. |
170 |
|
* |
171 |
|
* @param rowMapper the RowMapper to set |
172 |
|
* |
173 |
|
* @see {@link RowMapper |
174 |
*/ |
*/ |
175 |
public void setRowMapper(RowMapper value0) |
public void setRowMapper(RowMapper value0) |
176 |
{ |
{ |
178 |
} |
} |
179 |
|
|
180 |
/** |
/** |
181 |
* getRowMapper |
* Returns the RowMapper that is currently used to map between paths and |
182 |
* @return RowMapper |
* their rows. |
183 |
|
* |
184 |
|
* @return the current RowMapper |
185 |
|
* |
186 |
|
* @see {@link RowMapper |
187 |
*/ |
*/ |
188 |
public RowMapper getRowMapper() |
public RowMapper getRowMapper() |
189 |
{ |
{ |
191 |
} |
} |
192 |
|
|
193 |
/** |
/** |
194 |
* setSelectionMode |
* Sets the current selection mode. Possible values are |
195 |
* @param value0 TODO |
* {@link #SINGLE_TREE_SELECTION}, {@link CONTIGUOUS_TREE_SELECTION} |
196 |
|
* and {@link #DISCONTIGUOUS_TREE_SELECTION}. |
197 |
|
* |
198 |
|
* @param mode the selection mode to be set |
199 |
|
* |
200 |
|
* @see {@link #getSelectionMode} |
201 |
|
* @see {@link #SINGLE_TREE_SELECTION} |
202 |
|
* @see {@link #CONTIGUOUS_TREE_SELECTION} |
203 |
|
* @see {@link #DISCONTIGUOUS_TREE_SELECTION} |
204 |
*/ |
*/ |
205 |
public void setSelectionMode(int value0) |
public void setSelectionMode(int value0) |
206 |
{ |
{ |
208 |
} |
} |
209 |
|
|
210 |
/** |
/** |
211 |
* getSelectionMode |
* Returns the current selection mode. |
212 |
* @return int |
* |
213 |
|
* @return the current selection mode |
214 |
|
* |
215 |
|
* @see {@link #setSelectionMode} |
216 |
|
* @see {@link #SINGLE_TREE_SELECTION} |
217 |
|
* @see {@link #CONTIGUOUS_TREE_SELECTION} |
218 |
|
* @see {@link #DISCONTIGUOUS_TREE_SELECTION} |
219 |
*/ |
*/ |
220 |
public int getSelectionMode() |
public int getSelectionMode() |
221 |
{ |
{ |
223 |
} |
} |
224 |
|
|
225 |
/** |
/** |
226 |
* setSelectionPath |
* Sets this path as the only selection. |
227 |
* @param value0 TODO |
* |
228 |
|
* If this changes the selection the registered TreeSelectionListeners |
229 |
|
* are notified. |
230 |
|
* |
231 |
|
* @param path the path to set as selection |
232 |
*/ |
*/ |
233 |
public void setSelectionPath(TreePath value0) |
public void setSelectionPath(TreePath value0) |
234 |
{ |
{ |
236 |
} |
} |
237 |
|
|
238 |
/** |
/** |
239 |
* setSelectionPaths |
* Sets the paths as selection. This method checks for duplicates and |
240 |
* @param value0 TODO |
* removes them. |
241 |
|
* |
242 |
|
* If this changes the selection the registered TreeSelectionListeners |
243 |
|
* are notified. |
244 |
|
* |
245 |
|
* @param paths the paths to set as selection |
246 |
*/ |
*/ |
247 |
public void setSelectionPaths(TreePath[] value0) |
public void setSelectionPaths(TreePath[] value0) |
248 |
{ |
{ |
250 |
} |
} |
251 |
|
|
252 |
/** |
/** |
253 |
* addSelectionPath |
* Adds a path to the list of selected paths. This method checks if the |
254 |
* @param value0 TODO |
* path is already selected and doesn't add the same path twice. |
255 |
|
* |
256 |
|
* If this changes the selection the registered TreeSelectionListeners |
257 |
|
* are notified. |
258 |
|
* |
259 |
|
* @param path the path to add to the selection |
260 |
*/ |
*/ |
261 |
public void addSelectionPath(TreePath value0) |
public void addSelectionPath(TreePath value0) |
262 |
{ |
{ |
264 |
} |
} |
265 |
|
|
266 |
/** |
/** |
267 |
* addSelectionPaths |
* Adds the paths to the list of selected paths. This method checks if the |
268 |
* @param value0 TODO |
* paths are already selected and doesn't add the same path twice. |
269 |
|
* |
270 |
|
* If this changes the selection the registered TreeSelectionListeners |
271 |
|
* are notified. |
272 |
|
* |
273 |
|
* @param paths the paths to add to the selection |
274 |
*/ |
*/ |
275 |
public void addSelectionPaths(TreePath[] value0) |
public void addSelectionPaths(TreePath[] value0) |
276 |
{ |
{ |
278 |
} |
} |
279 |
|
|
280 |
/** |
/** |
281 |
* removeSelectionPath |
* Removes the path from the selection. |
282 |
* @param value0 TODO |
* |
283 |
|
* If this changes the selection the registered TreeSelectionListeners |
284 |
|
* are notified. |
285 |
|
* |
286 |
|
* @param path the path to remove |
287 |
*/ |
*/ |
288 |
public void removeSelectionPath(TreePath value0) |
public void removeSelectionPath(TreePath value0) |
289 |
{ |
{ |
291 |
} |
} |
292 |
|
|
293 |
/** |
/** |
294 |
* removeSelectionPaths |
* Removes the paths from the selection. |
295 |
* @param value0 TODO |
* |
296 |
|
* If this changes the selection the registered TreeSelectionListeners |
297 |
|
* are notified. |
298 |
|
* |
299 |
|
* @param paths the path to remove |
300 |
*/ |
*/ |
301 |
public void removeSelectionPaths(TreePath[] value0) |
public void removeSelectionPaths(TreePath[] value0) |
302 |
{ |
{ |
304 |
} |
} |
305 |
|
|
306 |
/** |
/** |
307 |
* getSelectionPath |
* Returns the first path in the selection. This is especially useful |
308 |
* @return TreePath |
* when the selectionMode is {@link #SINGLE_TREE_SELECTION}. |
309 |
|
* |
310 |
|
* @return the first path in the selection |
311 |
*/ |
*/ |
312 |
public TreePath getSelectionPath() |
public TreePath getSelectionPath() |
313 |
{ |
{ |
315 |
} |
} |
316 |
|
|
317 |
/** |
/** |
318 |
* getSelectionPaths |
* Returns the complete selection. |
319 |
* @return TreePath[] |
* |
320 |
|
* @return the complete selection |
321 |
*/ |
*/ |
322 |
public TreePath[] getSelectionPaths() |
public TreePath[] getSelectionPaths() |
323 |
{ |
{ |
325 |
} |
} |
326 |
|
|
327 |
/** |
/** |
328 |
* getSelectionCount |
* Returns the number of paths in the selection. |
329 |
* @return int |
* |
330 |
|
* @return the number of paths in the selection |
331 |
*/ |
*/ |
332 |
public int getSelectionCount() |
public int getSelectionCount() |
333 |
{ |
{ |
335 |
} |
} |
336 |
|
|
337 |
/** |
/** |
338 |
* isPathSelected |
* Checks if a given path is in the selection. |
339 |
* @param value0 TODO |
* |
340 |
* @return boolean |
* @param path the path to check |
341 |
|
* |
342 |
|
* @return <code>true</code> if the path is in the selection, |
343 |
|
* <code>false</code> otherwise |
344 |
*/ |
*/ |
345 |
public boolean isPathSelected(TreePath value0) |
public boolean isPathSelected(TreePath value0) |
346 |
{ |
{ |
348 |
} |
} |
349 |
|
|
350 |
/** |
/** |
351 |
* isSelectionEmpty |
* Checks if the selection is empty. |
352 |
* @return boolean |
* |
353 |
|
* @return <code>true</code> if the selection is empty, |
354 |
|
* <code>false</code> otherwise |
355 |
*/ |
*/ |
356 |
public boolean isSelectionEmpty() |
public boolean isSelectionEmpty() |
357 |
{ |
{ |
359 |
} |
} |
360 |
|
|
361 |
/** |
/** |
362 |
* clearSelection |
* Removes all paths from the selection. |
363 |
*/ |
*/ |
364 |
public void clearSelection() |
public void clearSelection() |
365 |
{ |
{ |
426 |
} |
} |
427 |
|
|
428 |
/** |
/** |
429 |
* getSelectionRows |
* Returns the currently selected rows. |
430 |
* @return int[] |
* |
431 |
|
* @return the currently selected rows |
432 |
*/ |
*/ |
433 |
public int[] getSelectionRows() |
public int[] getSelectionRows() |
434 |
{ |
{ |
436 |
} |
} |
437 |
|
|
438 |
/** |
/** |
439 |
* getMinSelectionRow |
* Returns the smallest row index from the selection. |
440 |
* @return int |
* |
441 |
|
* @return the smallest row index from the selection |
442 |
*/ |
*/ |
443 |
public int getMinSelectionRow() |
public int getMinSelectionRow() |
444 |
{ |
{ |
446 |
} |
} |
447 |
|
|
448 |
/** |
/** |
449 |
* getMaxSelectionRow |
* Returns the largest row index from the selection. |
450 |
* @return int |
* |
451 |
|
* @return the largest row index from the selection |
452 |
*/ |
*/ |
453 |
public int getMaxSelectionRow() |
public int getMaxSelectionRow() |
454 |
{ |
{ |
456 |
} |
} |
457 |
|
|
458 |
/** |
/** |
459 |
* isRowSelected |
* Checks if a particular row is selected. |
460 |
* @param value0 TODO |
* |
461 |
* @return boolean |
* @param row the index of the row to check |
462 |
|
* |
463 |
|
* @return <code>true</code> if the row is in this selection, |
464 |
|
* <code>false</code> otherwise |
465 |
*/ |
*/ |
466 |
public boolean isRowSelected(int value0) |
public boolean isRowSelected(int value0) |
467 |
{ |
{ |
469 |
} |
} |
470 |
|
|
471 |
/** |
/** |
472 |
* resetRowSelection |
* Updates the mappings from TreePaths to row indices. |
473 |
*/ |
*/ |
474 |
public void resetRowSelection() |
public void resetRowSelection() |
475 |
{ |
{ |
527 |
} |
} |
528 |
|
|
529 |
/** |
/** |
530 |
* insureRowContinuity |
* Makes sure the currently selected paths are valid according to the |
531 |
|
* current selectionMode. |
532 |
|
* |
533 |
|
* If the selectionMode is set to {@link CONTIGUOUS_TREE_SELECTION} |
534 |
|
* and the selection isn't contiguous then the selection is reset to |
535 |
|
* the first set of contguous paths. |
536 |
|
* |
537 |
|
* If the selectionMode is set to {@link SINGLE_TREE_SELECTION} |
538 |
|
* and the selection has more than one path, the selection is reset to |
539 |
|
* the contain only the first path. |
540 |
*/ |
*/ |
541 |
protected void insureRowContinuity() |
protected void insureRowContinuity() |
542 |
{ |
{ |
544 |
} |
} |
545 |
|
|
546 |
/** |
/** |
547 |
* arePathsContiguous |
* Returns <code>true</code> if the paths are contiguous or we |
548 |
* @param value0 TODO |
* have no RowMapper assigned. |
549 |
* @return boolean |
* |
550 |
|
* @param paths the paths to check for continuity |
551 |
|
* @return <code>true</code> if the paths are contiguous or we |
552 |
|
* have no RowMapper assigned |
553 |
*/ |
*/ |
554 |
protected boolean arePathsContiguous(TreePath[] value0) |
protected boolean arePathsContiguous(TreePath[] value0) |
555 |
{ |
{ |
557 |
} |
} |
558 |
|
|
559 |
/** |
/** |
560 |
* canPathsBeAdded |
* Checks if the paths can be added. This returns <code>true</code> if: |
561 |
* @param value0 TODO |
* <ul> |
562 |
* @return boolean |
* <li><code>paths</code> is <code>null</code> or empty</li> |
563 |
|
* <li>we have no RowMapper assigned</li> |
564 |
|
* <li>nothing is currently selected</li> |
565 |
|
* <li>selectionMode is {@link DISCONTIGUOUS_TREE_SELECTION</li> |
566 |
|
* <li>adding the paths to the selection still results in a contiguous set |
567 |
|
* of paths</li> |
568 |
|
* |
569 |
|
* @param paths the paths to check |
570 |
|
* |
571 |
|
* @return <code>true</code> if the paths can be added with respect to the |
572 |
|
* selectionMode |
573 |
*/ |
*/ |
574 |
protected boolean canPathsBeAdded(TreePath[] value0) |
protected boolean canPathsBeAdded(TreePath[] value0) |
575 |
{ |
{ |
577 |
} |
} |
578 |
|
|
579 |
/** |
/** |
580 |
* canPathsBeRemoved |
* Checks if the paths can be removed without breaking the continuity of |
581 |
* @param value0 TODO |
* the selection according to selectionMode. |
582 |
* @return boolean |
* |
583 |
|
* @param paths the paths to check |
584 |
|
* @return <code>true</code> if the paths can be removed with respect to the |
585 |
|
* selectionMode |
586 |
*/ |
*/ |
587 |
protected boolean canPathsBeRemoved(TreePath[] value0) |
protected boolean canPathsBeRemoved(TreePath[] value0) |
588 |
{ |
{ |
600 |
} |
} |
601 |
|
|
602 |
/** |
/** |
603 |
* updateLeadIndex |
* Updates the lead index instance field. |
604 |
*/ |
*/ |
605 |
protected void updateLeadIndex() |
protected void updateLeadIndex() |
606 |
{ |
{ |
608 |
} |
} |
609 |
|
|
610 |
/** |
/** |
611 |
* insureUniqueness |
* Deprecated and not used. |
612 |
*/ |
*/ |
613 |
protected void insureUniqueness() |
protected void insureUniqueness() |
614 |
{ |
{ |