com.sas.sasserver.tree
Class ProgressiveLevelTreeNode

com.sas.sasserver.tree.ProgressiveLevelTreeNode
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 ProgressiveLevelTreeNode
implements com.sas.models.StaticLevelNodeInterface

ProgressiveLevelTreeNode creates ProgressiveLevelTreeNodes using the hlist which is created using server side TREE SCL.

See Also:
TreeNode, Serialized Form

Field Summary
protected  int childCount
           
protected  com.sas.collection.hlist.HListInterface childList
           
protected  int childListIndex
           
protected  com.sas.collection.hlist.HListInterface hlist
           
protected  LevelTreeInterface m_remoteObject
           
protected  com.sas.models.SimpleNodeInterface[] nodeChildren
           
protected  int nodeIndex
           
protected  java.lang.String nodeKey
           
protected  int nodeLevel
           
protected  ProgressiveLevelTreeNode parent
           
protected  int uncleIndex
           
protected  boolean visible
           
 
Constructor Summary
ProgressiveLevelTreeNode(LevelTreeInterface m_remoteObject, ProgressiveLevelTreeNode parent, com.sas.collection.hlist.HListInterface hlist, int childListIndex, int nodeLevel)
          Constructor.
ProgressiveLevelTreeNode(ProgressiveLevelTreeNode parent, com.sas.collection.hlist.HListInterface hlist, int childListIndex, int nodeLevel)
          Constructor.
 
Method Summary
protected  int findUncleIndex()
          findUncleIndex returns the uncleIndex for a node.
 int getChildListIndex()
          getChildListIndex returns the child list of a node.
 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.
 ProgressiveLevelTreeNode getParent()
          getParent returns the parent of the current node.
 int getUncleIndex()
          getUncleIndex returns the uncleIndex of the node.
protected  void initChildList()
          initChildList initializes the list of children (childList) for a 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 setChildListIndex(int childListIndex)
          setChildListIndex sets the child list of a node.
 void setIndex(int nodeIndex)
          setIndex sets the index for the node.
 void setKey(java.lang.String nodeKey)
          setKey sets the key for the node.
 void setLevel(int nodeLevel)
          setLevel sets the level for the node.
 void setNodeCellStyleKey(java.lang.String key)
          setNodeCellStyleKey is over ridden from TreeNode to call setKey.
 void setParent(ProgressiveLevelTreeNode parent)
          setParent sets the parent of the node.
 void setUncleIndex(int uncleIndex)
          setUncleIndex sets the uncleIndex of the node.
 

Field Detail

childCount

protected int childCount

childListIndex

protected int childListIndex

uncleIndex

protected int uncleIndex

nodeIndex

protected int nodeIndex

nodeLevel

protected int nodeLevel

nodeKey

protected java.lang.String nodeKey

childList

protected com.sas.collection.hlist.HListInterface childList

hlist

protected com.sas.collection.hlist.HListInterface hlist

m_remoteObject

protected LevelTreeInterface m_remoteObject

parent

protected ProgressiveLevelTreeNode parent

visible

protected boolean visible

nodeChildren

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

ProgressiveLevelTreeNode

public ProgressiveLevelTreeNode(LevelTreeInterface m_remoteObject,
                                ProgressiveLevelTreeNode parent,
                                com.sas.collection.hlist.HListInterface hlist,
                                int childListIndex,
                                int nodeLevel)
Constructor.

Parameters:
m_remoteObject - LevelTreeInterface
parent - the parent TreeNode
hlist - HListInterface
index - index of the node
level - level of the node

ProgressiveLevelTreeNode

public ProgressiveLevelTreeNode(ProgressiveLevelTreeNode parent,
                                com.sas.collection.hlist.HListInterface hlist,
                                int childListIndex,
                                int nodeLevel)
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.


findUncleIndex

protected int findUncleIndex()
findUncleIndex returns the uncleIndex for a node. The uncle index is the node's parent's next sibling.


initChildList

protected void initChildList()
initChildList initializes the list of children (childList) for a node. The childList contains sublists. These sublists contain information needed to create nodes.


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 nodeIndex)
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 nodeLevel)
setLevel sets the level for the node. The level is the number which determines the node's relationship to the root node.

Parameters:
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

setParent

public void setParent(ProgressiveLevelTreeNode parent)
setParent sets the parent of the node.

Parameters:
parent - the parent of the current node.

getParent

public ProgressiveLevelTreeNode getParent()
getParent returns the parent of the current node.


setUncleIndex

public void setUncleIndex(int uncleIndex)
setUncleIndex sets the uncleIndex of the node. The uncleIndex is the node's parent's next sibling's index.

Parameters:
uncleIndex - index of the node's parent's next sibling

getUncleIndex

public int getUncleIndex()
getUncleIndex returns the uncleIndex of the node. The uncleIndex is the node's parent's next sibling's index.


setChildListIndex

public void setChildListIndex(int childListIndex)
setChildListIndex sets the child list of a node. The childList is a list of hlists. the hlists contain the information to create the child nodes of a node.

Parameters:
childListIndex -

getChildListIndex

public int getChildListIndex()
getChildListIndex returns the child list of a node. The childList is a list of hlists. the hlists contain the information to create teh child nodes of a node.


setKey

public void setKey(java.lang.String nodeKey)
setKey sets the key for the node. The key is a string value that can be used at a later time to set attributes on a node. For example, a viewer can use the key value and associate it with a style class.

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 in turn can be 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.