View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.custom.tree.model;
20  
21  
22  /**
23   * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
24   * @version $Revision: 472638 $ $Date: 2006-11-08 15:54:13 -0500 (Wed, 08 Nov 2006) $
25   */
26  public interface TreeModelListener
27  {
28      /**
29       * <p>Invoked after a node (or a set of siblings) has changed in some
30       * way. The node(s) have not changed locations in the tree or
31       * altered their children arrays, but other attributes have
32       * changed and may affect presentation. Example: the name of a
33       * file has changed, but it is in the same location in the file
34       * system.</p>
35       * <p>To indicate the root has changed, childIndices and children
36       * will be null. </p>
37       * <p/>
38       * <p>Use <code>e.getPath()</code>
39       * to get the parent of the changed node(s).
40       * <code>e.getChildIndices()</code>
41       * returns the index(es) of the changed node(s).</p>
42       */
43      void treeNodesChanged(TreeModelEvent e);
44  
45      /**
46       * <p>Invoked after nodes have been inserted into the tree.</p>
47       * <p/>
48       * <p>Use <code>e.getPath()</code>
49       * to get the parent of the new node(s).
50       * <code>e.getChildIndices()</code>
51       * returns the index(es) of the new node(s)
52       * in ascending order.</p>
53       */
54      void treeNodesInserted(TreeModelEvent e);
55  
56      /**
57       * <p>Invoked after nodes have been removed from the tree.  Note that
58       * if a subtree is removed from the tree, this method may only be
59       * invoked once for the root of the removed subtree, not once for
60       * each individual set of siblings removed.</p>
61       * <p/>
62       * <p>Use <code>e.getPath()</code>
63       * to get the former parent of the deleted node(s).
64       * <code>e.getChildIndices()</code>
65       * returns, in ascending order, the index(es)
66       * the node(s) had before being deleted.</p>
67       */
68      void treeNodesRemoved(TreeModelEvent e);
69  
70      /**
71       * <p>Invoked after the tree has drastically changed structure from a
72       * given node down.  If the path returned by e.getPath() is of length
73       * one and the first element does not identify the current root node
74       * the first element should become the new root of the tree.<p>
75       * <p/>
76       * <p>Use <code>e.getPath()</code>
77       * to get the path to the node.
78       * <code>e.getChildIndices()</code>
79       * returns null.</p>
80       */
81      void treeStructureChanged(TreeModelEvent e);
82  
83  }