Class AbstractConfigTreeNode
- java.lang.Object
-
- org.pentaho.reporting.tools.configeditor.model.AbstractConfigTreeNode
-
- All Implemented Interfaces:
TreeNode
,ConfigTreeNode
- Direct Known Subclasses:
ConfigTreeModuleNode
,ConfigTreeRootNode
,ConfigTreeSectionNode
public abstract class AbstractConfigTreeNode extends 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
Constructors Modifier Constructor Description protected
AbstractConfigTreeNode(String name)
Creates a new config tree node with the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ConfigTreeNode node)
Adds the given node to the tree model.Enumeration
children()
Returns the children of the receiver as anEnumeration
.boolean
getAllowsChildren()
Returns true if the receiver allows children.TreeNode
getChildAt(int childIndex)
Returns the childTreeNode
at indexchildIndex
.int
getChildCount()
Returns the number of childrenTreeNode
s the receiver contains.int
getIndex(TreeNode node)
Returns the index ofnode
in the receivers children.String
getName()
Return the name of the node.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(TreeNode parent)
Defines the parent of this node, or null if the node should not have a parent.
-
-
-
Constructor Detail
-
AbstractConfigTreeNode
protected AbstractConfigTreeNode(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 TreeNode getChildAt(int childIndex)
Returns the childTreeNode
at indexchildIndex
.- Specified by:
getChildAt
in interfaceTreeNode
- Parameters:
childIndex
- the index of the child node within this parent node.- Returns:
- the child node.
-
getChildCount
public int getChildCount()
Returns the number of childrenTreeNode
s the receiver contains.- Specified by:
getChildCount
in interfaceTreeNode
- Returns:
- the number of child nodes.
-
getAllowsChildren
public boolean getAllowsChildren()
Returns true if the receiver allows children.- Specified by:
getAllowsChildren
in interfaceTreeNode
- Returns:
- true, if this node allows child nodes.
-
getIndex
public int getIndex(TreeNode node)
Returns the index ofnode
in the receivers children. If the receiver does not containnode
, -1 will be returned.
-
isLeaf
public boolean isLeaf()
Returns true if the receiver is a leaf.
-
children
public Enumeration children()
Returns the children of the receiver as anEnumeration
.
-
getName
public String getName()
Return the name of the node.- Specified by:
getName
in interfaceConfigTreeNode
- Returns:
- the name of the node.
-
getParent
public TreeNode getParent()
Return the parent of this node or null if there is no parent.- Specified by:
getParent
in interfaceTreeNode
- Returns:
- the parent
- See Also:
TreeNode.getParent()
-
setParent
public void setParent(TreeNode parent)
Defines the parent of this node, or null if the node should not have a parent.- Specified by:
setParent
in interfaceConfigTreeNode
- Parameters:
parent
- the new parent or null.
-
-