1 |
/* DefaultTreeModel.java -- |
/* |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
* DefaultTreeModel.java -- Copyright (C) 2005 Free Software Foundation, |
3 |
|
* Inc. |
4 |
This file is part of GNU Classpath. |
* |
5 |
|
* This file is part of GNU Classpath. |
6 |
GNU Classpath is free software; you can redistribute it and/or modify |
* |
7 |
it under the terms of the GNU General Public License as published by |
* GNU Classpath is free software; you can redistribute it and/or modify it |
8 |
the Free Software Foundation; either version 2, or (at your option) |
* under the terms of the GNU General Public License as published by the Free |
9 |
any later version. |
* Software Foundation; either version 2, or (at your option) any later version. |
10 |
|
* |
11 |
GNU Classpath is distributed in the hope that it will be useful, but |
* GNU Classpath is distributed in the hope that it will be useful, but WITHOUT |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
14 |
General Public License for more details. |
* details. |
15 |
|
* |
16 |
You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License along with |
17 |
along with GNU Classpath; see the file COPYING. If not, write to the |
* GNU Classpath; see the file COPYING. If not, write to the Free Software |
18 |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
02110-1301 USA. |
* |
20 |
|
* Linking this library statically or dynamically with other modules is making a |
21 |
Linking this library statically or dynamically with other modules is |
* combined work based on this library. Thus, the terms and conditions of the |
22 |
making a combined work based on this library. Thus, the terms and |
* GNU General Public License cover the whole combination. |
23 |
conditions of the GNU General Public License cover the whole |
* |
24 |
combination. |
* As a special exception, the copyright holders of this library give you |
25 |
|
* permission to link this library with independent modules to produce an |
26 |
As a special exception, the copyright holders of this library give you |
* executable, regardless of the license terms of these independent modules, and |
27 |
permission to link this library with independent modules to produce an |
* to copy and distribute the resulting executable under terms of your choice, |
28 |
executable, regardless of the license terms of these independent |
* provided that you also meet, for each linked independent module, the terms |
29 |
modules, and to copy and distribute the resulting executable under |
* and conditions of the license of that module. An independent module is a |
30 |
terms of your choice, provided that you also meet, for each linked |
* module which is not derived from or based on this library. If you modify this |
31 |
independent module, the terms and conditions of the license of that |
* library, you may extend this exception to your version of the library, but |
32 |
module. An independent module is a module which is not derived from |
* you are not obligated to do so. If you do not wish to do so, delete this |
33 |
or based on this library. If you modify this library, you may extend |
* exception statement from your version. |
34 |
this exception to your version of the library, but you are not |
*/ |
|
obligated to do so. If you do not wish to do so, delete this |
|
|
exception statement from your version. */ |
|
|
|
|
35 |
|
|
36 |
package javax.swing.tree; |
package javax.swing.tree; |
37 |
|
|
48 |
|
|
49 |
/** |
/** |
50 |
* DefaultTreeModel |
* DefaultTreeModel |
51 |
|
* |
52 |
* @author Andrew Selkirk |
* @author Andrew Selkirk |
53 |
*/ |
*/ |
54 |
public class DefaultTreeModel |
public class DefaultTreeModel |
55 |
implements Serializable, TreeModel |
implements Serializable, TreeModel |
56 |
{ |
{ |
57 |
static final long serialVersionUID = -2621068368932566998L; |
static final long serialVersionUID = -2621068368932566998L; |
58 |
|
|
59 |
|
/** |
60 |
|
* root |
61 |
|
*/ |
62 |
|
protected TreeNode root = null; |
63 |
|
|
64 |
|
/** |
65 |
|
* listenerList |
66 |
|
*/ |
67 |
|
protected EventListenerList listenerList = new EventListenerList(); |
68 |
|
|
69 |
|
/** |
70 |
|
* asksAllowsChildren |
71 |
|
*/ |
72 |
|
protected boolean asksAllowsChildren; |
73 |
|
|
74 |
|
/** |
75 |
|
* Constructor DefaultTreeModel |
76 |
|
* |
77 |
|
* @param root the tree root. |
78 |
|
*/ |
79 |
|
public DefaultTreeModel(TreeNode root) |
80 |
|
{ |
81 |
|
if (root == null) |
82 |
|
root = new DefaultMutableTreeNode(); |
83 |
|
setRoot(root); |
84 |
|
} |
85 |
|
|
86 |
|
/** |
87 |
|
* Constructor DefaultTreeModel |
88 |
|
* |
89 |
|
* @param root the tree root. |
90 |
|
* @param asksAllowsChildren TODO |
91 |
|
*/ |
92 |
|
public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) |
93 |
|
{ |
94 |
|
setRoot(root); |
95 |
|
this.asksAllowsChildren = asksAllowsChildren; |
96 |
|
} |
97 |
|
|
98 |
|
/** |
99 |
|
* writeObject |
100 |
|
* |
101 |
|
* @param obj the object. |
102 |
|
* @exception IOException TODO |
103 |
|
*/ |
104 |
|
private void writeObject(ObjectOutputStream obj) throws IOException |
105 |
|
{ |
106 |
|
// TODO |
107 |
|
} |
108 |
|
|
109 |
|
/** |
110 |
|
* readObject |
111 |
|
* |
112 |
|
* @param value0 TODO |
113 |
|
* @exception IOException TODO |
114 |
|
* @exception ClassNotFoundException TODO |
115 |
|
*/ |
116 |
|
private void readObject(ObjectInputStream value0) throws IOException, |
117 |
|
ClassNotFoundException |
118 |
|
{ |
119 |
|
// TODO |
120 |
|
} |
121 |
|
|
122 |
|
/** |
123 |
|
* asksAllowsChildren |
124 |
|
* |
125 |
|
* @return boolean |
126 |
|
*/ |
127 |
|
public boolean asksAllowsChildren() |
128 |
|
{ |
129 |
|
return asksAllowsChildren; |
130 |
|
} |
131 |
|
|
132 |
/** |
/** |
133 |
* root |
* setAsksAllowsChildren |
134 |
*/ |
* |
135 |
protected TreeNode root = null; |
* @param value TODO |
136 |
|
*/ |
137 |
/** |
public void setAsksAllowsChildren(boolean value) |
138 |
* listenerList |
{ |
139 |
*/ |
asksAllowsChildren = value; // TODO |
140 |
protected EventListenerList listenerList = new EventListenerList(); |
} |
141 |
|
|
142 |
/** |
/** |
143 |
* asksAllowsChildren |
* setRoot |
144 |
*/ |
* |
145 |
protected boolean asksAllowsChildren; |
* @param root the root node. |
146 |
|
*/ |
147 |
/** |
public void setRoot(TreeNode root) |
148 |
* Constructor DefaultTreeModel |
{ |
149 |
* @param root the tree root. |
// Sanity Check |
150 |
*/ |
if (root == null) |
151 |
public DefaultTreeModel(TreeNode root) |
{ |
152 |
{ |
throw new IllegalArgumentException("null root"); |
153 |
if (root == null) |
} |
154 |
root = new DefaultMutableTreeNode(); |
// Set new root |
155 |
setRoot(root); |
this.root = root; |
156 |
} |
|
157 |
|
// TODO |
158 |
/** |
} |
159 |
* Constructor DefaultTreeModel |
|
160 |
* @param root the tree root. |
/** |
161 |
* @param asksAllowsChildren TODO |
* getRoot |
162 |
*/ |
* |
163 |
public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) |
* @return Object |
164 |
{ |
*/ |
165 |
setRoot(root); |
public Object getRoot() |
166 |
this.asksAllowsChildren = asksAllowsChildren; |
{ |
167 |
} |
return root; |
168 |
|
} |
169 |
/** |
|
170 |
* writeObject |
/** |
171 |
* @param obj the object. |
* getIndexOfChild |
172 |
* @exception IOException TODO |
* |
173 |
*/ |
* @param parent TODO |
174 |
private void writeObject(ObjectOutputStream obj) throws IOException |
* @param child TODO |
175 |
{ |
* @return int |
176 |
// TODO |
*/ |
177 |
} |
public int getIndexOfChild(Object parent, Object child) |
|
|
|
|
/** |
|
|
* readObject |
|
|
* @param value0 TODO |
|
|
* @exception IOException TODO |
|
|
* @exception ClassNotFoundException TODO |
|
|
*/ |
|
|
private void readObject(ObjectInputStream value0) throws IOException, |
|
|
ClassNotFoundException |
|
|
{ |
|
|
// TODO |
|
|
} |
|
|
|
|
|
/** |
|
|
* asksAllowsChildren |
|
|
* @return boolean |
|
|
*/ |
|
|
public boolean asksAllowsChildren() |
|
|
{ |
|
|
return asksAllowsChildren; |
|
|
} |
|
|
|
|
|
/** |
|
|
* setAsksAllowsChildren |
|
|
* @param value TODO |
|
|
*/ |
|
|
public void setAsksAllowsChildren(boolean value) |
|
|
{ |
|
|
asksAllowsChildren = value; // TODO |
|
|
} |
|
|
|
|
|
/** |
|
|
* setRoot |
|
|
* @param root the root node. |
|
|
*/ |
|
|
public void setRoot(TreeNode root) |
|
|
{ |
|
|
// Sanity Check |
|
|
if (root == null) |
|
|
{ |
|
|
throw new IllegalArgumentException("null root"); |
|
|
} |
|
|
// Set new root |
|
|
this.root = root; |
|
|
|
|
|
// TODO |
|
|
} |
|
|
|
|
|
/** |
|
|
* getRoot |
|
|
* @return Object |
|
|
*/ |
|
|
public Object getRoot() |
|
|
{ |
|
|
return root; |
|
|
} |
|
|
|
|
|
/** |
|
|
* getIndexOfChild |
|
|
* @param parent TODO |
|
|
* @param child TODO |
|
|
* @return int |
|
|
*/ |
|
|
public int getIndexOfChild(Object parent, Object child) |
|
178 |
{ |
{ |
179 |
for (int i = 0; i < getChildCount(parent); i++) |
for (int i = 0; i < getChildCount(parent); i++) |
180 |
{ |
{ |
184 |
return -1; |
return -1; |
185 |
} |
} |
186 |
|
|
187 |
/** |
/** |
188 |
* getChild |
* getChild |
189 |
* |
* |
190 |
* @param node TODO |
* @param node TODO |
191 |
* @param idx TODO |
* @param idx TODO |
192 |
* @return Object |
* @return Object |
193 |
*/ |
*/ |
194 |
public Object getChild(Object node, int idx) |
public Object getChild(Object node, int idx) |
195 |
{ |
{ |
196 |
if (node instanceof TreeNode) |
if (node instanceof TreeNode) |
197 |
return ((TreeNode) node).getChildAt(idx); |
return ((TreeNode) node).getChildAt(idx); |
198 |
else |
else |
199 |
return null; |
return null; |
200 |
} |
} |
201 |
|
|
202 |
/** |
/** |
203 |
* getChildCount |
* getChildCount |
204 |
* @param node TODO |
* |
205 |
* @return int |
* @param node TODO |
206 |
*/ |
* @return int |
207 |
public int getChildCount(Object node) |
*/ |
208 |
{ |
public int getChildCount(Object node) |
209 |
if (node instanceof TreeNode) |
{ |
210 |
return ((TreeNode) node).getChildCount(); |
if (node instanceof TreeNode) |
211 |
else |
return ((TreeNode) node).getChildCount(); |
212 |
return 0; |
else |
213 |
} |
return 0; |
214 |
|
} |
215 |
/** |
|
216 |
* isLeaf |
/** |
217 |
* @param node TODO |
* isLeaf |
218 |
* @return boolean |
* |
219 |
*/ |
* @param node TODO |
220 |
public boolean isLeaf(Object node) |
* @return boolean |
221 |
{ |
*/ |
222 |
if (node instanceof TreeNode) |
public boolean isLeaf(Object node) |
223 |
return ((TreeNode) node).isLeaf(); |
{ |
224 |
else |
if (node instanceof TreeNode) |
225 |
return true; |
return ((TreeNode) node).isLeaf(); |
226 |
} |
else |
227 |
|
return true; |
228 |
/** |
} |
229 |
* reload |
|
230 |
*/ |
/** |
231 |
public void reload() |
* reload |
232 |
{ |
*/ |
233 |
// TODO |
public void reload() |
234 |
} |
{ |
235 |
|
// TODO |
236 |
/** |
} |
237 |
* reload |
|
238 |
* @param value0 TODO |
/** |
239 |
*/ |
* reload |
240 |
public void reload(TreeNode value0) |
* |
241 |
{ |
* @param value0 TODO |
242 |
// TODO |
*/ |
243 |
} |
public void reload(TreeNode value0) |
244 |
|
{ |
245 |
/** |
// TODO |
246 |
* valueForPathChanged |
} |
247 |
* @param value0 TODO |
|
248 |
* @param value1 TODO |
/** |
249 |
*/ |
* valueForPathChanged |
250 |
public void valueForPathChanged(TreePath value0, Object value1) |
* |
251 |
{ |
* @param value0 TODO |
252 |
// TODO |
* @param value1 TODO |
253 |
} |
*/ |
254 |
|
public void valueForPathChanged(TreePath value0, Object value1) |
255 |
/** |
{ |
256 |
* insertNodeInto |
// TODO |
257 |
* @param value0 TODO |
} |
258 |
* @param value1 TODO |
|
259 |
* @param value2 TODO |
/** |
260 |
*/ |
* insertNodeInto |
261 |
public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1, |
* |
262 |
int value2) |
* @param value0 TODO |
263 |
{ |
* @param value1 TODO |
264 |
// TODO |
* @param value2 TODO |
265 |
} |
*/ |
266 |
|
public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1, |
267 |
/** |
int value2) |
268 |
* removeNodeFromParent |
{ |
269 |
* @param value0 TODO |
// TODO |
270 |
*/ |
} |
271 |
public void removeNodeFromParent(MutableTreeNode value0) |
|
272 |
{ |
/** |
273 |
// TODO |
* removeNodeFromParent |
274 |
} |
* |
275 |
|
* @param value0 TODO |
276 |
/** |
*/ |
277 |
* nodeChanged |
public void removeNodeFromParent(MutableTreeNode value0) |
278 |
* @param value0 TODO |
{ |
279 |
*/ |
// TODO |
280 |
public void nodeChanged(TreeNode value0) |
} |
281 |
{ |
|
282 |
// TODO |
/** |
283 |
} |
* nodeChanged |
284 |
|
* |
285 |
/** |
* @param value0 TODO |
286 |
* nodesWereInserted |
*/ |
287 |
* @param value0 TODO |
public void nodeChanged(TreeNode value0) |
288 |
* @param value1 TODO |
{ |
289 |
*/ |
// TODO |
290 |
public void nodesWereInserted(TreeNode value0, int[] value1) |
} |
291 |
{ |
|
292 |
// TODO |
/** |
293 |
} |
* nodesWereInserted |
294 |
|
* |
295 |
/** |
* @param value0 TODO |
296 |
* nodesWereRemoved |
* @param value1 TODO |
297 |
* @param value0 TODO |
*/ |
298 |
* @param value1 TODO |
public void nodesWereInserted(TreeNode value0, int[] value1) |
299 |
* @param value2 TODO |
{ |
300 |
*/ |
// TODO |
301 |
public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2) |
} |
302 |
{ |
|
303 |
// TODO |
/** |
304 |
} |
* nodesWereRemoved |
305 |
|
* |
306 |
/** |
* @param value0 TODO |
307 |
* nodesChanged |
* @param value1 TODO |
308 |
* @param value0 TODO |
* @param value2 TODO |
309 |
* @param value1 TODO |
*/ |
310 |
*/ |
public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2) |
311 |
public void nodesChanged(TreeNode value0, int[] value1) |
{ |
312 |
{ |
// TODO |
313 |
// TODO |
} |
314 |
} |
|
315 |
|
/** |
316 |
/** |
* nodesChanged |
317 |
* nodeStructureChanged |
* |
318 |
* @param value0 TODO |
* @param value0 TODO |
319 |
*/ |
* @param value1 TODO |
320 |
public void nodeStructureChanged(TreeNode value0) |
*/ |
321 |
{ |
public void nodesChanged(TreeNode value0, int[] value1) |
322 |
// TODO |
{ |
323 |
} |
// TODO |
324 |
|
} |
325 |
/** |
|
326 |
* getPathToRoot |
/** |
327 |
* @param value0 TODO |
* nodeStructureChanged |
328 |
* @return TreeNode[] |
* |
329 |
*/ |
* @param value0 TODO |
330 |
public TreeNode[] getPathToRoot(TreeNode value0) |
*/ |
331 |
{ |
public void nodeStructureChanged(TreeNode value0) |
332 |
return null; // TODO |
{ |
333 |
} |
// TODO |
334 |
|
} |
335 |
/** |
|
336 |
* getPathToRoot |
/** |
337 |
* @param value0 TODO |
* getPathToRoot |
338 |
* @param value1 TODO |
* |
339 |
* @return TreeNode[] |
* @param value0 TODO |
340 |
*/ |
* @return TreeNode[] |
341 |
protected TreeNode[] getPathToRoot(TreeNode value0, int value1) |
*/ |
342 |
{ |
public TreeNode[] getPathToRoot(TreeNode value0) |
343 |
return null; // TODO |
{ |
344 |
} |
return null; // TODO |
345 |
|
} |
346 |
/** |
|
347 |
* Registers a listere to the model. |
/** |
348 |
* |
* getPathToRoot |
349 |
* @param listener the listener to add |
* |
350 |
*/ |
* @param value0 TODO |
351 |
public void addTreeModelListener(TreeModelListener listener) |
* @param value1 TODO |
352 |
{ |
* @return TreeNode[] |
353 |
listenerList.add(TreeModelListener.class, listener); |
*/ |
354 |
} |
protected TreeNode[] getPathToRoot(TreeNode value0, int value1) |
355 |
|
{ |
356 |
/** |
return null; // TODO |
357 |
* Removes a listener from the model. |
} |
358 |
* |
|
359 |
* @param listener the listener to remove |
/** |
360 |
*/ |
* Registers a listere to the model. |
361 |
public void removeTreeModelListener(TreeModelListener listener) |
* |
362 |
{ |
* @param listener the listener to add |
363 |
listenerList.remove(TreeModelListener.class, listener); |
*/ |
364 |
} |
public void addTreeModelListener(TreeModelListener listener) |
365 |
|
{ |
366 |
/** |
listenerList.add(TreeModelListener.class, listener); |
367 |
* Returns all registered <code>TreeModelListener</code> listeners. |
} |
368 |
* |
|
369 |
* @return an array of listeners. |
/** |
370 |
* |
* Removes a listener from the model. |
371 |
* @since 1.4 |
* |
372 |
*/ |
* @param listener the listener to remove |
373 |
public TreeModelListener[] getTreeModelListeners() |
*/ |
374 |
{ |
public void removeTreeModelListener(TreeModelListener listener) |
375 |
return (TreeModelListener[]) listenerList |
{ |
376 |
.getListeners(TreeModelListener.class); |
listenerList.remove(TreeModelListener.class, listener); |
377 |
} |
} |
378 |
|
|
379 |
/** |
/** |
380 |
* fireTreeNodesChanged |
* Returns all registered <code>TreeModelListener</code> listeners. |
381 |
* |
* |
382 |
* @param source the node being changed |
* @return an array of listeners. |
383 |
* @param path the path to the root node |
* |
384 |
* @param childIndices the indices of the changed elements |
* @since 1.4 |
385 |
* @param children the changed elements |
*/ |
386 |
*/ |
public TreeModelListener[] getTreeModelListeners() |
387 |
protected void fireTreeNodesChanged(Object source, Object[] path, |
{ |
388 |
int[] childIndices, Object[] children) |
return (TreeModelListener[]) listenerList |
389 |
{ |
.getListeners(TreeModelListener.class); |
390 |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
} |
391 |
children); |
|
392 |
TreeModelListener[] listeners = getTreeModelListeners(); |
/** |
393 |
|
* fireTreeNodesChanged |
394 |
for (int i = listeners.length - 1; i >= 0; --i) |
* |
395 |
listeners[i].treeNodesChanged(event); |
* @param source the node being changed |
396 |
} |
* @param path the path to the root node |
397 |
|
* @param childIndices the indices of the changed elements |
398 |
/** |
* @param children the changed elements |
399 |
* fireTreeNodesInserted |
*/ |
400 |
* |
protected void fireTreeNodesChanged(Object source, Object[] path, |
401 |
* @param source the node where new nodes got inserted |
int[] childIndices, Object[] children) |
402 |
* @param path the path to the root node |
{ |
403 |
* @param childIndices the indices of the new elements |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
404 |
* @param children the new elements |
children); |
405 |
*/ |
TreeModelListener[] listeners = getTreeModelListeners(); |
406 |
protected void fireTreeNodesInserted(Object source, Object[] path, |
|
407 |
int[] childIndices, Object[] children) |
for (int i = listeners.length - 1; i >= 0; --i) |
408 |
{ |
listeners[i].treeNodesChanged(event); |
409 |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
} |
410 |
children); |
|
411 |
TreeModelListener[] listeners = getTreeModelListeners(); |
/** |
412 |
|
* fireTreeNodesInserted |
413 |
for (int i = listeners.length - 1; i >= 0; --i) |
* |
414 |
listeners[i].treeNodesInserted(event); |
* @param source the node where new nodes got inserted |
415 |
} |
* @param path the path to the root node |
416 |
|
* @param childIndices the indices of the new elements |
417 |
/** |
* @param children the new elements |
418 |
* fireTreeNodesRemoved |
*/ |
419 |
* |
protected void fireTreeNodesInserted(Object source, Object[] path, |
420 |
* @param source the node where nodes got removed- |
int[] childIndices, Object[] children) |
421 |
* @param path the path to the root node |
{ |
422 |
* @param childIndices the indices of the removed elements |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
423 |
* @param children the removed elements |
children); |
424 |
*/ |
TreeModelListener[] listeners = getTreeModelListeners(); |
425 |
protected void fireTreeNodesRemoved(Object source, Object[] path, |
|
426 |
int[] childIndices, Object[] children) |
for (int i = listeners.length - 1; i >= 0; --i) |
427 |
{ |
listeners[i].treeNodesInserted(event); |
428 |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
} |
429 |
children); |
|
430 |
TreeModelListener[] listeners = getTreeModelListeners(); |
/** |
431 |
|
* fireTreeNodesRemoved |
432 |
for (int i = listeners.length - 1; i >= 0; --i) |
* |
433 |
listeners[i].treeNodesRemoved(event); |
* @param source the node where nodes got removed- |
434 |
} |
* @param path the path to the root node |
435 |
|
* @param childIndices the indices of the removed elements |
436 |
/** |
* @param children the removed elements |
437 |
* fireTreeStructureChanged |
*/ |
438 |
* |
protected void fireTreeNodesRemoved(Object source, Object[] path, |
439 |
* @param source the node where the model has changed |
int[] childIndices, Object[] children) |
440 |
* @param path the path to the root node |
{ |
441 |
* @param childIndices the indices of the affected elements |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
442 |
* @param children the affected elements |
children); |
443 |
*/ |
TreeModelListener[] listeners = getTreeModelListeners(); |
444 |
protected void fireTreeStructureChanged(Object source, Object[] path, |
|
445 |
int[] childIndices, Object[] children) |
for (int i = listeners.length - 1; i >= 0; --i) |
446 |
{ |
listeners[i].treeNodesRemoved(event); |
447 |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
} |
448 |
children); |
|
449 |
TreeModelListener[] listeners = getTreeModelListeners(); |
/** |
450 |
|
* fireTreeStructureChanged |
451 |
for (int i = listeners.length - 1; i >= 0; --i) |
* |
452 |
listeners[i].treeStructureChanged(event); |
* @param source the node where the model has changed |
453 |
} |
* @param path the path to the root node |
454 |
|
* @param childIndices the indices of the affected elements |
455 |
/** |
* @param children the affected elements |
456 |
* Returns the registered listeners of a given type. |
*/ |
457 |
* |
protected void fireTreeStructureChanged(Object source, Object[] path, |
458 |
* @param listenerType the listener type to return |
int[] childIndices, Object[] children) |
459 |
* |
{ |
460 |
* @return an array of listeners |
TreeModelEvent event = new TreeModelEvent(source, path, childIndices, |
461 |
* |
children); |
462 |
* @since 1.3 |
TreeModelListener[] listeners = getTreeModelListeners(); |
463 |
*/ |
|
464 |
public EventListener[] getListeners(Class listenerType) |
for (int i = listeners.length - 1; i >= 0; --i) |
465 |
{ |
listeners[i].treeStructureChanged(event); |
466 |
return listenerList.getListeners(listenerType); |
} |
467 |
} |
|
468 |
|
/** |
469 |
|
* Returns the registered listeners of a given type. |
470 |
|
* |
471 |
|
* @param listenerType the listener type to return |
472 |
|
* |
473 |
|
* @return an array of listeners |
474 |
|
* |
475 |
|
* @since 1.3 |
476 |
|
*/ |
477 |
|
public EventListener[] getListeners(Class listenerType) |
478 |
|
{ |
479 |
|
return listenerList.getListeners(listenerType); |
480 |
|
} |
481 |
} |
} |