com.sas.models
Class TreeNode

com.sas.models.TreeNode
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, ModelInterface, MutableNodeInterface, MutableSimpleNodeInterface, NodeInterface, SimpleNodeInterface, StaticNodeCellStyleInterface, StaticNodeCellStyleKeyInterface, StaticNodeStyleInterface, TreeInterface, TreeNodeInterface, TreeNodeV2Interface, java.io.Serializable
Direct Known Subclasses:
LevelTreeNode, ProgressiveLevelTreeNode, TreeNodeAdaptor

public class TreeNode
implements TreeNodeV2Interface, StaticNodeCellStyleInterface, StaticNodeCellStyleKeyInterface

The TreeNode model creates nodes that can be used to create a hierarchical structure. The rootNode can be used in the Tree model, which in turn can be used to display things such as organizational charts or other hierarchical structures.

See Also:
Node, TreeNodeInterface, Serialized Form

Field Summary
protected  java.lang.String accessKey
           
protected  boolean border
           
protected  int borderSize
           
protected  OrderedCollection children
           
protected  java.lang.String defaultImage
           
protected  java.lang.String defaultImageAltText
           
protected  java.lang.String description
           
protected  java.lang.String expandedImage
           
protected  java.lang.String expandedImageAltText
           
protected  boolean expandedState
           
protected  boolean lastNode
           
protected  java.lang.String name
           
protected  boolean selectable
           
protected  java.lang.String styleClass
           
protected  java.lang.String styleKey
           
protected  int tabIndex
           
protected  java.lang.String text
           
protected  java.lang.String title
           
protected  java.lang.String url
           
 
Fields inherited from class com.sas.models.Node
defaultNodeStyle, expandedNodeText, externalUpdateSupported, hasChildren, nodeStyle, nodeText, nodeType, objectData, RB_KEY
 
Constructor Summary
TreeNode()
           
TreeNode(java.lang.String name, java.lang.String text)
          Constructor of TreeNode
TreeNode(java.lang.String name, java.lang.String text, java.lang.String url)
          Constructor of TreeNode
TreeNode(java.lang.String name, java.lang.String text, java.lang.String url, java.lang.String defaultImage, java.lang.String expandedImage)
          Constructor of TreeNode
 
Method Summary
 java.lang.String getAcessKey()
          getAccessKey returns the accesskey for URL accessability.
 java.lang.String getDefaultImage()
          Returns the name of the default image.
 java.lang.String getDefaultImageAltText()
          getDefaultImageAltText reutrns the text which is to be used as alternate to an image.
 java.lang.String getDescription()
          Returns the description of this node.
 java.lang.String getExpandedImage()
          Returns the name of the expanded image.
 java.lang.String getExpandedImageAltText()
          getExpandedImageAltText returns the alternate text to the expanded image.
 java.lang.String getName()
          Returns the name of the TreeNode object
 java.lang.String getNodeCellStyleClass()
          getNodeStyleClass
 java.lang.String getNodeCellStyleKey()
          getNodeStyleKey returns the key to be associated with style values in some viewers.
 java.lang.String getNodeExpandedText()
          getNodeExpandedText returns the URL used for the node.
 java.lang.String getNodeText()
          Returns the node Text associated with the node.
 java.lang.String getRootNodeName()
          Returns then name of the Root Node
 int getTabIndex()
          getTabIndex returns the tab order value of the node.
 java.lang.String getText()
          Returns the text displayed for the node
 java.lang.String getTitle()
          getTitle returns the title to the URL link.
 java.lang.String getURL()
          Returns the url associated with the node
 boolean isExpanded()
          Returns the expandedState boolean value which is determines if a node is initially set expanded when rendered.
 boolean isLastNode()
          Returns the boolean value lastNode which determines if a node is the last node in a set of children.
 void setAccessKey(java.lang.String accessKey)
          setAccessKey sets the accesskey if a URL link is being used.
 void setDefaultImage(java.lang.String image)
          Sets the name of the default image.
 void setDefaultImageAltText(java.lang.String defaultImageAltText)
          setDefaultImageAltText sets the text used to describe an image in the viewer.
 void setDescription(java.lang.String desc)
          Sets the description associated with this node.
 void setExpanded(boolean state)
          sets the expandedState of the node
 void setExpandedImage(java.lang.String image)
          Sets the name of the expanded image.
 void setExpandedImageAltText(java.lang.String expandedImageAltText)
          setExpandedImageAltText sets the alternate text to the expanded image in the viewer.
 void setLastNode(boolean lastNode)
          Sets the boolean value lastNode to determine if a node is the last node of a set of children.
 void setName(java.lang.String name)
          Sets the name of the tree node.
 void setNodeCellStyleClass(java.lang.String styleClass)
          setNodeStyle sets the style Class on the node.
 void setNodeCellStyleKey(java.lang.String styleKey)
          setNodeStyleKey sets the key for the node which can be used to associate the node with styles in some viewers.
 void setTabIndex(int tabIndex)
          setTabIndex sets the tabbing order for access in viewer.
 void setText(java.lang.String text)
          Sets the text displayed for the node.
 void setTitle(java.lang.String title)
          setTitle sets the title to the URL link in the viewer.
 void setURL(java.lang.String url)
          Sets the url associated with the node
 
