1 | /* DefaultTreeModel.java --
|
---|
2 | Copyright (C) 2002 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | This file is part of GNU Classpath.
|
---|
5 |
|
---|
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
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | GNU Classpath is distributed in the hope that it will be useful, but
|
---|
12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
---|
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
---|
19 | 02111-1307 USA.
|
---|
20 |
|
---|
21 | Linking this library statically or dynamically with other modules is
|
---|
22 | making a combined work based on this library. Thus, the terms and
|
---|
23 | conditions of the GNU General Public License cover the whole
|
---|
24 | combination.
|
---|
25 |
|
---|
26 | As a special exception, the copyright holders of this library give you
|
---|
27 | permission to link this library with independent modules to produce an
|
---|
28 | executable, regardless of the license terms of these independent
|
---|
29 | modules, and to copy and distribute the resulting executable under
|
---|
30 | terms of your choice, provided that you also meet, for each linked
|
---|
31 | independent module, the terms and conditions of the license of that
|
---|
32 | module. An independent module is a module which is not derived from
|
---|
33 | or based on this library. If you modify this library, you may extend
|
---|
34 | this exception to your version of the library, but you are not
|
---|
35 | obligated to do so. If you do not wish to do so, delete this
|
---|
36 | exception statement from your version. */
|
---|
37 |
|
---|
38 | package javax.swing.tree;
|
---|
39 |
|
---|
40 | // Imports
|
---|
41 | import java.io.*;
|
---|
42 | import java.util.*;
|
---|
43 | import javax.swing.event.*;
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * DefaultTreeModel
|
---|
47 | * @author Andrew Selkirk
|
---|
48 | */
|
---|
49 | public class DefaultTreeModel implements Serializable, TreeModel {
|
---|
50 |
|
---|
51 | //-------------------------------------------------------------
|
---|
52 | // Variables --------------------------------------------------
|
---|
53 | //-------------------------------------------------------------
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * root
|
---|
57 | */
|
---|
58 | protected TreeNode root = null;
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * listenerList
|
---|
62 | */
|
---|
63 | protected EventListenerList listenerList = new EventListenerList();
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * asksAllowsChildren
|
---|
67 | */
|
---|
68 | protected boolean asksAllowsChildren;
|
---|
69 |
|
---|
70 |
|
---|
71 | //-------------------------------------------------------------
|
---|
72 | // Initialization ---------------------------------------------
|
---|
73 | //-------------------------------------------------------------
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Constructor DefaultTreeModel
|
---|
77 | * @param value0 TODO
|
---|
78 | */
|
---|
79 | public DefaultTreeModel(TreeNode root) {
|
---|
80 | setRoot(root);
|
---|
81 | } // DefaultTreeModel()
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Constructor DefaultTreeModel
|
---|
85 | * @param value0 TODO
|
---|
86 | * @param value1 TODO
|
---|
87 | */
|
---|
88 | public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) {
|
---|
89 | setRoot(root);
|
---|
90 | this.asksAllowsChildren = asksAllowsChildren;
|
---|
91 | } // DefaultTreeModel()
|
---|
92 |
|
---|
93 |
|
---|
94 | //-------------------------------------------------------------
|
---|
95 | // Methods ----------------------------------------------------
|
---|
96 | //-------------------------------------------------------------
|
---|
97 |
|
---|
98 | /**
|
---|
99 | * writeObject
|
---|
100 | * @param value0 TODO
|
---|
101 | * @exception IOException TODO
|
---|
102 | */
|
---|
103 | private void writeObject(ObjectOutputStream value0) throws IOException {
|
---|
104 | // TODO
|
---|
105 | } // writeObject()
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * readObject
|
---|
109 | * @param value0 TODO
|
---|
110 | * @exception IOException TODO
|
---|
111 | * @exception ClassNotFoundException TODO
|
---|
112 | */
|
---|
113 | private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException {
|
---|
114 | // TODO
|
---|
115 | } // readObject()
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * asksAllowsChildren
|
---|
119 | * @returns boolean
|
---|
120 | */
|
---|
121 | public boolean asksAllowsChildren() {
|
---|
122 | return asksAllowsChildren;
|
---|
123 | } // asksAllowsChildren()
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * setAsksAllowsChildren
|
---|
127 | * @param value0 TODO
|
---|
128 | */
|
---|
129 | public void setAsksAllowsChildren(boolean value) {
|
---|
130 | asksAllowsChildren = value; // TODO
|
---|
131 | } // setAsksAllowsChildren()
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * setRoot
|
---|
135 | * @param value0 TODO
|
---|
136 | */
|
---|
137 | public void setRoot(TreeNode root) {
|
---|
138 |
|
---|
139 | // Sanity Check
|
---|
140 | if (root == null) {
|
---|
141 | throw new IllegalArgumentException("null root");
|
---|
142 | } // if
|
---|
143 |
|
---|
144 | // Set new root
|
---|
145 | this.root = root;
|
---|
146 |
|
---|
147 | // TODO
|
---|
148 | } // setRoot()
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * getRoot
|
---|
152 | * @returns Object
|
---|
153 | */
|
---|
154 | public Object getRoot() {
|
---|
155 | return root;
|
---|
156 | } // getRoot()
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * getIndexOfChild
|
---|
160 | * @param value0 TODO
|
---|
161 | * @param value1 TODO
|
---|
162 | * @returns int
|
---|
163 | */
|
---|
164 | public int getIndexOfChild(Object parent, Object child) {
|
---|
165 | return 0; // TODO
|
---|
166 | } // getIndexOfChild()
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * getChild
|
---|
170 | * @param value0 TODO
|
---|
171 | * @param value1 TODO
|
---|
172 | * @returns Object
|
---|
173 | */
|
---|
174 | public Object getChild(Object value0, int value1) {
|
---|
175 | return null; // TODO
|
---|
176 | } // getChild()
|
---|
177 |
|
---|
178 | /**
|
---|
179 | * getChildCount
|
---|
180 | * @param value0 TODO
|
---|
181 | * @returns int
|
---|
182 | */
|
---|
183 | public int getChildCount(Object value0) {
|
---|
184 | return 0; // TODO
|
---|
185 | } // getChildCount()
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * isLeaf
|
---|
189 | * @param value0 TODO
|
---|
190 | * @returns boolean
|
---|
191 | */
|
---|
192 | public boolean isLeaf(Object value0) {
|
---|
193 | return false; // TODO
|
---|
194 | } // isLeaf()
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * reload
|
---|
198 | */
|
---|
199 | public void reload() {
|
---|
200 | // TODO
|
---|
201 | } // reload()
|
---|
202 |
|
---|
203 | /**
|
---|
204 | * reload
|
---|
205 | * @param value0 TODO
|
---|
206 | */
|
---|
207 | public void reload(TreeNode value0) {
|
---|
208 | // TODO
|
---|
209 | } // reload()
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * valueForPathChanged
|
---|
213 | * @param value0 TODO
|
---|
214 | * @param value1 TODO
|
---|
215 | */
|
---|
216 | public void valueForPathChanged(TreePath value0, Object value1) {
|
---|
217 | // TODO
|
---|
218 | } // valueForPathChanged()
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * insertNodeInto
|
---|
222 | * @param value0 TODO
|
---|
223 | * @param value1 TODO
|
---|
224 | * @param value2 TODO
|
---|
225 | */
|
---|
226 | public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1, int value2) {
|
---|
227 | // TODO
|
---|
228 | } // insertNodeInto()
|
---|
229 |
|
---|
230 | /**
|
---|
231 | * removeNodeFromParent
|
---|
232 | * @param value0 TODO
|
---|
233 | */
|
---|
234 | public void removeNodeFromParent(MutableTreeNode value0) {
|
---|
235 | // TODO
|
---|
236 | } // removeNodeFromParent()
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * nodeChanged
|
---|
240 | * @param value0 TODO
|
---|
241 | */
|
---|
242 | public void nodeChanged(TreeNode value0) {
|
---|
243 | // TODO
|
---|
244 | } // nodeChanged()
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * nodesWereInserted
|
---|
248 | * @param value0 TODO
|
---|
249 | * @param value1 TODO
|
---|
250 | */
|
---|
251 | public void nodesWereInserted(TreeNode value0, int[] value1) {
|
---|
252 | // TODO
|
---|
253 | } // nodesWereInserted()
|
---|
254 |
|
---|
255 | /**
|
---|
256 | * nodesWereRemoved
|
---|
257 | * @param value0 TODO
|
---|
258 | * @param value1 TODO
|
---|
259 | * @param value2 TODO
|
---|
260 | */
|
---|
261 | public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2) {
|
---|
262 | // TODO
|
---|
263 | } // nodesWereRemoved()
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * nodesChanged
|
---|
267 | * @param value0 TODO
|
---|
268 | * @param value1 TODO
|
---|
269 | */
|
---|
270 | public void nodesChanged(TreeNode value0, int[] value1) {
|
---|
271 | // TODO
|
---|
272 | } // nodesChanged()
|
---|
273 |
|
---|
274 | /**
|
---|
275 | * nodeStructureChanged
|
---|
276 | * @param value0 TODO
|
---|
277 | */
|
---|
278 | public void nodeStructureChanged(TreeNode value0) {
|
---|
279 | // TODO
|
---|
280 | } // nodeStructureChanged()
|
---|
281 |
|
---|
282 | /**
|
---|
283 | * getPathToRoot
|
---|
284 | * @param value0 TODO
|
---|
285 | * @returns TreeNode[]
|
---|
286 | */
|
---|
287 | public TreeNode[] getPathToRoot(TreeNode value0) {
|
---|
288 | return null; // TODO
|
---|
289 | } // getPathToRoot()
|
---|
290 |
|
---|
291 | /**
|
---|
292 | * getPathToRoot
|
---|
293 | * @param value0 TODO
|
---|
294 | * @param value1 TODO
|
---|
295 | * @returns TreeNode[]
|
---|
296 | */
|
---|
297 | protected TreeNode[] getPathToRoot(TreeNode value0, int value1) {
|
---|
298 | return null; // TODO
|
---|
299 | } // getPathToRoot()
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * addTreeModelListener
|
---|
303 | * @param value0 TODO
|
---|
304 | */
|
---|
305 | public void addTreeModelListener(TreeModelListener listener) {
|
---|
306 | listenerList.add(TreeModelListener.class, listener);
|
---|
307 | } // addTreeModelListener()
|
---|
308 |
|
---|
309 | /**
|
---|
310 | * removeTreeModelListener
|
---|
311 | * @param value0 TODO
|
---|
312 | */
|
---|
313 | public void removeTreeModelListener(TreeModelListener listener) {
|
---|
314 | listenerList.remove(TreeModelListener.class, listener);
|
---|
315 | } // removeTreeModelListener()
|
---|
316 |
|
---|
317 | /**
|
---|
318 | * fireTreeNodesChanged
|
---|
319 | * @param value0 TODO
|
---|
320 | * @param value1 TODO
|
---|
321 | * @param value2 TODO
|
---|
322 | * @param value3 TODO
|
---|
323 | */
|
---|
324 | protected void fireTreeNodesChanged(Object value0, Object[] value1, int[] value2, Object[] value3) {
|
---|
325 | // TODO
|
---|
326 | } // fireTreeNodesChanged()
|
---|
327 |
|
---|
328 | /**
|
---|
329 | * fireTreeNodesInserted
|
---|
330 | * @param value0 TODO
|
---|
331 | * @param value1 TODO
|
---|
332 | * @param value2 TODO
|
---|
333 | * @param value3 TODO
|
---|
334 | */
|
---|
335 | protected void fireTreeNodesInserted(Object value0, Object[] value1, int[] value2, Object[] value3) {
|
---|
336 | // TODO
|
---|
337 | } // fireTreeNodesInserted()
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * fireTreeNodesRemoved
|
---|
341 | * @param value0 TODO
|
---|
342 | * @param value1 TODO
|
---|
343 | * @param value2 TODO
|
---|
344 | * @param value3 TODO
|
---|
345 | */
|
---|
346 | protected void fireTreeNodesRemoved(Object value0, Object[] value1, int[] value2, Object[] value3) {
|
---|
347 | // TODO
|
---|
348 | } // fireTreeNodesRemoved()
|
---|
349 |
|
---|
350 | /**
|
---|
351 | * fireTreeStructureChanged
|
---|
352 | * @param value0 TODO
|
---|
353 | * @param value1 TODO
|
---|
354 | * @param value2 TODO
|
---|
355 | * @param value3 TODO
|
---|
356 | */
|
---|
357 | protected void fireTreeStructureChanged(Object value0, Object[] value1, int[] value2, Object[] value3) {
|
---|
358 | // TODO
|
---|
359 | } // fireTreeStructureChanged()
|
---|
360 |
|
---|
361 | /**
|
---|
362 | * getListeners
|
---|
363 | * @param value0 TODO
|
---|
364 | * @returns EventListener[]
|
---|
365 | */
|
---|
366 | public EventListener[] getListeners(Class classType) {
|
---|
367 | return listenerList.getListeners(classType);
|
---|
368 | } // getListeners()
|
---|
369 |
|
---|
370 |
|
---|
371 | } // DefaultTreeModel
|
---|