org.richfaces.component
Class TreeNodeImpl

java.lang.Object
  extended by org.richfaces.component.TreeNodeImpl
All Implemented Interfaces:
java.io.Serializable, TreeNode

public class TreeNodeImpl
extends java.lang.Object
implements TreeNode

Author:
Nick Belaevski - nbelaevski@exadel.com created 16.11.2006 Default TreeNode implementation based on LinkedHashMap to preserve elements ordering
See Also:
Serialized Form

Constructor Summary
TreeNodeImpl()
           
 
Method Summary
 void addChild(java.lang.Object identifier, TreeNode child)
          adds child to children collection
 TreeNode getChild(java.lang.Object identifier)
          find child by id
 java.util.Iterator getChildren()
          getter for children
 java.lang.Object getData()
          getter for node attached data
 TreeNode getParent()
          getter for parent TreeNode
 boolean isLeaf()
          Returns whether this node is leaf
 void removeChild(java.lang.Object identifier)
          removes child from children collection by child id
 void setData(java.lang.Object data)
          setter for node attached data
 void setParent(TreeNode parent)
          setter for parent TreeNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeNodeImpl

public TreeNodeImpl()
Method Detail

getData

public java.lang.Object getData()
Description copied from interface: TreeNode
getter for node attached data

Specified by:
getData in interface TreeNode
Returns:
node attached data

getChild

public TreeNode getChild(java.lang.Object identifier)
Description copied from interface: TreeNode
find child by id

Specified by:
getChild in interface TreeNode
Parameters:
identifier - identifier of the child to find
Returns:
designated TreeNode instance or null

addChild

public void addChild(java.lang.Object identifier,
                     TreeNode child)
Description copied from interface: TreeNode
adds child to children collection

Specified by:
addChild in interface TreeNode
Parameters:
identifier - child identifier
child - child

removeChild

public void removeChild(java.lang.Object identifier)
Description copied from interface: TreeNode
removes child from children collection by child id

Specified by:
removeChild in interface TreeNode
Parameters:
identifier - id of the child to remove

setData

public void setData(java.lang.Object data)
Description copied from interface: TreeNode
setter for node attached data

Specified by:
setData in interface TreeNode
Parameters:
data - data to set as attached node data

getParent

public TreeNode getParent()
Description copied from interface: TreeNode
getter for parent TreeNode

Specified by:
getParent in interface TreeNode
Returns:
parent TreeNode instance or null if this node is root

setParent

public void setParent(TreeNode parent)
Description copied from interface: TreeNode
setter for parent TreeNode

Specified by:
setParent in interface TreeNode
Parameters:
parent - TreeNode to set as parent

getChildren

public java.util.Iterator getChildren()
Description copied from interface: TreeNode
getter for children

Specified by:
getChildren in interface TreeNode
Returns:
Iterator of Map.Entry instances containing TreeNode as values and their identifiers as keys

isLeaf

public boolean isLeaf()
Description copied from interface: TreeNode
Returns whether this node is leaf

Specified by:
isLeaf in interface TreeNode
Returns:
true if this node is leaf else returns false


Copyright © 2007. All Rights Reserved.