Methods inherited from class com.sas.models.Node
addItems, addNodeChild, addNodeChild, addPropertyChangeListener, attachView, countNodeChildren, detachView, firePropertyChange, firePropertyChange, getDefaultNodeStyle, getIndex, getNodeChild, getNodeChildCount, getNodeChildren, getNodeChildren, getNodeStyle, getNodeType, getNodeTypes, getObjectData, getRoot, isExternalUpdateSupported, isLeafNode, moveNodeChild, notifyPropertyChange, removeAllNodeChildren, removeNodeChild, removeNodeChild, removePropertyChangeListener, setDefaultNodeStyle, setExternalUpdateSupported, setNodeChildren, setNodeExpandedText, setNodeStyle, setNodeText, setNodeType, setObjectData, sort, toString
 
Methods inherited from interface com.sas.models.NodeInterface
getNodeType
 
Methods inherited from interface com.sas.models.SimpleNodeInterface
countNodeChildren, getNodeChild, getNodeChildCount, getNodeChildren, isLeafNode
 

Field Detail

name

protected java.lang.String name

text

protected java.lang.String text

url

protected java.lang.String url

title

protected java.lang.String title

accessKey

protected java.lang.String accessKey

defaultImage

protected java.lang.String defaultImage

expandedImage

protected java.lang.String expandedImage

expandedImageAltText

protected java.lang.String expandedImageAltText

defaultImageAltText

protected java.lang.String defaultImageAltText

children

protected OrderedCollection children

expandedState

protected boolean expandedState

lastNode

protected boolean lastNode

border

protected boolean border

selectable

protected boolean selectable

borderSize

protected int borderSize

tabIndex

protected int tabIndex

styleKey

protected java.lang.String styleKey

styleClass

protected java.lang.String styleClass

description

protected java.lang.String description
Constructor Detail

TreeNode

public TreeNode()

TreeNode

public TreeNode(java.lang.String name,
                java.lang.String text,
                java.lang.String url,
                java.lang.String defaultImage,
                java.lang.String expandedImage)
Constructor of TreeNode

Parameters:
name - the name of the TreeNode object that is created
text - the text to display in tree
url - the url to associate with the node
defaultImage - the image to display when folder is closed
expandedImage - the image to display when folder is open

TreeNode

public TreeNode(java.lang.String name,
                java.lang.String text,
                java.lang.String url)
Constructor of TreeNode

Parameters:
name - the name of the TreeNode object that is created
text - the text to display in tree
url - the url to associate with the node

TreeNode

public TreeNode(java.lang.String name,
                java.lang.String text)
Constructor of TreeNode

Parameters:
name - the name of the TreeNode object that is created
text - the text to displayed in tree
Method Detail

getName

public java.lang.String getName()
Returns the name of the TreeNode object

Specified by:
getName in interface TreeNodeInterface

setName

