com.sri.common.taglib
Class DefaultTreeNode

java.lang.Object
  extended by com.sri.common.taglib.DefaultTreeNode
All Implemented Interfaces:
TreeNode, Serializable

public class DefaultTreeNode
extends Object
implements TreeNode, Serializable

Default implementation of the tree node.

Author:
Michael Rimov
See Also:
Serialized Form

Field Summary
static int MAXIMUM_LABEL_LENGTH
          Sets the maximum label length and truncates if the label is to long
 
Fields inherited from interface com.sri.common.taglib.TreeNode
NO_CHILDREN
 
Constructor Summary
DefaultTreeNode()
          Default constructor.
DefaultTreeNode(DefaultTreeNode parentNode)
          Constructor that takes a parent node.
 
Method Summary
 void addNested(TreeNode node)
          Adds a nested tree node to this node.
 void collapseAllFolders()
          Collapses all folders by marking the root node as unselected.
 void expandAllFolders()
          Expands all folder nodes by marking them selected without marking any leaf nodes necessarily selected.
 String getIconUrl()
          Retrieve url of the icon associated with the node.
 String getLabel()
          Retrieve the Label of the tree node.
 String getLink()
          Retrieve the link if the node is clicked.
 TreeNode[] getNested()
          Retrieve all children (may be an empty array) if no children.
 TreeNode getParent()
          Retrieve the parent to allow bi-direction navigation through the tree.
 String getSelectedStyle()
          Retrieve the CSS style for the node when it is selected.
 String getUnselectedStyle()
          Retrieve the CSS style for the node when it is unselected.
 boolean isParent()
          Retrieves whether or not this is a parent node.
 boolean isSelected()
          Returns true if this node is selected.
 void setIconUrl(String newValue)
          Sets the icon url.
 void setLabel(String nodeLabel)
          Sets the label for the node.
 void setLink(String nodeLink)
          Sets the link for the node.
 void setSelected(boolean selectionValue)
          Sets whether the node is selected or not.
 void setSelectedStyle(String nodeSelectedStyle)
          Sets the node selected style.
 void setUnselectedStyle(String nodeUnselectedStyle)
          Sets the nodes unselected style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXIMUM_LABEL_LENGTH

public static final int MAXIMUM_LABEL_LENGTH
Sets the maximum label length and truncates if the label is to long

See Also:
Constant Field Values
Constructor Detail

DefaultTreeNode

public DefaultTreeNode()
Default constructor.


DefaultTreeNode

public DefaultTreeNode(DefaultTreeNode parentNode)
Constructor that takes a parent node. Sets this node's parent as well as adds the node to the parent.

Parameters:
parentNode - TreeNode
Method Detail

getLabel

public String getLabel()
Retrieve the Label of the tree node.

Specified by:
getLabel in interface TreeNode
Returns:
String the label

getLink

public String getLink()
Retrieve the link if the node is clicked.

Specified by:
getLink in interface TreeNode
Returns:
String url for the link of the node.

getSelectedStyle

public String getSelectedStyle()
Retrieve the CSS style for the node when it is selected. (Or for folders, when its children are selected or it is open)

Specified by:
getSelectedStyle in interface TreeNode
Returns:
String

getUnselectedStyle

public String getUnselectedStyle()
Retrieve the CSS style for the node when it is unselected. (Or for folders, when it is closed)

Specified by:
getUnselectedStyle in interface TreeNode
Returns:
String

getParent

public TreeNode getParent()
Retrieve the parent to allow bi-direction navigation through the tree.

Returns:
TreeNode

getNested

public TreeNode[] getNested()
Retrieve all children (may be an empty array) if no children.

Specified by:
getNested in interface TreeNode
Returns:
TreeNode[]

isParent

public boolean isParent()
Retrieves whether or not this is a parent node. In other words, are there children.

Returns:
boolean true if there are child nodes.

getIconUrl

public String getIconUrl()
Retrieve url of the icon associated with the node. This is optional, and if it is set, the image tag will be set inside the <a> tag.

Specified by:
getIconUrl in interface TreeNode
Returns:
String

setIconUrl

public void setIconUrl(String newValue)
Sets the icon url.

Parameters:
newValue - String

addNested

public void addNested(TreeNode node)
Adds a nested tree node to this node.

Parameters:
node - TreeNode

setLabel

public void setLabel(String nodeLabel)
Sets the label for the node.

Parameters:
nodeLabel - String the label of the node.

setLink

public void setLink(String nodeLink)
Sets the link for the node. May be optional if there are subnodes.

Parameters:
nodeLink - String

isSelected

public boolean isSelected()
Returns true if this node is selected. If it is a folder node, then it should normally appear open as well.

Specified by:
isSelected in interface TreeNode
Returns:
boolean

setSelected

public void setSelected(boolean selectionValue)
Sets whether the node is selected or not.

Specified by:
setSelected in interface TreeNode
Parameters:
selectionValue - boolean

setSelectedStyle

public void setSelectedStyle(String nodeSelectedStyle)
Sets the node selected style.

Parameters:
nodeSelectedStyle - String

setUnselectedStyle

public void setUnselectedStyle(String nodeUnselectedStyle)
Sets the nodes unselected style.

Parameters:
nodeUnselectedStyle - String

expandAllFolders

public void expandAllFolders()
Expands all folder nodes by marking them selected without marking any leaf nodes necessarily selected.

Specified by:
expandAllFolders in interface TreeNode

collapseAllFolders

public void collapseAllFolders()
Collapses all folders by marking the root node as unselected.

Specified by:
collapseAllFolders in interface TreeNode


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.