01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2001, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.gui.swing.tree;
18:
19: /**
20: * General-purpose node in a tree data structure. This default implementation implements
21: * Geotools {@link MutableTreeNode} interface, which inherits a {@code getUserObject()}
22: * method. This method is provided in Swing {@link javax.swing.tree.DefaultMutableTreeNode}
23: * implementation but seems to have been forgotten in all Swing interfaces.
24: *
25: * @since 2.0
26: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/widgets-swing/src/main/java/org/geotools/gui/swing/tree/DefaultMutableTreeNode.java $
27: * @version $Id: DefaultMutableTreeNode.java 20883 2006-08-07 13:48:09Z jgarnett $
28: * @author Martin Desruisseaux
29: */
30: public class DefaultMutableTreeNode extends
31: javax.swing.tree.DefaultMutableTreeNode implements
32: MutableTreeNode {
33: /**
34: * Serial number for compatibility with different versions.
35: */
36: private static final long serialVersionUID = -8782548896062360341L;
37:
38: /**
39: * Creates a tree node that has no parent and no children, but which allows children.
40: */
41: public DefaultMutableTreeNode() {
42: super ();
43: }
44:
45: /**
46: * Creates a tree node with no parent, no children, but which allows
47: * children, and initializes it with the specified user object.
48: *
49: * @param userObject an Object provided by the user that constitutes the node's data
50: */
51: public DefaultMutableTreeNode(Object userObject) {
52: super (userObject);
53: }
54:
55: /**
56: * Creates a tree node with no parent, no children, initialized with
57: * the specified user object, and that allows children only if specified.
58: *
59: * @param userObject an Object provided by the user that constitutes the node's data
60: * @param allowsChildren if true, the node is allowed to have child nodes -- otherwise,
61: * it is always a leaf node
62: */
63: public DefaultMutableTreeNode(Object userObject,
64: boolean allowsChildren) {
65: super(userObject, allowsChildren);
66: }
67: }
|