org.jfree.report.modules.gui.config.model
Class AbstractConfigTreeNode

java.lang.Object
  |
  +--org.jfree.report.modules.gui.config.model.AbstractConfigTreeNode
Direct Known Subclasses:
ConfigTreeModuleNode, ConfigTreeRootNode, ConfigTreeSectionNode

public abstract class AbstractConfigTreeNode
extends java.lang.Object
implements ConfigTreeNode

An abstract base implementation of the config tree node interface. The implementation provides all base services needed to have an valid TreeNode.

Author:
Thomas Morgner

Constructor Summary
AbstractConfigTreeNode(java.lang.String name)
          Creates a new config tree node with the given name.
 
Method Summary
 void add(ConfigTreeNode node)
          Adds the given node to the tree model.
 java.util.Enumeration children()
          Returns the children of the receiver as an Enumeration.
 boolean getAllowsChildren()
          Returns true if the receiver allows children.
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          Returns the child TreeNode at index childIndex.
 int getChildCount()
          Returns the number of children TreeNodes the receiver contains.
 int getIndex(javax.swing.tree.TreeNode node)
          Returns the index of node in the receivers children.
 java.lang.String getName()
          Return the name of the node.
 javax.swing.tree.TreeNode getParent()
          Return the parent of this node or null if there is no parent.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
protected  void reset()
          Removes all child nodes.
 void setParent(javax.swing.tree.TreeNode parent)
          Defines the parent of this node, or null if the node should not have a parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConfigTreeNode

public AbstractConfigTreeNode(java.lang.String name)
Creates a new config tree node with the given name. The node will be able to have child nodes.
Parameters:
name - the name of the node.
Method Detail

add

public void add(ConfigTreeNode node)
Adds the given node to the tree model.
Parameters:
node - the new node that should be added.

reset

protected void reset()
Removes all child nodes.

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Returns the child TreeNode at index childIndex.
Parameters:
childIndex - the index of the child node within this parent node.
Returns:
the child node.

getChildCount

public int getChildCount()
Returns the number of children TreeNodes the receiver contains.
Returns:
the number of child nodes.

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the receiver allows children.
Returns:
true, if this node allows child nodes.

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.
Parameters:
node - the suspected child node.
Returns:
the index of the given node or -1 if the node is not contained in this node.

isLeaf

public boolean isLeaf()
Returns true if the receiver is a leaf.
Returns:
true, if this node is a leaf node, false otherwise.

children

public java.util.Enumeration children()
Returns the children of the receiver as an Enumeration.
Returns:
all childs as enumeration.

getName

public java.lang.String getName()
Return the name of the node.
Specified by:
getName in interface ConfigTreeNode
Returns:
the name of the node.
See Also:
ConfigTreeNode.getName()

getParent

public javax.swing.tree.TreeNode getParent()
Return the parent of this node or null if there is no parent.
Returns:
the parent
See Also:
TreeNode.getParent()

setParent

public void setParent(javax.swing.tree.TreeNode parent)
Defines the parent of this node, or null if the node should not have a parent.
Specified by:
setParent in interface ConfigTreeNode
Parameters:
parent - the new parent or null.