public abstract class AbstractMutableTreeTableNode extends Object implements MutableTreeTableNode
AbstractMutableTreeTableNode
provides an implementation of most of
the MutableTreeTableNode
features.Modifier and Type | Field and Description |
---|---|
protected boolean |
allowsChildren |
protected List<MutableTreeTableNode> |
children
List of children, if this node has no children the list will be empty.
|
protected MutableTreeTableNode |
parent
this node's parent, or null if this node has no parent
|
protected Object |
userObject
optional user object
|
Constructor and Description |
---|
AbstractMutableTreeTableNode() |
AbstractMutableTreeTableNode(Object userObject) |
AbstractMutableTreeTableNode(Object userObject,
boolean allowsChildren) |
Modifier and Type | Method and Description |
---|---|
void |
add(MutableTreeTableNode child) |
Enumeration<? extends MutableTreeTableNode> |
children()
Returns an enumeration this node's children.
|
protected List<MutableTreeTableNode> |
createChildrenList()
Creates the list used to manage the children of this node.
|
boolean |
getAllowsChildren() |
TreeTableNode |
getChildAt(int childIndex)
Overridden to specify the return type.
|
int |
getChildCount() |
int |
getIndex(TreeNode node) |
TreeTableNode |
getParent()
Overridden to specify the return type.
|
Object |
getUserObject()
Returns this node's user object.
|
void |
insert(MutableTreeTableNode child,
int index)
Adds the
child to this node at the specified index . |
boolean |
isEditable(int column)
Determines whether the specified column is editable.
|
boolean |
isLeaf() |
void |
remove(int index)
Removes the child node at the specified
index from this node. |
void |
remove(MutableTreeTableNode node)
Removes the specified child
node from this node. |
void |
removeFromParent()
Removes this node from it's parent.
|
void |
setAllowsChildren(boolean allowsChildren)
Determines whether or not this node is allowed to have children.
|
void |
setParent(MutableTreeTableNode newParent)
Sets the parent of this node to
newParent . |
void |
setUserObject(Object object)
Sets the user object stored in this node.
|
void |
setValueAt(Object aValue,
int column)
Sets the value for the given
column . |
String |
toString()
Returns the result of sending
toString() to this node's
user object, or null if this node has no user object. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getColumnCount, getValueAt
protected MutableTreeTableNode parent
protected final List<MutableTreeTableNode> children
protected transient Object userObject
protected boolean allowsChildren
public AbstractMutableTreeTableNode()
public AbstractMutableTreeTableNode(Object userObject)
public AbstractMutableTreeTableNode(Object userObject, boolean allowsChildren)
protected List<MutableTreeTableNode> createChildrenList()
This method is called by the constructor.
null
public void add(MutableTreeTableNode child)
public void insert(MutableTreeTableNode child, int index)
child
to this node at the specified index
. This
method calls setParent
on child
with this
as the
parameter.insert
in interface MutableTreeTableNode
child
- the node to add as a childindex
- the index of the childpublic void remove(int index)
index
from this node.
This method calls setParent
on child
with a null
parameter.remove
in interface MutableTreeTableNode
index
- the index of the childpublic void remove(MutableTreeTableNode node)
node
from this node.
This method calls setParent
on child
with a null
parameter.remove
in interface MutableTreeTableNode
node
- the index of the childpublic void removeFromParent()
getParent().remove(this)
.removeFromParent
in interface MutableTreeTableNode
public void setParent(MutableTreeTableNode newParent)
newParent
. This methods remove
the node from its old parent.setParent
in interface MutableTreeTableNode
newParent
- the new parent for this nodepublic Object getUserObject()
getUserObject
in interface TreeTableNode
setUserObject(java.lang.Object)
,
toString()
public void setUserObject(Object object)
setUserObject
in interface TreeTableNode
object
- the object to storepublic TreeTableNode getChildAt(int childIndex)
TreeNode
at index childIndex
. Models that utilize this node should verify
the column count before querying this node, since nodes may return
differing sizes even for the same model.getChildAt
in interface TreeNode
getChildAt
in interface TreeTableNode
childIndex
- the index of the childTreeTableNode
corresponding to the specified indexpublic TreeTableNode getParent()
TreeTableNode
of the receiver.getParent
in interface TreeNode
getParent
in interface TreeTableNode
TreeTableNode
or null
if this node has
no parent (such nodes are usually root nodes).public Enumeration<? extends MutableTreeTableNode> children()
children
in interface TreeNode
children
in interface MutableTreeTableNode
children
in interface TreeTableNode
TreeTableNode
spublic boolean getAllowsChildren()
getAllowsChildren
in interface TreeNode
public void setAllowsChildren(boolean allowsChildren)
allowsChildren
is false
, all of this node's children are
removed.
Note: By default, a node allows children.
allowsChildren
- true
if this node is allowed to have childrenpublic int getChildCount()
getChildCount
in interface TreeNode
public boolean isEditable(int column)
isEditable
in interface TreeTableNode
column
- the column to queryfalse
public void setValueAt(Object aValue, int column)
column
.setValueAt
in interface TreeTableNode
aValue
- the value to setcolumn
- the column to set the value onpublic String toString()
toString()
to this node's
user object, or null if this node has no user object.toString
in class Object
getUserObject()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses