com.sas.sasserver.tree
Class LevelTreeNode

com.sas.sasserver.tree.LevelTreeNode
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, com.sas.ModelInterface, com.sas.models.MutableNodeInterface, com.sas.models.MutableSimpleNodeInterface, com.sas.models.NodeInterface, com.sas.models.SimpleNodeInterface, com.sas.models.StaticLevelNodeInterface, com.sas.models.StaticNodeCellStyleInterface, com.sas.models.StaticNodeCellStyleKeyInterface, com.sas.models.StaticNodeStyleInterface, com.sas.models.TreeInterface, com.sas.models.TreeNodeInterface, com.sas.models.TreeNodeV2Interface, java.io.Serializable

public class LevelTreeNode
implements com.sas.models.StaticLevelNodeInterface

LevelTreeNode creates TreeNodes using the hlist which is created using server side TREE SCL.

See Also:
TreeNode, Serialized Form

Field Summary
protected  com.sas.collection.hlist.HListInterface hlist
           
protected  int index
           
protected  int level
           
protected  int nIndex
           
protected  java.lang.String nKey
           
protected  int nLevel
           
protected  com.sas.models.SimpleNodeInterface[] nodeChildren
           
protected  com.sas.models.TreeNode parent
           
protected  boolean visible
           
 
Constructor Summary
LevelTreeNode(com.sas.models.TreeNode parent, com.sas.collection.hlist.HListInterface hlist, int index, int level)
          Constructor.
 
Method Summary
 int getIndex()
          getIndex returns the index for the node.
 java.lang.String getKey()
          getKey returns the key for the node.
 int getLevel()
          getLevel returns the level of the node.
 java.lang.String getNodeCellStyleKey()
          getNodeCellStyleKey is over ridden from TreeNode to call getKey.
 com.sas.models.SimpleNodeInterface getNodeChild(int childIndex)
          getNodeChild returns the requested node child.
 int getNodeChildCount()
          getNodeChildCount returns the number of children a node has.
 com.sas.models.SimpleNodeInterface[] getNodeChildren(int childIndex, int count)
          getNodeChildren returns an array of nodes which are the chilren of the parent node.
 void initChildNodes()
          initChildNodes initalizes the nodeChildren array, which holds the node children.
protected  void initTreeNode()
          initTreeNode creates the TreeNode as they are requested.
 boolean isLeafNode()
          isLeafNode determine if a node is a LeafNode, or has no children.
 void setIndex(int nIndex)
          setIndex sets the index for the node.
 void setKey(java.lang.String nKey)
          setKey sets the key for the node.
 void setLevel(int nLevel)
          setLevel sets the level for the node.
 void setNodeCellStyleKey(java.lang.String key)
          setNodeCellStyleKey is over ridden from TreeNode to call setKey.
 

Field Detail

level

protected int level

index

protected int index

nLevel

protected int nLevel

nIndex

protected int nIndex

nKey

protected java.lang.String nKey

hlist

protected com.sas.collection.hlist.HListInterface hlist

parent

protected com.sas.models.TreeNode parent

visible

protected boolean visible

nodeChildren

protected com.sas.models.SimpleNodeInterface[] nodeChildren
Constructor Detail

LevelTreeNode

public LevelTreeNode(com.sas.models.TreeNode parent,
                     com.sas.collection.hlist.HListInterface hlist,
                     int index,
                     int level)
Constructor.

Parameters:
parent - the parent TreeNode
hlist - HListInterface
index - index of the node
level - level of the node
Method Detail

initTreeNode

protected void initTreeNode()
initTreeNode creates the TreeNode as they are requested. The HList which is returned from the server (using sashelp.TREE.SCL) is used to create each node using com.sas.models.TreeNode.


getNodeChild

public com.sas.models.SimpleNodeInterface getNodeChild(int childIndex)
getNodeChild returns the requested node child. getNodeChild calls getNodeChildren passing the childIndex forward and requesting one child. The child requested is then found in the nodeChildren array created in initChildNodes().

Specified by:
getNodeChild in interface com.sas.models.SimpleNodeInterface
Overrides:
getNodeChild in class com.sas.models.Node
Parameters:
childIndex - the 0-based index of the child to get
Returns:
the child node object (as type SimpleNodeInterface) at the specified index.
See Also:
Node.getNodeChildren(int, int), Node.setNodeChildren(com.sas.collection.StaticOrderedCollectionInterface)

initChildNodes

public void initChildNodes()
initChildNodes initalizes the nodeChildren array, which holds the node children. The node children are created using the hlist which is sent back from SAS (using sashelp.TREE.SCL). Each node created is a com.sas.models.TreeNode. Once the nodes are created they are stored in an array (nodeChildren) which can be accessed later for individual children.


getNodeChildren

public com.sas.models.SimpleNodeInterface[] getNodeChildren(int childIndex,
                                                            int count)
getNodeChildren returns an array of nodes which are the chilren of the parent node. getNodeChildren uses the nodeChildren array created in initChildNodes(). A second array named children is created with only the children of the requesting node.

Specified by:
getNodeChildren in interface com.sas.models.SimpleNodeInterface
Overrides:
getNodeChildren in class com.sas.models.Node
Parameters:
childIndex - int value of the begining child index which to retreive.
count - int value of the number of children to return.
Returns:
an array of child node objects (as type SimpleNodeInterface) for the specified range
See Also:
Node.getNodeChild(int), Node.setNodeChildren(com.sas.collection.StaticOrderedCollectionInterface)

isLeafNode

public boolean isLeafNode()
isLeafNode determine if a node is a LeafNode, or has no children. isLeafNode calls getNodeChildCount, if getNodeChildCount has a value of 0, the node has no child and is considered to be a leaf node.

Specified by:
isLeafNode in interface com.sas.models.SimpleNodeInterface
Overrides:
isLeafNode in class com.sas.models.Node
Returns:
boolean true if node has no children, false otherwise.

getNodeChildCount

public int getNodeChildCount()
getNodeChildCount returns the number of children a node has. getNodeChildCount counts the number of children a single node has using the hlist.

Specified by:
getNodeChildCount in interface com.sas.models.SimpleNodeInterface
Overrides:
getNodeChildCount in class com.sas.models.Node
Returns:
the number of children or 0 if no children

setIndex

public void setIndex(int nIndex)
setIndex sets the index for the node. The indes is the order in which the node appears in the level dataset.

Parameters:
nIndex -

getIndex

public int getIndex()
getIndex returns the index for the node. The index is the order in which the node appears in the level dataset.

Specified by:
getIndex in interface com.sas.models.StaticLevelNodeInterface

setLevel

public void setLevel(int nLevel)
setLevel sets the level for the node. The level is the number which determines the node's relationship to the root node.

Parameters:
in - nLevel

getLevel

public int getLevel()
getLevel returns the level of the node. The level is the number which determines the node's relationship to the rootNode.

Specified by:
getLevel in interface com.sas.models.StaticLevelNodeInterface

setKey

public void setKey(java.lang.String nKey)
setKey sets the key for the node. The key can be used later in the viewer.

Parameters:
key -

setNodeCellStyleKey

public void setNodeCellStyleKey(java.lang.String key)
setNodeCellStyleKey is over ridden from TreeNode to call setKey. This sets the key set for a node which is in turned used in the viewer to determine it cell style class.

Overrides:
setNodeCellStyleKey in class com.sas.models.TreeNode
Parameters:
key -

getKey

public java.lang.String getKey()
getKey returns the key for the node. The key can be used later in the viewer to associate the key with a certain style.


getNodeCellStyleKey

public java.lang.String getNodeCellStyleKey()
getNodeCellStyleKey is over ridden from TreeNode to call getKey. This returns the key set for a node which is in turned used in the viewer to determine it cell style class.

Specified by:
getNodeCellStyleKey in interface com.sas.models.StaticNodeCellStyleKeyInterface
Overrides:
getNodeCellStyleKey in class com.sas.models.TreeNode



Copyright © 2009 SAS Institute Inc. All Rights Reserved.