public class DefaultTreeTableNode extends DefaultMutableTreeNode implements TreeTableNode
| Modifier and Type | Class and Description |
|---|---|
protected class |
DefaultTreeTableNode.DefaultComparator |
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList |
userData
A list containing the column values
|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObjectDEFAULT_TREE_COLUMN| Constructor and Description |
|---|
DefaultTreeTableNode()
Creates a tree node with no parent, no children, and no data.
|
DefaultTreeTableNode(ArrayList data)
Creates a tree node with no parent, no children, but which allows
children, and initializes it with the specified user data.
|
DefaultTreeTableNode(ArrayList data,
int treeColumn)
Creates a tree node with no parent, no children, but which allows
children, and initializes it with the specified user data.
|
DefaultTreeTableNode(int treeColumn)
Creates a tree node with no parent, no children, and no data.
|
DefaultTreeTableNode(Object[] data)
Creates a tree node with no parent, no children, but which allows
children, and initializes it with the specified user data.
|
DefaultTreeTableNode(Object[] data,
int treeColumn)
Creates a tree node with no parent, no children, but which allows
children, and initializes it with the specified user data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(MutableTreeNode newChild)
Removes
newChild from its parent and makes it a child of
this node by adding it to this node's child array. |
protected static ArrayList |
convertToArrayList(Object[] anArray)
Returns an array list that contains the same objects as the array.
|
int |
getIndexForNewChild(TreeTableNode newChild)
Get an index to insert a new child into the node that is consistent with
the current ordering of the children (if any).
|
int |
getTreeColumn() |
Object |
getValueAt(int columnIndex)
Get the value in the node at columnIndex.
|
void |
insert(MutableTreeNode newChild,
int childIndex)
Removes
newChild from its present parent (if it has a
parent), sets the child's parent to this node, and then adds the child
to this node's child array at index childIndex. |
boolean |
isSorted()
Determine if the children are sorted
|
void |
setTreeColumn(int column)
Set the column in the tree table that contains the tree.
|
void |
setUserData(ArrayList data)
Replaces the user data list with the specified data.
|
void |
setUserData(Object[] data)
Replaces the user data list with the specified data.
|
void |
setUserObject(Object userObject)
Sets the user object for this node to
userObject. |
void |
setValueAt(Object aValue,
int columnIndex)
Sets the value in the node at columnIndex to aValue.
|
void |
sort(int column,
boolean ascending)
Sort the children according to the values of the input column identifier,
in either ascending or descending order.
|
void |
sort(int column,
boolean ascending,
boolean asksAllowsChildren)
Sort the children according to the values of the input column identifier,
in either ascending or descending order.
|
void |
sort(TreeTableNodeComparator comparator)
Sort the children using the natural ordering of the nodes according
to the specified comparator.
|
void |
sort(TreeTableNodeComparator comparator,
int column,
boolean ascending,
boolean asksAllowsChildren)
Sort the children using the natural ordering of the nodes according
to the specified comparator.
|
breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitremove, remove, removeFromParent, setParentchildren, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeafprotected ArrayList userData
public DefaultTreeTableNode()
public DefaultTreeTableNode(int treeColumn)
treeColumn - the column in the tree table that contains the tree.public DefaultTreeTableNode(ArrayList data)
data - a list provided by the user that constitutes the node's datapublic DefaultTreeTableNode(ArrayList data, int treeColumn)
data - a list provided by the user that constitutes the node's datatreeColumn - the column in the tree table that contains the tree.public DefaultTreeTableNode(Object[] data)
data - an array provided by the user that constitutes the node's datapublic DefaultTreeTableNode(Object[] data, int treeColumn)
data - a list provided by the user that constitutes the node's datatreeColumn - the column in the tree table that contains the tree.public void add(MutableTreeNode newChild)
newChild from its parent and makes it a child of
this node by adding it to this node's child array. The child will
normally be added at the end of the array unless the this node is sorted,
in which case the node will be added in a position consistent with the
current ordering.add in class DefaultMutableTreeNodenewChild - node to add as a child of this nodeIllegalArgumentException - if newChild
is nullIllegalStateException - if this node does not allow
childreninsert(javax.swing.tree.MutableTreeNode, int)public void insert(MutableTreeNode newChild, int childIndex)
newChild from its present parent (if it has a
parent), sets the child's parent to this node, and then adds the child
to this node's child array at index childIndex.
newChild must not be null and must not be an ancestor of
this node. If this node is sorted, the childIndex must be
consistent with the current ordering.insert in interface MutableTreeNodeinsert in class DefaultMutableTreeNodenewChild - the MutableTreeNode to insert under this nodechildIndex - the index in this node's child array
where this node is to be insertedArrayIndexOutOfBoundsException - if
childIndex is out of boundsIllegalArgumentException - if
newChild is null or is an
ancestor of this node
or if childIndex is not consistent
with the current orderingIllegalStateException - if this node does not allow
childrenDefaultMutableTreeNode.isNodeDescendant(javax.swing.tree.DefaultMutableTreeNode)public Object getValueAt(int columnIndex)
getValueAt in interface TreeTableNodepublic void setTreeColumn(int column)
setTreeColumn in interface TreeTableNodecolumn - public int getTreeColumn()
getTreeColumn in interface TreeTableNodepublic void setUserObject(Object userObject)
userObject. The user
object is equivalent to the tree column value in the user data list.
The tree column is identified by TreeTableNode.TREE_COLUMN.setUserObject in interface MutableTreeNodesetUserObject in class DefaultMutableTreeNodeuserObject - the Object that constitutes this node's
user-specified dataDefaultMutableTreeNode.getUserObject(),
DefaultMutableTreeNode.toString()public void setUserData(Object[] data)
TreeTableNode.TREE_COLUMN.data - an array provided by the user that constitutes the node's dataIllegalArgumentException - if data is nullpublic void setUserData(ArrayList data)
TreeTableNode.TREE_COLUMN.data - a list provided by the user that constitutes the node's dataIllegalArgumentException - if data is nullpublic void setValueAt(Object aValue, int columnIndex)
setValueAt in interface TreeTableNodepublic void sort(int column,
boolean ascending)
sort in interface TreeTableNodepublic void sort(int column,
boolean ascending,
boolean asksAllowsChildren)
sort in interface TreeTableNodepublic void sort(TreeTableNodeComparator comparator, int column, boolean ascending, boolean asksAllowsChildren)
sort in interface TreeTableNodepublic void sort(TreeTableNodeComparator comparator)
sort in interface TreeTableNodepublic boolean isSorted()
isSorted in interface TreeTableNodepublic int getIndexForNewChild(TreeTableNode newChild)
getIndexForNewChild in interface TreeTableNodeCopyright © 2003, 2023, Oracle and/or its affiliates.