public void setName(java.lang.String name)
Sets the name of the tree node. It is a good idea to match the name of the TreeNode object to the node name. The TreeNode name is used by some of the viewers as a unique name, therefore it is suggested that the name be unique.

Specified by:
setName in interface TreeNodeInterface
Parameters:
name - the name of the TreeNode

setExpanded

public void setExpanded(boolean state)
sets the expandedState of the node

Specified by:
setExpanded in interface TreeNodeInterface
Parameters:
state - the expanded state of the node

isExpanded

public boolean isExpanded()
Returns the expandedState boolean value which is determines if a node is initially set expanded when rendered.

Specified by:
isExpanded in interface TreeNodeInterface

getText

public java.lang.String getText()
Returns the text displayed for the node

Specified by:
getText in interface TreeNodeInterface
Returns:
text the text displayed on the node

getNodeText

public java.lang.String getNodeText()
Returns the node Text associated with the node.

Specified by:
getNodeText in interface NodeInterface
Overrides:
getNodeText in class Node
Returns:
the text for the current node.
See Also:
Node.setNodeText(java.lang.String)

setText

public void setText(java.lang.String text)
Sets the text displayed for the node. Note that if quotes are used in this text, it may cause problems with some viewers. To avoid this problem, the HTML quote may be written as "

Specified by:
setText in interface TreeNodeInterface
Parameters:
text - the text displayed on the node

getURL

public java.lang.String getURL()
Returns the url associated with the node

Specified by:
getURL in interface TreeNodeInterface
Returns:
url the url link associated with the node

getNodeExpandedText

public java.lang.String getNodeExpandedText()
getNodeExpandedText returns the URL used for the node.

Specified by:
getNodeExpandedText in interface NodeInterface
Overrides:
getNodeExpandedText in class Node
Returns:
the value of the nodeExpandedText property
See Also:
Node.setNodeExpandedText(java.lang.String)

setURL

public void setURL(java.lang.String url)
Sets the url associated with the node

Specified by:
setURL in interface TreeNodeInterface
Parameters:
url - the url link associated with the node

getDefaultImage

public java.lang.String getDefaultImage()
Returns the name of the default image. This should not be the fully qualified name such as http://myWebServer/gifs/imageName.gif. Specify only the name of the file, in this example imageName.gif. If no image is specified "folderClosed.gif" will be returned. The TreeConrol object will supply the location of the images.

Specified by:
getDefaultImage in interface TreeNodeInterface
Returns:
the name of the default image.

setDefaultImage

public void setDefaultImage(java.lang.String image)
Sets the name of the default image. This should not be the fully qualified name such as http://myWebServer/gifs/imageName.gif. Specify only the name of the file, in this example imageName.gif. The TreeConrol object will supply the location of the images.

Specified by:
setDefaultImage in interface TreeNodeInterface
Parameters:
image - - the name of the default image.

getExpandedImage

public java.lang.String getExpandedImage()
Returns the name of the expanded image. This should not be the fully qualified name such as http://myWebServer/gifs/imageName.gif. Specify only the name of the file, in this example imageName.gif. if no image is specified the defaultImage will be returned. If the defaultImage and the expandedImage are null "folderOpen.gif" is returned. The TreeConrol object will supply the location of the images.

Specified by:
getExpandedImage in interface TreeNodeInterface
Returns:
the name of the expanded image.

setExpandedImage

public void setExpandedImage(java.lang.String image)
Sets the name of the expanded image. This should not be the fully qualified name such as http://myWebServer/gifs/imageName.gif. Specify only the name of the file, in this example imageName.gif. The TreeConrol object will supply the location of the images.

Specified by:
setExpandedImage in interface TreeNodeInterface
Parameters:
image - - the name of the expanded image.

getRootNodeName

public java.lang.String getRootNodeName()
Returns then name of the Root Node

Returns:
root node name

setLastNode

public void setLastNode(boolean lastNode)
Sets the boolean value lastNode to determine if a node is the last node of a set of children. Defauts to false.

Specified by:
setLastNode in interface TreeNodeInterface
Parameters:
lastNode - boolean value lastNode, true if node is the lastNode, false otherwise.

