Preferences Editor

de.jppietsch.prefedit
Class AbstractTreeNode

java.lang.Object
  extended byde.jppietsch.prefedit.AbstractTreeNode
All Implemented Interfaces:
TreeNode

public abstract class AbstractTreeNode
extends Object
implements TreeNode

Baseclass for this package's collection of tree nodes.

Version:
$Revision: 1.2 $
Author:
Jan-Peter Pietsch

Field Summary
private  List childs
          List of child nodes.
 
Constructor Summary
AbstractTreeNode()
           
 
Method Summary
 Enumeration children()
          Returns an enumeration of the direct childs of this node.
private  List childs()
          Returns the list of childs.
 boolean getAllowsChildren()
          All nodes are preferences and therefore allow childs.
 TreeNode getChildAt(int aChildIndex)
          Returns the n'th child node of this node.
 int getChildCount()
          Returns the number of child nodes.
 int getIndex(TreeNode aNode)
          Returns the index of a given child.
abstract  Preferences getPreferences()
          Returns the preferences represented by this node.
protected abstract  void initializeChilds(List someChilds)
          Fills the list of child nodes.
 boolean isLeaf()
          Does this node have any childs?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeNode
getParent
 

Field Detail

childs

private List childs
List of child nodes.

Constructor Detail

AbstractTreeNode

public AbstractTreeNode()
Method Detail

getChildAt

public TreeNode getChildAt(int aChildIndex)
Returns the n'th child node of this node.

Specified by:
getChildAt in interface TreeNode
Parameters:
aChildIndex - Zero-based index.
Returns:
A tree node.

getChildCount

public int getChildCount()
Returns the number of child nodes.

Specified by:
getChildCount in interface TreeNode
Returns:
Length of list determined by initializeChilds(List).

getIndex

public int getIndex(TreeNode aNode)
Returns the index of a given child.

Specified by:
getIndex in interface TreeNode
Parameters:
aNode - of which the index is searched.
Returns:
The index of aNode or -1.

getAllowsChildren

public boolean getAllowsChildren()
All nodes are preferences and therefore allow childs.

Specified by:
getAllowsChildren in interface TreeNode
Returns:
Always true.

isLeaf

public boolean isLeaf()
Does this node have any childs?

Specified by:
isLeaf in interface TreeNode
Returns:
This node has no childs.

getPreferences

public abstract Preferences getPreferences()
Returns the preferences represented by this node.

Returns:
Preferences represented by this node or null if this is the root.

children

public Enumeration children()
Returns an enumeration of the direct childs of this node.

Specified by:
children in interface TreeNode
Returns:
Enumeration of all direct childs of this node.

initializeChilds

protected abstract void initializeChilds(List someChilds)
Fills the list of child nodes.

Parameters:
someChilds - to be filled.

childs

private List childs()
Returns the list of childs. Calls initializeChilds(List) when this method is called the first time.

Returns:
Guaranteed initialized childs.

Preferences Editor