## org.apache.myfaces.custom.tree
Class DefaultMutableTreeNode

    java.lang.Object
      org.apache.myfaces.custom.tree.DefaultMutableTreeNode

All Implemented Interfaces:
  MutableTreeNode, TreeNode

public class DefaultMutableTreeNode
extends java.lang.Object
implements MutableTreeNode

Default implementation of `MutableTreeNode`.

Version:
  $Revision: 169651 $ $Date: 2005-05-11 12:14:23 -0400 (Wed, 11 May 2005) $
Author:
  Oliver Rossmueller

Constructor Summary
`DefaultMutableTreeNode(java.util.List children, boolean allowsChildren)`
`DefaultMutableTreeNode(java.lang.Object userObject)`
`DefaultMutableTreeNode(java.lang.Object userObject, MutableTreeNode parent, boolean allowsChildren)`

Method Summary
`java.util.Iterator` `children()` Answer the children of the receiver.
`boolean` `getAllowsChildren()` Answer true if this node allows children.
`TreeNode` `getChildAt(int index)` Answer the child at the given index.
`int` `getChildCount()` Answer the number of children this node contains.
`int` `getIndex(TreeNode node)` Answer the index of the given node in this node's children.
`TreeNode` `getParent()` Answer the parent of this node.
`java.lang.Object` `getUserObject()`
`void` `insert(MutableTreeNode child)` Add the given child to the children of this node.
`void` `insert(MutableTreeNode child, int index)` Add the given child to the children of this node at index.
`boolean` `isLeaf()` Answer true if this is a leaf node.
`void` `remove(int index)` Remove the child at the given index.
`void` `remove(MutableTreeNode node)` Remove the given node.
`void` `removeFromParent()` Remove this node from its parent.
`void` `setParent(MutableTreeNode parent)` Set the parent node.
`void` `setUserObject(java.lang.Object object)` Sets the user object of this node.
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DefaultMutableTreeNode

    public DefaultMutableTreeNode(java.lang.Object userObject)

Parameters:
  `userObject` - The userObject.

### DefaultMutableTreeNode

    public DefaultMutableTreeNode(java.util.List children,
                                  boolean allowsChildren)

Parameters:
  `children` - The children.
  `allowsChildren` - The allowsChildren.

### DefaultMutableTreeNode

    public DefaultMutableTreeNode(java.lang.Object userObject,
                                  MutableTreeNode parent,
                                  boolean allowsChildren)

Parameters:
  `userObject` - The userobject.
  `parent` - The parent.
  `allowsChildren` - The allowsChildren.

Method Detail

### insert

    public void insert(MutableTreeNode child)

  Description copied from interface: `MutableTreeNode`
  Add the given child to the children of this node. This will set this node as the parent of the child using {#setParent}.

  Specified by:
    `insert` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.insert(org.apache.myfaces.custom.tree.MutableTreeNode)`

### insert

    public void insert(MutableTreeNode child,
                       int index)

  Description copied from interface: `MutableTreeNode`
  Add the given child to the children of this node at index. This will set this node as the parent of the child using {#setParent}.

  Specified by:
    `insert` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.insert(org.apache.myfaces.custom.tree.MutableTreeNode, int)`

### remove

    public void remove(int index)

  Description copied from interface: `MutableTreeNode`
  Remove the child at the given index.

  Specified by:
    `remove` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.remove(int)`

### remove

    public void remove(MutableTreeNode node)

  Description copied from interface: `MutableTreeNode`
  Remove the given node.

  Specified by:
    `remove` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.remove(org.apache.myfaces.custom.tree.MutableTreeNode)`

### setUserObject

    public void setUserObject(java.lang.Object object)

  Description copied from interface: `MutableTreeNode`
  Sets the user object of this node.

  Specified by:
    `setUserObject` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.setUserObject(java.lang.Object)`

### getUserObject

    public java.lang.Object getUserObject()

  Specified by:
    `getUserObject` in interface `TreeNode`
  Returns:
    Gets the user object of this node.
  See Also:
    `TreeNode.getUserObject()`

### removeFromParent

    public void removeFromParent()

  Description copied from interface: `MutableTreeNode`
  Remove this node from its parent.

  Specified by:
    `removeFromParent` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.removeFromParent()`

### setParent

    public void setParent(MutableTreeNode parent)

  Description copied from interface: `MutableTreeNode`
  Set the parent node.

  Specified by:
    `setParent` in interface `MutableTreeNode`
  See Also:
    `MutableTreeNode.setParent(org.apache.myfaces.custom.tree.MutableTreeNode)`

### getChildAt

    public TreeNode getChildAt(int index)

  Description copied from interface: `TreeNode`
  Answer the child at the given index.

  Specified by:
    `getChildAt` in interface `TreeNode`
  See Also:
    `TreeNode.getChildAt(int)`

### getChildCount

    public int getChildCount()

  Description copied from interface: `TreeNode`
  Answer the number of children this node contains.

  Specified by:
    `getChildCount` in interface `TreeNode`
  See Also:
    `TreeNode.getChildCount()`

### getParent

    public TreeNode getParent()

  Description copied from interface: `TreeNode`
  Answer the parent of this node.

  Specified by:
    `getParent` in interface `TreeNode`
  See Also:
    `TreeNode.getParent()`

### getIndex

    public int getIndex(TreeNode node)

  Description copied from interface: `TreeNode`
  Answer the index of the given node in this node's children.

  Specified by:
    `getIndex` in interface `TreeNode`
  See Also:
    `TreeNode.getIndex(org.apache.myfaces.custom.tree.TreeNode)`

### getAllowsChildren

    public boolean getAllowsChildren()

  Description copied from interface: `TreeNode`
  Answer true if this node allows children.

  Specified by:
    `getAllowsChildren` in interface `TreeNode`
  See Also:
    `TreeNode.getAllowsChildren()`

### isLeaf

    public boolean isLeaf()

  Description copied from interface: `TreeNode`
  Answer true if this is a leaf node.

  Specified by:
    `isLeaf` in interface `TreeNode`
  See Also:
    `TreeNode.isLeaf()`

### children

    public java.util.Iterator children()

  Description copied from interface: `TreeNode`
  Answer the children of the receiver. The base collection is unmodifyable.

  Specified by:
    `children` in interface `TreeNode`
  See Also:
    `TreeNode.children()`

### toString

    public java.lang.String toString()

  See Also:
    `Object.toString()`