com.ibm.commerce.tools.common.ui
Class DynamicTreeNode

java.lang.Object
  |
  +--com.ibm.commerce.tools.common.ui.DynamicTreeNode

public class DynamicTreeNode
extends java.lang.Object

Creates a node to be displayed on the dynamic tree on a client browser.

The Dynamic Tree is similar to the Windows Explorer tree. Each node on the tree is created using a DynamicTreeNode, which contains all of the data required by the client browser to render a node on the tree. This object is converted to a JavaScript object once created in your DynamicTreeUserDataBean and returned to the client browser.

The tree can be pre-cached to any number of levels by attaching children to a node.

Each node can either supply its own menu in contextMenu or supply a menuType, in which case a corresponding DynamicTreeMenuType object must be created.

Each node may also have icons associated with it, which will be displayed to the left of the node name on the client browser. This is done be setting the iconType and creating a corresponding DynamicTreeIconType object.

Each node can set a value assigned to it, which is different from the name which is displayed on the client browser. This is typically set to a database ID value or some other unique identifier to be used by your commands or buttons from another frame.


Field Summary
protected  java.util.Vector children
          The children nodes attached to this node.
protected  java.lang.String childrenUrlParam
          If this is a parent node, contains the URL parameters used to populate this node's children.
protected  java.lang.String[][] contextMenu
          This hold the NVPs for the context menu.
protected  java.lang.String contextMenuParams
          Contains URL parameters to be appended to context menu items actions.
protected  java.lang.String[] iconType
          Specifies an icon type.
protected  java.lang.String menuType
          Specifies a menu type.
protected  java.lang.String name
          The NL translated name of the DynamicTreeNode.
protected  java.lang.String value
          Contains the value of the node.
 
Constructor Summary
DynamicTreeNode()
          Default constructor create a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String childrenUrlParam, java.lang.String[][] menu)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String childrenUrlParams, java.lang.String[][] menu, java.lang.String contextMenuParams)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String para, java.lang.String[][] menu, java.lang.String contextMenuParams, java.util.Vector children)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String para, java.lang.String[][] menu, java.util.Vector children)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String value, java.lang.String para, java.lang.String[][] menu)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String value, java.lang.String para, java.lang.String[][] menu, java.lang.String contextMenuParams, java.util.Vector children)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String value, java.lang.String para, java.lang.String[][] menu, java.util.Vector children)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String value, java.lang.String para, java.lang.String contextMenuParams, java.lang.String menuType)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String value, java.lang.String childrenUrlParams, java.lang.String menuType, java.util.Vector children)
          Creates a new DynamicTreeNode.
DynamicTreeNode(java.lang.String name, java.lang.String childrenUrlParams, java.lang.String menuType, java.util.Vector children)
          Creates a new DynamicTreeNode.
 
Method Summary
 java.lang.String[][] copyStringArray(java.lang.String[][] str)
          Copies an array of String arrays into a new array of String arrays.
 java.util.Vector getChildren()
          Returns the children of this DynamicTreeNode.
 java.lang.String getChildrenUrlParam()
          Returns the childrenUrlParam field value.
 java.lang.String[][] getContextMenu()
          Returns the context menu.
 java.lang.String getContextMenuParams()
          Returns the context menu parameters which are passed with all menu item actions.
 java.lang.String[] getIconType()
          Returns the iconType value.
 java.lang.String getMenuType()
          Returns the menuType value.
 java.lang.String getName()
          Returns the name of this DynamicTreeNode.
 java.lang.String getValue()
          Returns the value of this DynamicTreeNode
 void setChildren(java.util.Vector newChildren)
          Sets the children of this DynamicTreeNode.
 void setChildrenUrlParam(java.lang.String newChildrenUrlParam)
          Sets the childrenUrlParam field value.
 void setContextMenu(java.lang.String[][] newContextMenu)
          Sets the context menu.
 void setContextMenuParams(java.lang.String newContextMenuParams)
          Sets the context menu parameters which are passed with all menu item actions.
 void setIconType(java.lang.String[] newIconType)
          Sets the iconType value.
 void setMenuType(java.lang.String newMenuType)
          Sets the menuType value.
 void setName(java.lang.String newName)
          Sets the name of this DynamicTreeNode.
 void setValue(java.lang.String newValue)
          Sets the value of this DynamicTreeNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected java.util.Vector children
