~ubuntu-branches/ubuntu/trusty/libswingx-java/trusty

« back to all changes in this revision

Viewing changes to src/java/org/jdesktop/swingx/treetable/MutableTreeTableNode.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2008-03-08 16:18:24 UTC
  • Revision ID: james.westby@ubuntu.com-20080308161824-wsahvl9pwzjcea3g
Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: MutableTreeTableNode.java,v 1.3 2007/11/25 15:52:58 kschaefe Exp $
 
3
 *
 
4
 * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
 
5
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public
 
9
 * 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
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with this library; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
20
 */
 
21
package org.jdesktop.swingx.treetable;
 
22
 
 
23
import java.util.Enumeration;
 
24
 
 
25
/**
 
26
 * Defines the requirements for a tree table node object that can change -- by
 
27
 * adding or removing child nodes, or by changing the contents of a user object
 
28
 * stored in the node.
 
29
 * <p>
 
30
 * Note this does not extend {@code MutableTreeNode} to minimize the contract
 
31
 * breakage, cf. {@link TreeTableNode#getIndex(javax.swing.tree.TreeNode)}.
 
32
 * 
 
33
 * @see javax.swing.tree.MutableTreeNode
 
34
 * 
 
35
 * @author Karl Schaefer
 
36
 */
 
37
public interface MutableTreeTableNode extends TreeTableNode {
 
38
    /**
 
39
     * Returns an enumeration this node's children.
 
40
     * 
 
41
     * @return an enumeration of {@code TreeTableNode}s
 
42
     */
 
43
    Enumeration<? extends MutableTreeTableNode> children();
 
44
    
 
45
    /**
 
46
     * Adds the {@code child} to this node at the specified {@code index}. This
 
47
     * method calls {@code setParent} on {@code child} with {@code this} as the
 
48
     * parameter.
 
49
     * 
 
50
     * @param child
 
51
     *            the node to add as a child
 
52
     * @param index
 
53
     *            the index of the child
 
54
     * @throws IndexOutOfBoundsException
 
55
     *             if {@code index} is not a valid index
 
56
     */
 
57
    void insert(MutableTreeTableNode child, int index);
 
58
 
 
59
    /**
 
60
     * Removes the child node at the specified {@code index} from this node.
 
61
     * This method calls {@code setParent} on {@code child} with a {@code null}
 
62
     * parameter.
 
63
     * 
 
64
     * @param index
 
65
     *            the index of the child
 
66
     * @throws IndexOutOfBoundsException
 
67
     *             if {@code index} is not a valid index
 
68
     */
 
69
    void remove(int index);
 
70
 
 
71
    /**
 
72
     * Removes the specified child {@code node} from this node.
 
73
     * This method calls {@code setParent} on {@code child} with a {@code null}
 
74
     * parameter.
 
75
     * 
 
76
     * @param node
 
77
     *            the index of the child
 
78
     */
 
79
    void remove(MutableTreeTableNode node);
 
80
 
 
81
    /**
 
82
     * Removes this node from it's parent. Most implementations will use
 
83
     * {@code getParent().remove(this)}.
 
84
     * 
 
85
     * @throws NullPointerException
 
86
     *             if {@code getParent()} returns {@code null}
 
87
     */
 
88
    void removeFromParent();
 
89
 
 
90
    /**
 
91
     * Sets the parent of this node to {@code newParent}. This methods remove
 
92
     * the node from its old parent.
 
93
     * 
 
94
     * @param newParent
 
95
     *            the new parent for this node
 
96
     */
 
97
    void setParent(MutableTreeTableNode newParent);
 
98
}