33 * <code>TreePath</code>s for identifying nodes in the <code>TreeModel</code>.
34 * If a <code>TreeModel</code> returns the same object, as compared by
35 * <code>equals</code>, at two different indices under the same parent
36 * than the resulting <code>TreePath</code> objects will be considered equal
37 * as well. Some implementations may assume that if two
38 * <code>TreePath</code>s are equal, they identify the same node. If this
39 * condition is not met, painting problems and other oddities may result.
40 * In other words, if <code>getChild</code> for a given parent returns
41 * the same Object (as determined by <code>equals</code>) problems may
42 * result, and it is recommended you avoid doing this.
43 * <p>
44 * Similarly <code>JTree</code> and its related classes place
45 * <code>TreePath</code>s in <code>Map</code>s. As such if
46 * a node is requested twice, the return values must be equal
47 * (using the <code>equals</code> method) and have the same
48 * <code>hashCode</code>.
49 * <p>
50 * For further information on tree models,
51 * including an example of a custom implementation,
52 * see <a
53 href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
54 * in <em>The Java Tutorial.</em>
55 *
56 * @see TreePath
57 *
58 * @author Rob Davis
59 * @author Ray Ryan
60 */
61 public interface TreeModel
62 {
63
64 /**
65 * Returns the root of the tree. Returns <code>null</code>
66 * only if the tree has no nodes.
67 *
68 * @return the root of the tree
69 */
70 public Object getRoot();
71
72
73 /**
|
33 * <code>TreePath</code>s for identifying nodes in the <code>TreeModel</code>.
34 * If a <code>TreeModel</code> returns the same object, as compared by
35 * <code>equals</code>, at two different indices under the same parent
36 * than the resulting <code>TreePath</code> objects will be considered equal
37 * as well. Some implementations may assume that if two
38 * <code>TreePath</code>s are equal, they identify the same node. If this
39 * condition is not met, painting problems and other oddities may result.
40 * In other words, if <code>getChild</code> for a given parent returns
41 * the same Object (as determined by <code>equals</code>) problems may
42 * result, and it is recommended you avoid doing this.
43 * <p>
44 * Similarly <code>JTree</code> and its related classes place
45 * <code>TreePath</code>s in <code>Map</code>s. As such if
46 * a node is requested twice, the return values must be equal
47 * (using the <code>equals</code> method) and have the same
48 * <code>hashCode</code>.
49 * <p>
50 * For further information on tree models,
51 * including an example of a custom implementation,
52 * see <a
53 href="https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
54 * in <em>The Java Tutorial.</em>
55 *
56 * @see TreePath
57 *
58 * @author Rob Davis
59 * @author Ray Ryan
60 */
61 public interface TreeModel
62 {
63
64 /**
65 * Returns the root of the tree. Returns <code>null</code>
66 * only if the tree has no nodes.
67 *
68 * @return the root of the tree
69 */
70 public Object getRoot();
71
72
73 /**
|