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, userObject
Fields 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 TypeMethodDescriptionvoid
add
(MutableTreeNode newChild) RemovesnewChild
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
getValueAt
(int columnIndex) Get the value in the node at columnIndex.void
insert
(MutableTreeNode newChild, int childIndex) RemovesnewChild
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 indexchildIndex
.boolean
isSorted()
Determine if the children are sortedvoid
setTreeColumn
(int column) Set the column in the tree table that contains the tree.void
setUserData
(Object[] data) Replaces the user data list with the specified data.void
setUserData
(ArrayList data) Replaces the user data list with the specified data.void
setUserObject
(Object userObject) Sets the user object for this node touserObject
.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.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, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javax.swing.tree.MutableTreeNode
remove, remove, removeFromParent, setParent
Methods 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
RemovesnewChild
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.- Overrides:
add
in classDefaultMutableTreeNode
- Parameters:
newChild
- node to add as a child of this node- Throws:
IllegalArgumentException
- ifnewChild
is nullIllegalStateException
- if this node does not allow children- See Also:
-
insert
RemovesnewChild
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 indexchildIndex
.newChild
must not be null and must not be an ancestor of this node. If this node is sorted, thechildIndex
must be consistent with the current ordering.- Specified by:
insert
in interfaceMutableTreeNode
- Overrides:
insert
in 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
- ifchildIndex
is out of boundsIllegalArgumentException
- ifnewChild
is null or is an ancestor of this node or ifchildIndex
is 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:
getValueAt
in interfaceTreeTableNode
-
setTreeColumn
public void setTreeColumn(int column) Set the column in the tree table that contains the tree.- Specified by:
setTreeColumn
in interfaceTreeTableNode
- Parameters:
column
-
-
getTreeColumn
public int getTreeColumn()- Specified by:
getTreeColumn
in 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:
setUserObject
in interfaceMutableTreeNode
- Overrides:
setUserObject
in 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
- ifdata
is 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
- ifdata
is null
-
setValueAt
Sets the value in the node at columnIndex to aValue.- Specified by:
setValueAt
in 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:
sort
in 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:
sort
in 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:
sort
in interfaceTreeTableNode
-
sort
Sort the children using the natural ordering of the nodes according to the specified comparator.- Specified by:
sort
in interfaceTreeTableNode
-
isSorted
public boolean isSorted()Determine if the children are sorted- Specified by:
isSorted
in 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:
getIndexForNewChild
in 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
anArray
isnull
, returnsnull
-