Package com.portal.pfc.ui
Class DefaultTreeTableNode
java.lang.Object
javax.swing.tree.DefaultMutableTreeNode
com.portal.pfc.ui.DefaultTreeTableNode
- All Implemented Interfaces:
TreeTableNode,Serializable,Cloneable,MutableTreeNode,TreeNode
- Direct Known Subclasses:
EDRTreeTableNode
A tree node that contains column data to support a tree table. The tree node
also supports sorting of the tree based on a specified column.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObjectFields inherited from interface com.portal.pfc.ui.TreeTableNode
DEFAULT_TREE_COLUMN -
Constructor Summary
ConstructorsConstructorDescriptionCreates a tree node with no parent, no children, and no 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.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. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(MutableTreeNode newChild) RemovesnewChildfrom its parent and makes it a child of this node by adding it to this node's child array.protected static ArrayListconvertToArrayList(Object[] anArray) Returns an array list that contains the same objects as the array.intgetIndexForNewChild(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).intgetValueAt(int columnIndex) Get the value in the node at columnIndex.voidinsert(MutableTreeNode newChild, int childIndex) RemovesnewChildfrom 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 indexchildIndex.booleanisSorted()Determine if the children are sortedvoidsetTreeColumn(int column) Set the column in the tree table that contains the tree.voidsetUserData(Object[] data) Replaces the user data list with the specified data.voidsetUserData(ArrayList data) Replaces the user data list with the specified data.voidsetUserObject(Object userObject) Sets the user object for this node touserObject.voidsetValueAt(Object aValue, int columnIndex) Sets the value in the node at columnIndex to aValue.voidsort(int column, boolean ascending) Sort the children according to the values of the input column identifier, in either ascending or descending order.voidsort(int column, boolean ascending, boolean asksAllowsChildren) Sort the children according to the values of the input column identifier, in either ascending or descending order.voidsort(TreeTableNodeComparator comparator) Sort the children using the natural ordering of the nodes according to the specified comparator.voidsort(TreeTableNodeComparator comparator, int column, boolean ascending, boolean asksAllowsChildren) Sort the children using the natural ordering of the nodes according to the specified comparator.Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
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, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.swing.tree.MutableTreeNode
remove, remove, removeFromParent, setParentMethods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
-
Field Details
-
userData
A list containing the column values
-
-
Constructor Details
-
DefaultTreeTableNode
public DefaultTreeTableNode()Creates a tree node with no parent, no children, and no data. -
DefaultTreeTableNode
public DefaultTreeTableNode(int treeColumn) Creates a tree node with no parent, no children, and no data.- Parameters:
treeColumn- the column in the tree table that contains the tree.
-
DefaultTreeTableNode
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user data.- Parameters:
data- a list provided by the user that constitutes the node's data
-
DefaultTreeTableNode
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user data.- Parameters:
data- a list provided by the user that constitutes the node's datatreeColumn- the column in the tree table that contains the tree.
-
DefaultTreeTableNode
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user data.- Parameters:
data- an array provided by the user that constitutes the node's data
-
DefaultTreeTableNode
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user data.- Parameters:
data- a list provided by the user that constitutes the node's datatreeColumn- the column in the tree table that contains the tree.
-
-
Method Details
-
add
RemovesnewChildfrom 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.- Overrides:
addin classDefaultMutableTreeNode- Parameters:
newChild- node to add as a child of this node- Throws:
IllegalArgumentException- ifnewChildis nullIllegalStateException- if this node does not allow children- See Also:
-
insert
RemovesnewChildfrom 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 indexchildIndex.newChildmust not be null and must not be an ancestor of this node. If this node is sorted, thechildIndexmust be consistent with the current ordering.- Specified by:
insertin interfaceMutableTreeNode- Overrides:
insertin classDefaultMutableTreeNode- Parameters:
newChild- the MutableTreeNode to insert under this nodechildIndex- the index in this node's child array where this node is to be inserted- Throws:
ArrayIndexOutOfBoundsException- ifchildIndexis out of boundsIllegalArgumentException- ifnewChildis null or is an ancestor of this node or ifchildIndexis not consistent with the current orderingIllegalStateException- if this node does not allow children- See Also:
-
getValueAt
Get the value in the node at columnIndex.- Specified by:
getValueAtin interfaceTreeTableNode
-
setTreeColumn
public void setTreeColumn(int column) Set the column in the tree table that contains the tree.- Specified by:
setTreeColumnin interfaceTreeTableNode- Parameters:
column-
-
getTreeColumn
public int getTreeColumn()- Specified by:
getTreeColumnin interfaceTreeTableNode- Returns:
- the column in the tree table that contains the tree.
-
setUserObject
Sets the user object for this node touserObject. The user object is equivalent to the tree column value in the user data list. The tree column is identified byTreeTableNode.TREE_COLUMN.- Specified by:
setUserObjectin interfaceMutableTreeNode- Overrides:
setUserObjectin classDefaultMutableTreeNode- Parameters:
userObject- the Object that constitutes this node's user-specified data- See Also:
-
setUserData
Replaces the user data list with the specified data. The user object is equivalent to the tree column value in the user data list. The tree column is identified byTreeTableNode.TREE_COLUMN.- Parameters:
data- an array provided by the user that constitutes the node's data- Throws:
IllegalArgumentException- ifdatais null
-
setUserData
Replaces the user data list with the specified data. The user object is equivalent to the tree column value in the user data list. The tree column is identified byTreeTableNode.TREE_COLUMN.- Parameters:
data- a list provided by the user that constitutes the node's data- Throws:
IllegalArgumentException- ifdatais null
-
setValueAt
Sets the value in the node at columnIndex to aValue.- Specified by:
setValueAtin interfaceTreeTableNode
-
sort
public void sort(int column, boolean ascending) Sort the children according to the values of the input column identifier, in either ascending or descending order.- Specified by:
sortin interfaceTreeTableNode
-
sort
public 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. Also specify how the ordering determines whether the child node is a branch or a leaf.- Specified by:
sortin interfaceTreeTableNode
-
sort
public 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.- Specified by:
sortin interfaceTreeTableNode
-
sort
Sort the children using the natural ordering of the nodes according to the specified comparator.- Specified by:
sortin interfaceTreeTableNode
-
isSorted
public boolean isSorted()Determine if the children are sorted- Specified by:
isSortedin interfaceTreeTableNode
-
getIndexForNewChild
Get an index to insert a new child into the node that is consistent with the current ordering of the children (if any).- Specified by:
getIndexForNewChildin interfaceTreeTableNode
-
convertToArrayList
Returns an array list that contains the same objects as the array.- Parameters:
anArray- the array to be converted- Returns:
- the new vector; if
anArrayisnull, returnsnull
-