Top Description Fields Constructors Methods
org.dom4j.swing

public Class BranchTreeNode

extends LeafTreeNode
Class Inheritance
Imports
java.util.ArrayList, .Enumeration, .List, javax.swing.tree.TreeNode, org.dom4j.Branch, .CharacterData, .Node

BranchTreeNode implements the Swing TreeNode interface to bind dom4j XML Branch nodes (i.e. Document and Element nodes) to a Swing TreeModel.

Authors
James Strachan , Jakob Jenkov
Version
$Revision: 1.10 $

Field Summary

Modifier and TypeField and Description
protected List<TreeNode>
children

Stores the child tree nodes

Inherited from org.dom4j.swing.LeafTreeNode:
EMPTY_ENUMERATIONxmlNode

Constructor Summary

AccessConstructor and Description
public
public
public
BranchTreeNode(TreeNode parent, Branch xmlNode)

Method Summary

Modifier and TypeMethod and Description
public Enumeration<TreeNode>
children()

Overrides org.dom4j.swing.LeafTreeNode.children.

Implements javax.swing.tree.TreeNode.children.

Returns the children of the receiver as an Enumeration.
protected List<TreeNode>

Returns:

DOCUMENT ME!
createChildList
()

Factory method to create List of children TreeNodes

protected TreeNode

Returns:

DOCUMENT ME!
createChildTreeNode
(Node
DOCUMENT ME!
xmlNode
)

Factory method to create child tree nodes for a given XML node type

public boolean
getAllowsChildren()

Overrides org.dom4j.swing.LeafTreeNode.getAllowsChildren.

Implements javax.swing.tree.TreeNode.getAllowsChildren.

Returns true if the receiver allows children.
public TreeNode
getChildAt(int
index of child
childIndex
)

Overrides org.dom4j.swing.LeafTreeNode.getChildAt.

Implements javax.swing.tree.TreeNode.getChildAt.

Returns the child TreeNode at index childIndex.
public int
getChildCount()

Overrides org.dom4j.swing.LeafTreeNode.getChildCount.

Implements javax.swing.tree.TreeNode.getChildCount.

Returns the number of children TreeNodes the receiver contains.
protected List<TreeNode>

Returns:

DOCUMENT ME!
getChildList
()

Uses Lazy Initialization pattern to create a List of children

public int
getIndex(TreeNode
node to be loked for
node
)

Overrides org.dom4j.swing.LeafTreeNode.getIndex.

Implements javax.swing.tree.TreeNode.getIndex.

Returns the index of node in the receivers children.
protected Branch
public boolean
isLeaf()

Overrides org.dom4j.swing.LeafTreeNode.isLeaf.

Implements javax.swing.tree.TreeNode.isLeaf.

Returns true if the receiver is a leaf.
public String
toString()

Overrides org.dom4j.swing.LeafTreeNode.toString.

Returns a string representation of the object.
Inherited from org.dom4j.swing.LeafTreeNode:
getParentgetXmlNodesetParent

Field Detail

childrenback to summary
protected List<TreeNode> children

Stores the child tree nodes

Constructor Detail

BranchTreeNodeback to summary
public BranchTreeNode()
BranchTreeNodeback to summary
public BranchTreeNode(Branch xmlNode)
BranchTreeNodeback to summary
public BranchTreeNode(TreeNode parent, Branch xmlNode)

Method Detail

childrenback to summary
public Enumeration<TreeNode> children()

Overrides org.dom4j.swing.LeafTreeNode.children.

Implements javax.swing.tree.TreeNode.children.

Doc from javax.swing.tree.TreeNode.children.

Returns the children of the receiver as an Enumeration.

Returns:Enumeration<TreeNode>

the children of the receiver as an Enumeration

createChildListback to summary
protected List<TreeNode> createChildList()

Factory method to create List of children TreeNodes

Returns:List<TreeNode>

DOCUMENT ME!

createChildTreeNodeback to summary
protected TreeNode createChildTreeNode(Node xmlNode)

Factory method to create child tree nodes for a given XML node type

Parameters
xmlNode:Node

DOCUMENT ME!

Returns:TreeNode

DOCUMENT ME!

getAllowsChildrenback to summary
public boolean getAllowsChildren()

Overrides org.dom4j.swing.LeafTreeNode.getAllowsChildren.

Implements javax.swing.tree.TreeNode.getAllowsChildren.

Doc from javax.swing.tree.TreeNode.getAllowsChildren.

Returns true if the receiver allows children.

Returns:boolean

whether the receiver allows children

getChildAtback to summary
public TreeNode getChildAt(int childIndex)

Overrides org.dom4j.swing.LeafTreeNode.getChildAt.

Implements javax.swing.tree.TreeNode.getChildAt.

Doc from javax.swing.tree.TreeNode.getChildAt.

Returns the child TreeNode at index childIndex.

Parameters
childIndex:int

index of child

Returns:TreeNode

the child node at given index

getChildCountback to summary
public int getChildCount()

Overrides org.dom4j.swing.LeafTreeNode.getChildCount.

Implements javax.swing.tree.TreeNode.getChildCount.

Doc from javax.swing.tree.TreeNode.getChildCount.

Returns the number of children TreeNodes the receiver contains.

Returns:int

the number of children the receiver contains

getChildListback to summary
protected List<TreeNode> getChildList()

Uses Lazy Initialization pattern to create a List of children

Returns:List<TreeNode>

DOCUMENT ME!

getIndexback to summary
public int getIndex(TreeNode node)

Overrides org.dom4j.swing.LeafTreeNode.getIndex.

Implements javax.swing.tree.TreeNode.getIndex.

Doc from javax.swing.tree.TreeNode.getIndex.

Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

Parameters
node:TreeNode

node to be loked for

Returns:int

index of specified node

getXmlBranchback to summary
protected Branch getXmlBranch()
isLeafback to summary
public boolean isLeaf()

Overrides org.dom4j.swing.LeafTreeNode.isLeaf.

Implements javax.swing.tree.TreeNode.isLeaf.

Doc from javax.swing.tree.TreeNode.isLeaf.

Returns true if the receiver is a leaf.

Returns:boolean

whether the receiver is a leaf

toStringback to summary
public String toString()

Overrides org.dom4j.swing.LeafTreeNode.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.