The children nodes attached to this node. DynamicTreeNode's can be nested to hold children's info. This is done by adding children DynamicTreeNodes to this vector.

childrenUrlParam

protected java.lang.String childrenUrlParam
If this is a parent node, contains the URL parameters used to populate this node's children.

A null value or emtpy string means this node is a leaf (not expandable)

When the user clicks on the + sign on the tree in the client browser to expand a node, the value of this field is sent to the DynamicTreeUserDataBean to be used to populate the children nodes. This is done in JavaScript by appending the value of this field as follows:
"/webapp/wcs/tools/servlet/DynamicTreeData?XMLFile=xxx&" + childrenUrlParam
for example, if childrenUrlParam = "p1=a&p2=99", the full URL will be something like:
/webapp/wcs/tools/servlet/DynamicTreeData?XMLFile=common.testTree&p1=a&p2=99


contextMenu

protected java.lang.String[][] contextMenu
This hold the NVPs for the context menu.

The first item should always be "Open" or some way to launch the nodes action. The second value contains the fully qualified URL that will be launched when the user selects that menu item. For example:
contextMenu[0][0] = "Open";
contextMenu[0][1] = "http://www.ibm.com";
contextMenu[1][0] = "";
contextMenu[1][1] = "";

NOTE: An row with empty quote yields a divider line in the context menu. The names here must be NL sensitive.

NOTE: If using TYPE and grouped menus, leave this empty.


contextMenuParams

protected java.lang.String contextMenuParams
Contains URL parameters to be appended to context menu items actions.

A full URL will be constructed by javascript, in the following format:
contextMenu[0][1] + "?" + contextMenuParams
for example, if contextMenuParams = "p1=a&p2=99", the full URL will be something like:
http://www.ibm.com?p1=a&p2=99


iconType

protected java.lang.String[] iconType
Specifies an icon type. This information is used to produce alternate icons for nodes. This value must match a DynamicTreeIconType to be used.

menuType

protected java.lang.String menuType
Specifies a menu type. This information is used when you wish to group menus such that a matching DynamicTreeMenuType will use that menu. This value must match a DynamicTreeMenuType to be used.

name

protected java.lang.String name
The NL translated name of the DynamicTreeNode. This value is displayed on the client browser on the tree.

value

protected java.lang.String value
Contains the value of the node. Typically this will be a unique node identifier, such as a database ID value.

This value (as is the rest of this data) is accessible through JavaScript functions.

Constructor Detail

DynamicTreeNode

public DynamicTreeNode()
Default constructor create a new DynamicTreeNode.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String childrenUrlParam,
                       java.lang.String[][] menu)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
childrenUrlParam - The value to be used to fetch the children of this node.
menu - The context menu array.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String childrenUrlParams,
                       java.lang.String[][] menu,
                       java.lang.String contextMenuParams)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
childrenUrlParam - The value to be used to fetch the children of this node.
menu - The context menu array.
contextMenuParams - Parameters to be appended to all context menu actions calls.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String para,
                       java.lang.String[][] menu,
                       java.lang.String contextMenuParams,
                       java.util.Vector children)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
para - The value to be used to fetch the children of this node.
menu - The context menu array.
contextMenuParams - Parameters to be appended to all context menu actions calls.
children - Contains embedded children of this node.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String para,
                       java.lang.String[][] menu,
                       java.util.Vector children)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
para - The value to be used to fetch the children of this node.
menu - The context menu array.
children - Contains embedded children of this node.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String value,
                       java.lang.String para,
                       java.lang.String[][] menu)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
value - The value of this DynamicTreeNode.
para - The value to be used to fetch the children of this node.
menu - The context menu array.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String value,
                       java.lang.String para,
                       java.lang.String[][] menu,
                       java.lang.String contextMenuParams,
                       java.util.Vector children)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
