2
* $Id: MutableTreeTableNode.java,v 1.3 2007/11/25 15:52:58 kschaefe Exp $
4
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5
* Santa Clara, California 95054, U.S.A. All rights reserved.
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.
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.
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
21
package org.jdesktop.swingx.treetable;
23
import java.util.Enumeration;
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
30
* Note this does not extend {@code MutableTreeNode} to minimize the contract
31
* breakage, cf. {@link TreeTableNode#getIndex(javax.swing.tree.TreeNode)}.
33
* @see javax.swing.tree.MutableTreeNode
35
* @author Karl Schaefer
37
public interface MutableTreeTableNode extends TreeTableNode {
39
* Returns an enumeration this node's children.
41
* @return an enumeration of {@code TreeTableNode}s
43
Enumeration<? extends MutableTreeTableNode> children();
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
51
* the node to add as a child
53
* the index of the child
54
* @throws IndexOutOfBoundsException
55
* if {@code index} is not a valid index
57
void insert(MutableTreeTableNode child, int index);
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}
65
* the index of the child
66
* @throws IndexOutOfBoundsException
67
* if {@code index} is not a valid index
69
void remove(int index);
72
* Removes the specified child {@code node} from this node.
73
* This method calls {@code setParent} on {@code child} with a {@code null}
77
* the index of the child
79
void remove(MutableTreeTableNode node);
82
* Removes this node from it's parent. Most implementations will use
83
* {@code getParent().remove(this)}.
85
* @throws NullPointerException
86
* if {@code getParent()} returns {@code null}
88
void removeFromParent();
91
* Sets the parent of this node to {@code newParent}. This methods remove
92
* the node from its old parent.
95
* the new parent for this node
97
void setParent(MutableTreeTableNode newParent);