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

public class DefaultTreeTableNode extends DefaultMutableTreeNode implements TreeTableNode
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:
  • Field Details

    • userData

      protected ArrayList 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

      public DefaultTreeTableNode(ArrayList data)
      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

      public 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.
      Parameters:
      data - a list provided by the user that constitutes the node's data
      treeColumn - the column in the tree table that contains the tree.
    • DefaultTreeTableNode

      public DefaultTreeTableNode(Object[] data)
      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

      public 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.
      Parameters:
      data - a list provided by the user that constitutes the node's data
      treeColumn - the column in the tree table that contains the tree.
  • Method Details

    • add

      public 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. 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 class DefaultMutableTreeNode
      Parameters:
      newChild - node to add as a child of this node
      Throws:
      IllegalArgumentException - if newChild is null
      IllegalStateException - if this node does not allow children
      See Also:
    • insert

      public 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. 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.
      Specified by:
      insert in interface MutableTreeNode
      Overrides:
      insert in class DefaultMutableTreeNode
      Parameters:
      newChild - the MutableTreeNode to insert under this node
      childIndex - the index in this node's child array where this node is to be inserted
      Throws:
      ArrayIndexOutOfBoundsException - if childIndex is out of bounds
      IllegalArgumentException - if newChild is null or is an ancestor of this node or if childIndex is not consistent with the current ordering
      IllegalStateException - if this node does not allow children
      See Also:
    • getValueAt

      public Object getValueAt(int columnIndex)
      Get the value in the node at columnIndex.
      Specified by:
      getValueAt in interface TreeTableNode
    • setTreeColumn

      public void setTreeColumn(int column)
      Set the column in the tree table that contains the tree.
      Specified by:
      setTreeColumn in interface TreeTableNode
      Parameters:
      column -
    • getTreeColumn

      public int getTreeColumn()
      Specified by:
      getTreeColumn in interface TreeTableNode
      Returns:
      the column in the tree table that contains the tree.
    • setUserObject

      public void setUserObject(Object userObject)
      Sets the user object for this node to 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.
      Specified by:
      setUserObject in interface MutableTreeNode
      Overrides:
      setUserObject in class DefaultMutableTreeNode
      Parameters:
      userObject - the Object that constitutes this node's user-specified data
      See Also:
    • setUserData

      public void setUserData(Object[] data)
      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 by TreeTableNode.TREE_COLUMN.
      Parameters:
      data - an array provided by the user that constitutes the node's data
      Throws:
      IllegalArgumentException - if data is null
    • setUserData

      public void setUserData(ArrayList data)
      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 by TreeTableNode.TREE_COLUMN.
      Parameters:
      data - a list provided by the user that constitutes the node's data
      Throws:
      IllegalArgumentException - if data is null
    • setValueAt

      public void setValueAt(Object aValue, int columnIndex)
      Sets the value in the node at columnIndex to aValue.
      Specified by:
      setValueAt in interface TreeTableNode
    • 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 interface TreeTableNode
    • 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 interface TreeTableNode
    • 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 interface TreeTableNode
    • sort

      public void sort(TreeTableNodeComparator comparator)
      Sort the children using the natural ordering of the nodes according to the specified comparator.
      Specified by:
      sort in interface TreeTableNode
    • isSorted

      public boolean isSorted()
      Determine if the children are sorted
      Specified by:
      isSorted in interface TreeTableNode
    • getIndexForNewChild

      public 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).
      Specified by:
      getIndexForNewChild in interface TreeTableNode
    • convertToArrayList

      protected static ArrayList convertToArrayList(Object[] anArray)
      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 is null, returns null