BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.html
Class TreeNode

java.lang.Object
  extended by com.bea.wlw.netui.tags.html.TreeNode
All Implemented Interfaces:
Serializable

public class TreeNode
extends Object
implements Serializable

An individual node of a Tree, and rendered by that Tree instance.

See Also:
Serialized Form

Field Summary
protected  String action
          The action invoked if this node is selected by the user.
protected  ArrayList children
          The set of child TreeControlNodes for this node, in the order that they should be displayed.
static String EXPAND_NODE
           
protected  boolean expanded
          Is this node currently expanded?
protected  String href
           
protected  String icon
          The pathname to the icon file displayed when this node is visible, relative to the image directory for our images.
protected  String label
          The label that will be displayed when this node is visible.
protected  boolean last
          Is this the last node in the set of children for our parent node?
protected  String name
          The unique (within the entire tree) name of this node.
protected  TreeNode parent
          The parent node of this node, or null if this is the root node.
protected  boolean selected
          Is this node currently selected?
static String SELECTED_NODE
           
protected  String target
          The window target for the hyperlink identified by the action property, if this node is selected by the user.
protected  int width
          The display width necessary to display this item (if it is visible).
 
Constructor Summary
TreeNode(String icon, String label, String action, String href, String target, boolean expanded)
          Construct a new TreeNode with the specified parameters.
 
