KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > event > TreeModelListener


1 /*
2  * @(#)TreeModelListener.java 1.17 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.event;
9
10 import java.util.EventListener JavaDoc;
11
12 /**
13  * Defines the interface for an object that listens
14  * to changes in a TreeModel.
15  * For further information and examples see
16  * <a
17  href="http://java.sun.com/docs/books/tutorial/uiswing/events/treemodellistener.html">How to Write a Tree Model Listener</a>,
18  * a section in <em>The Java Tutorial.</em>
19  *
20  * @version 1.17 12/19/03
21  * @author Rob Davis
22  * @author Ray Ryan
23  */

24 public interface TreeModelListener extends EventListener JavaDoc {
25
26     /**
27      * <p>Invoked after a node (or a set of siblings) has changed in some
28      * way. The node(s) have not changed locations in the tree or
29      * altered their children arrays, but other attributes have
30      * changed and may affect presentation. Example: the name of a
31      * file has changed, but it is in the same location in the file
32      * system.</p>
33      * <p>To indicate the root has changed, childIndices and children
34      * will be null. </p>
35      *
36      * <p>Use <code>e.getPath()</code>
37      * to get the parent of the changed node(s).
38      * <code>e.getChildIndices()</code>
39      * returns the index(es) of the changed node(s).</p>
40      */

41     void treeNodesChanged(TreeModelEvent JavaDoc e);
42
43     /**
44      * <p>Invoked after nodes have been inserted into the tree.</p>
45      *
46      * <p>Use <code>e.getPath()</code>
47      * to get the parent of the new node(s).
48      * <code>e.getChildIndices()</code>
49      * returns the index(es) of the new node(s)
50      * in ascending order.</p>
51      */

52     void treeNodesInserted(TreeModelEvent JavaDoc e);
53
54     /**
55      * <p>Invoked after nodes have been removed from the tree. Note that
56      * if a subtree is removed from the tree, this method may only be
57      * invoked once for the root of the removed subtree, not once for
58      * each individual set of siblings removed.</p>
59      *
60      * <p>Use <code>e.getPath()</code>
61      * to get the former parent of the deleted node(s).
62      * <code>e.getChildIndices()</code>
63      * returns, in ascending order, the index(es)
64      * the node(s) had before being deleted.</p>
65      */

66     void treeNodesRemoved(TreeModelEvent JavaDoc e);
67
68     /**
69      * <p>Invoked after the tree has drastically changed structure from a
70      * given node down. If the path returned by e.getPath() is of length
71      * one and the first element does not identify the current root node
72      * the first element should become the new root of the tree.<p>
73      *
74      * <p>Use <code>e.getPath()</code>
75      * to get the path to the node.
76      * <code>e.getChildIndices()</code>
77      * returns null.</p>
78      */

79     void treeStructureChanged(TreeModelEvent JavaDoc e);
80
81 }
82
Popular Tags