value - The value of this DynamicTreeNode.
para - The value to be used to fetch the children of this node.
menu - The context menu array.
contextMenuParams - Parameters to be appended to all context menu actions calls.
children - Contains embedded children of this node.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String value,
                       java.lang.String para,
                       java.lang.String[][] menu,
                       java.util.Vector children)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
value - The value of this DynamicTreeNode.
para - The value to be used to fetch the children of this node.
menu - The context menu array.
children - Contains embedded children of this node.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String value,
                       java.lang.String para,
                       java.lang.String contextMenuParams,
                       java.lang.String menuType)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
value - The value of this DynamicTreeNode.
para - The value to be used to fetch the children of this node.
contextMenuParams - Parameters to be appended to all context menu actions calls.
menuType - The name of the corresponding DynamicTreeMenuType.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String value,
                       java.lang.String childrenUrlParams,
                       java.lang.String menuType,
                       java.util.Vector children)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
value - The value of this DynamicTreeNode.
childrenUrlParam - The value to be used to fetch the children of this node.
menuType - The name of the corresponding DynamicTreeMenuType.
children - Contains embedded children of this node.

DynamicTreeNode

public DynamicTreeNode(java.lang.String name,
                       java.lang.String childrenUrlParams,
                       java.lang.String menuType,
                       java.util.Vector children)
Creates a new DynamicTreeNode.
Parameters:
name - The name of the DynamicTreeNode that will be displayed to the user.
childrenUrlParam - The value to be used to fetch the children of this node.
menuType - The name of the corresponding DynamicTreeMenuType.
children - Contains embedded children of this node.
Method Detail

copyStringArray

public java.lang.String[][] copyStringArray(java.lang.String[][] str)
Copies an array of String arrays into a new array of String arrays.

Typically used by the constructor to create new Strings for the array of String arrays refernced as a parameter. argument to create a fresh copy of the Strings.

Parameters:
str - The array of String arrays.
Returns:
The newly created array of String arrays.

getChildren

public java.util.Vector getChildren()
Returns the children of this DynamicTreeNode.
Returns:
The Vector of embedded children.

getChildrenUrlParam

public java.lang.String getChildrenUrlParam()
Returns the childrenUrlParam field value.
Returns:
The childrenUrlParam field value.

getContextMenu

public java.lang.String[][] getContextMenu()
Returns the context menu.
Returns:
The context menu array of String arrays.

getContextMenuParams

public java.lang.String getContextMenuParams()
Returns the context menu parameters which are passed with all menu item actions.
Returns:
the contextMenuParams field value.

getIconType

public java.lang.String[] getIconType()
Returns the iconType value.
Returns:
The iconType field.

getMenuType

public java.lang.String getMenuType()
Returns the menuType value.
Returns:
The menuType value.

getName

public java.lang.String getName()
Returns the name of this DynamicTreeNode.
Returns:
The name field value.

getValue

public java.lang.String getValue()
Returns the value of this DynamicTreeNode
Returns:
The value of thie DynamicTreeNode.

setChildren

public void setChildren(java.util.Vector newChildren)
Sets the children of this DynamicTreeNode.
Parameters:
The - Vector of embedded children.

setChildrenUrlParam

public void setChildrenUrlParam(java.lang.String newChildrenUrlParam)
Sets the childrenUrlParam field value.
Parameters:
The - childrenUrlParam value.

setContextMenu

public void setContextMenu(java.lang.String[][] newContextMenu)
Sets the context menu.
Parameters:
The - context menu array of String arrays.

setContextMenuParams

public void setContextMenuParams(java.lang.String newContextMenuParams)
Sets the context menu parameters which are passed with all menu item actions.
Parameters:
The - contextMenuParams value.

setIconType

public void setIconType(java.lang.String[] newIconType)
Sets the iconType value.
Parameters:
The - iconType name.

setMenuType

public void setMenuType(java.lang.String newMenuType)
Sets the menuType value.
Parameters:
The - menuType name.

setName

public void setName(java.lang.String newName)
Sets the name of this DynamicTreeNode.
Parameters:
The - name value.

setValue

public void setValue(java.lang.String newValue)
Sets the value of this DynamicTreeNode
Parameters:
The - value of thie DynamicTreeNode.