Method Summary
 void addChild(int offset, TreeNode child)
          Add a new child node at the specified position in the child list.
 void addChild(TreeNode child)
          Add a new child node to the end of the list.
 void collapse()
          Code that runs when the node is collapsed.
 void expand()
          Code that runs when the node is expanded.
 TreeNode findNode(String nodeName)
           
 String getAction()
          Gets the action invoked if this node is selected by the user.
 TreeNode getChild(int index)
          Return the child node at the given zero-relative index.
 TreeNode[] getChildren()
          Return the set of child nodes for this node.
 String getHref()
          Gets the hyperlink to which control will be directed if this node is selected by the user.
 String getIcon()
          Gets the pathname to the icon file displayed when this node is visible, relative to the image directory for the images.
 String getLabel()
          Gets the label that will be displayed when this node is visible.
 String getName()
           
 TreeNode getParent()
          Gets the parent node of this node, or null if this is the root node.
 TreeNode getRoot(TreeNode node)
          Gets the root node of this tree.
 String getTarget()
          Gets the window target for the hyperlink identified by the action property, if this node is selected.
 int getWidth()
          Gets the display width necessary to display this item (if it is visible).
 boolean isExpanded()
          Gets if this node is currently expanded.
 boolean isLast()
          Gets whether or not this is the last node in the set of children for the parent node.
 boolean isLeaf()
          Gets whether or not this a "leaf" node (i.e.
 boolean isSelected()
          Gets whether this node currently selected.
 void removeChild(int offset)
          Remove the child node (and all children of that child) at the specified position in the child list.
 void removeChild(TreeNode child)
          Remove the specified child node.
 void setExpanded(boolean expanded)
          Sets if this node is currently expanded.
 void setIcon(String icon)
          Set the pathname to the icon to display when this node is visible.
 void setLast(boolean last)
           
 void setName(String name)
           
 void setParent(TreeNode parent)
          Sets the parent node of this node.
 void setSelected(boolean selected)
          Sets whether this node currently selected.
 void updateName(TreeNode parentNode, int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTED_NODE

public static final String SELECTED_NODE
See Also:
Constant Field Values

EXPAND_NODE

public static final String EXPAND_NODE
See Also:
Constant Field Values

children

protected ArrayList children
The set of child TreeControlNodes for this node, in the order that they should be displayed.


action

protected String action
The action invoked if this node is selected by the user.


expanded

protected boolean expanded
Is this node currently expanded?


href

protected String href

icon

protected String icon
The pathname to the icon file displayed when this node is visible, relative to the image directory for our images.


label

protected String label
The label that will be displayed when this node is visible.


last

protected boolean last
Is this the last node in the set of children for our parent node?


name

protected String name
The unique (within the entire tree) name of this node.


parent

protected TreeNode parent
The parent node of this node, or null if this is the root node.


selected

protected boolean selected
Is this node currently selected?


target

protected String target
The window target for the hyperlink identified by the action property, if this node is selected by the user.


width

protected int width
The display width necessary to display this item (if it is visible). If this item is not visible, the calculated width will be that of our most immediately visible parent.

Constructor Detail

TreeNode

public TreeNode(String icon,
                String label,
                String action,
                String href,
                String target,
                boolean expanded)
Construct a new TreeNode with the specified parameters.

Parameters:
icon - Pathname of the image file for the icon to be displayed when this node is visible, relative to the image directory for our images
label - The label that will be displayed to the user if this node is visible
action - The action performed if the user selects this node, or null if this node's label should not invoke an action
href - The hyperlink to be selected if the user selects this node, or null if this node's label should not be a hyperlink
target - The window target in which the action hyperlink's results will be displayed, or null for the current window
expanded - Should this node be expanded?
Method Detail

getAction

public String getAction()
Gets the action invoked if this node is selected by the user.

Returns:
the action

isExpanded

public boolean isExpanded()
Gets if this node is currently expanded.

Returns:
the expanded state

setExpanded

public void setExpanded(boolean expanded)
Sets if this node is currently expanded.

Parameters:
expanded - - the expanded state

getHref

public String getHref()
Gets the hyperlink to which control will be directed if this node is selected by the user.

Returns:
the action

getIcon

public String getIcon()
Gets the pathname to the icon file displayed when this node is visible, relative to the image directory for the images.

Returns:
the icon pathname

setIcon

public void setIcon(String icon)
Set the pathname to the icon to display when this node is visible. The name is relative to the image directory.

Parameters:
icon - The relative path to the icond.

getLabel

public String getLabel()
Gets the label that will be displayed when this node is visible.

Returns:
the label

isLast

public boolean isLast()
Gets whether or not this is the last node in the set of children for the parent node.

Returns:
if this is the last or not

setLast

public void setLast(boolean last)
Exclude:

isLeaf

public boolean isLeaf()
Gets whether or not this a "leaf" node (i.e. one with no children)

Returns:
if this is the last or not

getName

public String getName()
Exclude:

setName

public void setName(String name)
Exclude:

getParent

public TreeNode getParent()
Gets the parent node of this node, or null if this is the root node.

Returns:
the TreeNode parent

setParent

public void setParent(TreeNode parent)
Sets the parent node of this node.

Parameters:
parent - - the TreeNode parent

isSelected

public boolean isSelected()
Gets whether this node currently selected.

Returns:
the selected state

setSelected

public void setSelected(boolean selected)
Sets whether this node currently selected.

Parameters:
selected - - the selected state

getTarget

public String getTarget()
Gets the window target for the hyperlink identified by the action property, if this node is selected.

Returns:
the window target

getWidth

public int getWidth()
Gets the display width necessary to display this item (if it is visible). If this item is not visible, the calculated width will be that of our most immediately visible parent.

Returns:
the display width

addChild

public void addChild(TreeNode child)
              throws IllegalArgumentException
Add a new child node to the end of the list.

Parameters:
child - The new child node
Throws:
IllegalArgumentException - if the name of the new child node is not unique

addChild

public void addChild(int offset,
                     TreeNode child)
              throws IllegalArgumentException
Add a new child node at the specified position in the child list.

Parameters:
offset - Zero-relative offset at which the new node should be inserted
child - The new child node
Throws:
IllegalArgumentException - if the name of the new child node is not unique

getChildren

public TreeNode[] getChildren()
Return the set of child nodes for this node.

Returns:
the child node array

getChild

public TreeNode getChild(int index)
Return the child node at the given zero-relative index.

Parameters:
child - The child node index
Returns:
the child node

removeChild

public void removeChild(int offset)
Remove the child node (and all children of that child) at the specified position in the child list.

Parameters:
offset - Zero-relative offset at which the existing node should be removed

removeChild

public void removeChild(TreeNode child)
Remove the specified child node. All of the children of this child node will also be removed.

Parameters:
child - Child node to be removed

updateName

public void updateName(TreeNode parentNode,
                       int index)
Exclude:

collapse

public void collapse()
Code that runs when the node is collapsed.


expand

public void expand()
Code that runs when the node is expanded.


getRoot

public TreeNode getRoot(TreeNode node)
Gets the root node of this tree.

Parameters:
node - The TreeNode to start from
Returns:
The root node

findNode

public TreeNode findNode(String nodeName)
Exclude:

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.