org.ow2.jonas.webapp.taglib
Class TreeControlNode

java.lang.Object
  extended by org.ow2.jonas.webapp.taglib.TreeControlNode
All Implemented Interfaces:
Serializable

public class TreeControlNode
extends Object
implements Serializable

An individual node of a tree control represented by an instance of TreeControl, and rendered by an instance of TreeControlTag.

Version:
$Revision: 11749 $
Author:
Jazmin Jonson, Craig R. McClanahan
See Also:
Serialized Form

Field Summary
protected  String action
          The hyperlink to which control will be directed 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.
protected  boolean expanded
          Is this node currently expanded?
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  TreeControlNode parent
          The parent node of this node, or null if this is the root node.
protected  boolean selected
          Is this node currently selected?
protected  String target
          The window target for the hyperlink identified by the action property, if this node is selected by the user.
protected  TreeControl tree
          The TreeControl instance representing the entire tree.
protected  int width
          The display width necessary to display this item (if it is visible).
 
Constructor Summary
TreeControlNode(String name, String icon, String label, String action, String target, boolean expanded)
          Construct a new TreeControlNode with the specified parameters.
TreeControlNode(TreeControlNode p_Node)
           
 
Method Summary
 void addChild(int offset, TreeControlNode child)
          Add a new child node at the specified position in the child list.
 void addChild(TreeControlNode child)
          Add a new child node to the end of the list.
 TreeControlNode[] findChildren()
          Return the set of child nodes for this node.
 String getAction()
           
 String getIcon()
           
 String getLabel()
           
 String getName()
           
 TreeControlNode getParent()
           
 String getTarget()
           
 TreeControl getTree()
           
 int getWidth()
           
 boolean isExpanded()
           
 boolean isLast()
           
 boolean isLeaf()
          Is this a "leaf" node (i.e.
 boolean isSelected()
           
 void remove()
          Remove this node from the tree.
 void removeChild(int offset)
          Remove the child node (and all children of that child) at the specified position in the child list.
 void setExpanded(boolean expanded)
           
 void setSelected(boolean selected)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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 hyperlink to which control will be directed if this node is selected by the user.


expanded

protected boolean expanded
Is this node currently expanded?


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 TreeControlNode 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.


tree

protected TreeControl tree
The TreeControl instance representing the entire tree.


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

TreeControlNode

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

Parameters:
name - Internal name of this node (must be unique within the entire tree)
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 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?

TreeControlNode

public TreeControlNode(TreeControlNode p_Node)
Method Detail

getAction

public String getAction()

isExpanded

public boolean isExpanded()

setExpanded

public void setExpanded(boolean expanded)

getIcon

public String getIcon()

getLabel

public String getLabel()

isLast

public boolean isLast()

isLeaf

public boolean isLeaf()
Is this a "leaf" node (i.e. one with no children)?


getName

public String getName()

getParent

public TreeControlNode getParent()

isSelected

public boolean isSelected()

setSelected

public void setSelected(boolean selected)

getTarget

public String getTarget()

getTree

public TreeControl getTree()

getWidth

public int getWidth()

addChild

public void addChild(TreeControlNode 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,
                     TreeControlNode 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

findChildren

public TreeControlNode[] findChildren()
Return the set of child nodes for this node.


remove

public void remove()
Remove this node from the tree.


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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 OW2 Consortium. All Rights Reserved.