Class DefaultTreeTableNode

  • All Implemented Interfaces:
    TreeTableNode, java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
    Direct Known Subclasses:
    SetTreeTableNode

    public class DefaultTreeTableNode
    extends javax.swing.tree.DefaultMutableTreeNode
    implements TreeTableNode
    Default implementation for tree table nodes. Based on swings mutable tree node implementation.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected DefaultTreeTableModel model
      The model, used to generate events.
      protected TreeTableNodeType type
      The node type identifier.
      protected java.util.Map values
      The values.
      • Fields inherited from class javax.swing.tree.DefaultMutableTreeNode

        allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DefaultTreeTableNode getChild​(java.lang.Object obj)
      Get a child for the specified user object.
      TreeTableNode[] getChildren()
      Get all children of the node.
      protected DefaultTreeTableModel getModel()
      Get the model.
      TreeTableNodeType getType()
      Get the node type.
      java.lang.Object getValue​(int column)
      Get the value at a specific column.
      java.util.Map getValues()
      Get all values at once.
      void insert​(javax.swing.tree.MutableTreeNode child, int index)
      Adds child to the receiver at index.
      boolean instanceOf​(TreeTableNodeType type)
      Check if this node is an instance of the given treetable node type.
      void remove​(int index)
      Removes the child at index from the receiver.
      protected void setModel​(DefaultTreeTableModel model)
      Set the model.
      void setValue​(int column, java.lang.Object value)
      Set the value at a specific column.
      void setValues​(java.util.Map values)
      Set all values at once.
      java.lang.String toString()
      Get a string representation of this node.
      • Methods inherited from class javax.swing.tree.DefaultMutableTreeNode

        add, 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, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface javax.swing.tree.TreeNode

        children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
    • Field Detail

      • values

        protected java.util.Map values
        The values.
    • Constructor Detail

      • DefaultTreeTableNode

        public DefaultTreeTableNode​(TreeTableNodeType type,
                                    java.lang.Object object)
        Create a tree table node with single initial value.
        Parameters:
        type - The node type identifier.
        object - The object represented by this node.
      • DefaultTreeTableNode

        public DefaultTreeTableNode​(TreeTableNodeType type,
                                    java.lang.Object object,
                                    java.util.Map values)
        Create a tree table node with initial values.
        Parameters:
        type - The node type identifier.
        object - The object represented by this node.
        values - The initial display values.
    • Method Detail

      • getType

        public TreeTableNodeType getType()
        Get the node type.
        Returns:
        The node type identifier.
      • instanceOf

        public boolean instanceOf​(TreeTableNodeType type)
        Check if this node is an instance of the given treetable node type.
        Parameters:
        type - The treetabel node type.
      • getValue

        public java.lang.Object getValue​(int column)
        Get the value at a specific column.
        Specified by:
        getValue in interface TreeTableNode
        Parameters:
        column - The column.
        Returns:
        The value or empty string, when column index is too large.
      • getValues

        public java.util.Map getValues()
        Get all values at once.
        Returns:
        The values.
      • setValue

        public void setValue​(int column,
                             java.lang.Object value)
        Set the value at a specific column.
        Parameters:
        column - The column.
        value - The new value.
      • setValues

        public void setValues​(java.util.Map values)
        Set all values at once.
        Parameters:
        values - The new values.
      • insert

        public void insert​(javax.swing.tree.MutableTreeNode child,
                           int index)
        Adds child to the receiver at index. child will be messaged with setParent. Overridden to generate tree event.
        Specified by:
        insert in interface javax.swing.tree.MutableTreeNode
        Overrides:
        insert in class javax.swing.tree.DefaultMutableTreeNode
      • remove

        public void remove​(int index)
        Removes the child at index from the receiver. Overridden to generate tree event.
        Specified by:
        remove in interface javax.swing.tree.MutableTreeNode
        Overrides:
        remove in class javax.swing.tree.DefaultMutableTreeNode
      • getChild

        public DefaultTreeTableNode getChild​(java.lang.Object obj)
        Get a child for the specified user object.
        Parameters:
        obj - The user object.
        Returns:
        A child node with a user object equal to the the specified object (if any).
      • getChildren

        public TreeTableNode[] getChildren()
        Get all children of the node.
      • setModel

        protected void setModel​(DefaultTreeTableModel model)
        Set the model.
        Parameters:
        model - The model.
      • toString

        public java.lang.String toString()
        Get a string representation of this node.
        Overrides:
        toString in class javax.swing.tree.DefaultMutableTreeNode