DefaultTreeElement Class

com.bea.ide.element
DefaultTreeElement Class

public class DefaultTreeElement

    extends DefaultElement
    implements ITreeElement

The DefaultTreeElement is a Default element that implements some basic tree behaviour.


Hierarchy
Object
  DefaultElement
    DefaultTreeElement
All Implemented Interfaces

IElement, ITreeElement
Direct Known Subclasses

DefaultDocumentElement

Field Summary

protected ITreeElement
_parent
parent object for this node
protected Vector
_vChildren
Vector of children for this node
 

Constructor Summary

DefaultTreeElement()

 

Method Summary

public void
addChild(ITreeElement child)
Add the given element as a child of this element.
public Enumeration
children()
Alternate means to obtain the children of this element.
public ITreeElement
getChild(int iChild)
Returns the nth child of this node.
public int
getChildCount()
Returns the total number of children for this element.
public ITreeElement
getParent()
Returns the parent of this node in the element structure.
protected void
removeChild(ITreeElement child)
This method is used to remove a child from the node's list of children.
 
Methods from  com.bea.ide.element.DefaultElement
getProperty, getPropertyDescriptors, setProperty
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.bea.ide.element.IElement
getProperty, getPropertyDescriptors, setProperty
 
Methods from interface com.bea.ide.element.ITreeElement
children, getChild, getChildCount, getParent
 

Field Detail

_parent

protected ITreeElement _parent
parent object for this node


_vChildren

protected Vector _vChildren
Vector of children for this node

 

Constructor Detail

DefaultTreeElement

public DefaultTreeElement()
 

Method Detail

addChild(ITreeElement) Method

public void addChild(ITreeElement child)
Add the given element as a child of this element. This method will also set the parent of the child if it is an instance of DefaultTreeElement

Parameters

child
node to add as a child

children() Method

public Enumeration children()
Description copied from ITreeElement.children()
Alternate means to obtain the children of this element. Same rules apply as above. Note that the Enumeration returned may be invalidated by operations that modify the tree structure of this element.

Returns

Java enumeration that enumerates the children of this element

getChild(int) Method

public ITreeElement getChild(int iChild)
Description copied from ITreeElement.getChild(int)
Returns the nth child of this node. The nth child should be well defined and calls to this method with the same value for iChild should return the same result as long as no changes are made to the tree.

Parameters

iChild
index of the child node to return

Returns

tree element that occupies the specified index in this node's list of descendants

getChildCount() Method

public int getChildCount()
Description copied from ITreeElement.getChildCount()
Returns the total number of children for this element. This value should not change if there are no changes to the tree. getChild should return values for indices 0 through i-1 where i is the result of this method.

Returns

number of tree elements that are direct descendants of this node

getParent() Method

public ITreeElement getParent()
Description copied from ITreeElement.getParent()
Returns the parent of this node in the element structure. The parent will typically have this node in it's list of children. However, if there are multiple parents, the value is implementation defined.

Returns

The parent element of this one or null if there is no parent.

removeChild(ITreeElement) Method

protected void removeChild(ITreeElement child)
This method is used to remove a child from the node's list of children. This method will also clear the parent of the child if it is an instance of DefaultTreeElement

Parameters

child
node to remove.