isLastNode

public boolean isLastNode()
Returns the boolean value lastNode which determines if a node is the last node in a set of children.

Specified by:
isLastNode in interface TreeNodeInterface

setNodeCellStyleClass

public void setNodeCellStyleClass(java.lang.String styleClass)
setNodeStyle sets the style Class on the node.


getNodeCellStyleClass

public java.lang.String getNodeCellStyleClass()
getNodeStyleClass

Specified by:
getNodeCellStyleClass in interface StaticNodeCellStyleInterface

setNodeCellStyleKey

public void setNodeCellStyleKey(java.lang.String styleKey)
setNodeStyleKey sets the key for the node which can be used to associate the node with styles in some viewers.


getNodeCellStyleKey

public java.lang.String getNodeCellStyleKey()
getNodeStyleKey returns the key to be associated with style values in some viewers.

Specified by:
getNodeCellStyleKey in interface StaticNodeCellStyleKeyInterface

setAccessKey

public void setAccessKey(java.lang.String accessKey)
setAccessKey sets the accesskey if a URL link is being used. This allows the user to access the link via the keyboard. For example, if the accesskey is set to "C", a user can use the Alt-C combination to go to the link text and press enter to activate the link.

Specified by:
setAccessKey in interface TreeNodeV2Interface
Parameters:
accessKey - key entry used as access key for link.

getAcessKey

public java.lang.String getAcessKey()
getAccessKey returns the accesskey for URL accessability. This allows a user to access a link using the Alt-'key' comination to access a link.

Specified by:
getAcessKey in interface TreeNodeV2Interface

setTabIndex

public void setTabIndex(int tabIndex)
setTabIndex sets the tabbing order for access in viewer. This is mainly used with the HTML TreeView.

Specified by:
setTabIndex in interface TreeNodeV2Interface
Parameters:
tabIndex - the numeric order in which the tab key is used.

getTabIndex

public int getTabIndex()
getTabIndex returns the tab order value of the node. The tab order is the order in which the tab key will follow when tabbing in the viewer.

Specified by:
getTabIndex in interface TreeNodeV2Interface

setDefaultImageAltText

public void setDefaultImageAltText(java.lang.String defaultImageAltText)
setDefaultImageAltText sets the text used to describe an image in the viewer.

Specified by:
setDefaultImageAltText in interface TreeNodeV2Interface
Parameters:
defaulImageAltText - alternate text for the image displayed in the viewer.

getDefaultImageAltText

public java.lang.String getDefaultImageAltText()
getDefaultImageAltText reutrns the text which is to be used as alternate to an image.

Specified by:
getDefaultImageAltText in interface TreeNodeV2Interface

setExpandedImageAltText

public void setExpandedImageAltText(java.lang.String expandedImageAltText)
setExpandedImageAltText sets the alternate text to the expanded image in the viewer.

Specified by:
setExpandedImageAltText in interface TreeNodeV2Interface
Parameters:
expandedImageAltText -

getExpandedImageAltText

public java.lang.String getExpandedImageAltText()
getExpandedImageAltText returns the alternate text to the expanded image.

Specified by:
getExpandedImageAltText in interface TreeNodeV2Interface

setTitle

public void setTitle(java.lang.String title)
setTitle sets the title to the URL link in the viewer. This title should be a short but descriptive title to where the URL link will take them.

Specified by:
setTitle in interface TreeNodeV2Interface
Parameters:
title - descriptive title of the URL link.

getTitle

public java.lang.String getTitle()
getTitle returns the title to the URL link. This title is a short but descriptive title to where the URL link will take them.

Specified by:
getTitle in interface TreeNodeV2Interface
Returns:
title descriptive title to the URL link

setDescription

public void setDescription(java.lang.String desc)
Sets the description associated with this node.

Specified by:
setDescription in interface TreeNodeV2Interface
Parameters:
desc - The description of the node

getDescription

public java.lang.String getDescription()
Returns the description of this node.

Specified by:
getDescription in interface TreeNodeV2Interface
Returns:
the description of the node



Copyright © 2009 SAS Institute Inc. All Rights Reserved.