com.sas.sasserver.tree
Class NodeDelegate

com.sas.sasserver.tree.NodeDelegate
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.collection.ContentsChangedListener, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.models.NodeIconInterface, com.sas.models.NodeInterface, com.sas.models.SimpleNodeInterface, com.sas.models.TreeInterface, com.sas.rmi.LocalModelInterface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
ServerNodeDelegate

public class NodeDelegate
implements com.sas.models.TreeInterface, com.sas.models.NodeInterface, com.sas.models.NodeIconInterface

NodeDelegate is a generic class for displaying tree structured data. The NodeDelegate class is the client side implementation of a tree node.

This delegate class also is responsible for deferring object creation as long as possible by using the remote node's _getNodeChildren method which returns a list of node descriptors. The remote node need not always create the instances, but can instead pass back more descriptive information (text, expanded text, icons, isLeaf properties) about each node in one call, thus eiminating the need for the client to call back to the server to read that information about each child node. Only when the client needs information not represented in the description list does the client have to make a remote call. The description list can have either a remote object ID, or it may contain the name of an SCL class to instatiate in order to create a ServerNodeInterface.

See Also:
NodeInterface, TreeView, Serialized Form

Field Summary
protected  com.sas.collection.OrderedCollectionInterface children
           
protected  java.lang.String className
           
protected  com.sas.rmi.Connection connection
           
protected  com.sas.visuals.IconInterface expIcon
           
protected  java.lang.String expIconName
           
protected  int expIconNum
           
protected  com.sas.visuals.IconInterface expSelIcon
           
protected  java.lang.String expSelIconName
           
protected  int expSelIconNum
           
protected  java.lang.String expText
           
protected  com.sas.visuals.IconInterface icon
           
protected  java.lang.String iconName
           
protected  int iconNum
           
protected  int id
           
protected  java.lang.Boolean isLeaf
           
protected  java.lang.String nodeType
           
protected  int otherIconsNum
           
protected  int parentID
           
protected  com.sas.visuals.IconInterface selIcon
           
protected  java.lang.String selIconName
           
protected  int selIconNum
           
protected  java.lang.String text
           
 
Fields inherited from class com.sas.sasserver.SASListDelegate
allContentsChangedListeners, hasChildren, libExists, membersList, needs_refresh, parsedList, pendingEventGateCount
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a listener for the java.beans.PropertyChangeEvent event.
 java.lang.Object clone()
          Return a clone of the object.
 int countNodeChildren(int maxCount)
          Counts the children of the current node.
 void firePropertyChange(java.beans.PropertyChangeEvent event)
          Calls notifyPropertyChange to fire the event to all registered listeners.
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Creates a PropertyChangeEvent and calls notifyPropertyChange to fire the event to all registered listeners.
protected  com.sas.collection.OrderedCollectionInterface getChildren()
          Return a collection that contains all the children for the Node
 com.sas.visuals.IconInterface getDefaultIcon()
          Returns the default icon for the current node.
 com.sas.visuals.IconInterface getExpandedIcon()
          Returns the expanded icon for the current node.
 com.sas.visuals.IconInterface getExpandedSelectedIcon()
          Returns the expandedSelected icon for the current node.
 com.sas.models.SimpleNodeInterface getNodeChild(int nodeIndex)
          Returns the child node at the specified index.
 int getNodeChildCount()
          Returns the number of children.
 com.sas.models.SimpleNodeInterface[] getNodeChildren(int startIndex, int count)
          Returns the specified range of children for the current node.
 java.lang.String getNodeExpandedText()
          Returns the value of the nodeExpandedText property.
 java.lang.String getNodeText()
          Returns the value of the nodeText property.
 java.lang.String getNodeType()
          Returns the value of the nodeType property.
 com.sas.models.NodeInterface getRoot()
          Returns a NodeInterface object to serve as the root node.
 com.sas.visuals.IconInterface getSelectedIcon()
          Returns the selected icon for the current node.
protected  void initialize(com.sas.collection.hlist.HListInterface params)
          Initalizes the remoteObject
 boolean isLeafNode()
          Indicates whether the current node is a leaf.
protected  com.sas.visuals.IconInterface loadIcon(java.lang.String iconName)
          loads the icons used in the treeView.
protected  com.sas.visuals.IconInterface loadIcon(java.lang.String iconName, java.lang.String defaultImageName)
          loads the icons used in the treeView.
protected  void notifyPropertyChange(java.beans.PropertyChangeEvent event)
          Sends a PropertyChangeEvent event to all the PropertyChangeListener objects in the listener list.
protected  int parseIntParam(com.sas.collection.hlist.HListInterface params, java.lang.String key)
          Parses an iteger item from the parameter list
protected  void parseParams(com.sas.collection.hlist.HListInterface params)
          Parses the HListInterface to supply values to the objects properties.
protected  java.lang.String parseStringParam(com.sas.collection.hlist.HListInterface params, java.lang.String key)
          Parses a String item from the parameter list
protected  ServerNodeInterface remoteNode()
          Creates the remote object on the server
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a listener for the java.beans.PropertyChangeEvent event.
protected  void reset()
          Sets parameters to nulls
protected  void resubmitQuery()
          Overrides resubmitQuery from SASListDelegate
 void setDefaultIcon(int iNum)
          Sets the default icon number.
 void setExpandedIcon(int iNum)
          Sets the expanded icon number.
 void setExpandedSelectedIcon(int iNum)
          Sets the expanded selected icon number.
 void setNodeExpandedText(java.lang.String text)
           
 void setNodeText(java.lang.String text)
           
 void setNodeType(java.lang.String type)
           
protected  void setRemoteNode(ServerNodeInterface rNode)
          Sets the object id of the remote server node object
 void setSelectedIcon(int iNum)
          Sets the selected icon number.
 
Methods inherited from class com.sas.sasserver.SASListDelegate
_setRemoteHandle, addContentsChangedListener, apply, contains, contentsChanged, count, disableEvents, enableEvents, equals, fireContentsChanged, fireContentsChanged, get, getIndex, getItems, getItems, getLastIndex, initialize, parseList, remoteObject, removeContentsChangedListener, toString
 

Field Detail

children

protected transient com.sas.collection.OrderedCollectionInterface children

connection

protected transient com.sas.rmi.Connection connection

text

protected transient java.lang.String text

expText

protected transient java.lang.String expText

nodeType

protected transient java.lang.String nodeType

iconName

protected transient java.lang.String iconName

expIconName

protected transient java.lang.String expIconName

selIconName

protected transient java.lang.String selIconName

expSelIconName

protected transient java.lang.String expSelIconName

className

protected transient java.lang.String className

iconNum

protected transient int iconNum

expIconNum

protected transient int expIconNum

selIconNum

protected transient int selIconNum

expSelIconNum

protected transient int expSelIconNum

otherIconsNum

protected transient int otherIconsNum

icon

protected transient com.sas.visuals.IconInterface icon

expIcon

protected transient com.sas.visuals.IconInterface expIcon

selIcon

protected transient com.sas.visuals.IconInterface selIcon

expSelIcon

protected transient com.sas.visuals.IconInterface expSelIcon

id

protected transient int id

parentID

protected transient int parentID

isLeaf

protected transient java.lang.Boolean isLeaf
Method Detail

getChildren

protected com.sas.collection.OrderedCollectionInterface getChildren()
Return a collection that contains all the children for the Node

Returns:
collection of children nodes.

resubmitQuery

protected void resubmitQuery()
Overrides resubmitQuery from SASListDelegate

Overrides:
resubmitQuery in class SASListDelegate

parseParams

protected void parseParams(com.sas.collection.hlist.HListInterface params)
Parses the HListInterface to supply values to the objects properties.

Parameters:
params - list containing named items. See com.sas.sasserver.tree.RemoteServerNodeInterface class for appropriate key names

parseStringParam

protected java.lang.String parseStringParam(com.sas.collection.hlist.HListInterface params,
                                            java.lang.String key)
Parses a String item from the parameter list

Parameters:
params - - list of parameters
key - - name of key to parse
Returns:
the string value of the named item

parseIntParam

protected int parseIntParam(com.sas.collection.hlist.HListInterface params,
                            java.lang.String key)
Parses an iteger item from the parameter list

Parameters:
params - - list of parameters
key - - name of key to parse
Returns:
the integer value of the named item

reset

protected void reset()
Sets parameters to nulls


initialize

protected void initialize(com.sas.collection.hlist.HListInterface params)
Initalizes the remoteObject

Parameters:
params - - a list of initialization parameters

setRemoteNode

protected void setRemoteNode(ServerNodeInterface rNode)
Sets the object id of the remote server node object

Parameters:
rNode - - remote object identifier.

remoteNode

protected ServerNodeInterface remoteNode()
Creates the remote object on the server

Returns:
- remote server node object

getDefaultIcon

public com.sas.visuals.IconInterface getDefaultIcon()
Description copied from interface: NodeIconInterface
Returns the default icon for the current node.

Specified by:
getDefaultIcon in interface com.sas.models.NodeIconInterface
Returns:
the default icon for the current node
See Also:
NodeIconInterface

setDefaultIcon

public void setDefaultIcon(int iNum)
Sets the default icon number.

Parameters:
iNum - - icon number

getExpandedIcon

public com.sas.visuals.IconInterface getExpandedIcon()
Description copied from interface: NodeIconInterface
Returns the expanded icon for the current node. If the expanded icon is null then the result of getDefaultIcon should be returned.

Specified by:
getExpandedIcon in interface com.sas.models.NodeIconInterface
Returns:
the expanded icon for the current node
See Also:
NodeIconInterface

setExpandedIcon

public void setExpandedIcon(int iNum)
Sets the expanded icon number.

Parameters:
iNum - - icon number

getExpandedSelectedIcon

public com.sas.visuals.IconInterface getExpandedSelectedIcon()
Description copied from interface: NodeIconInterface
Returns the expandedSelected icon for the current node. If the expandedSelected icon is null then the result of getExpandedIcon should be returned.

Specified by:
getExpandedSelectedIcon in interface com.sas.models.NodeIconInterface
Returns:
the expandedSelected icon for the current node
See Also:
NodeIconInterface

setExpandedSelectedIcon

public void setExpandedSelectedIcon(int iNum)
Sets the expanded selected icon number.

Parameters:
iNum - - icon number

getSelectedIcon

public com.sas.visuals.IconInterface getSelectedIcon()
Description copied from interface: NodeIconInterface
Returns the selected icon for the current node. If the selected icon is null then the result of getDefaultIcon should be returned.

Specified by:
getSelectedIcon in interface com.sas.models.NodeIconInterface
Returns:
the selected icon for the current node
See Also:
NodeIconInterface

setSelectedIcon

public void setSelectedIcon(int iNum)
Sets the selected icon number.

Parameters:
iNum - - icon number

loadIcon

protected com.sas.visuals.IconInterface loadIcon(java.lang.String iconName)
loads the icons used in the treeView.

Parameters:
iconName - - the name of the icon to be loaded.

loadIcon

protected com.sas.visuals.IconInterface loadIcon(java.lang.String iconName,
                                                 java.lang.String defaultImageName)
loads the icons used in the treeView.

Parameters:
iconName - - the name of the icon to be loaded.

getNodeExpandedText

public java.lang.String getNodeExpandedText()
Description copied from interface: NodeInterface
Returns the value of the nodeExpandedText property. The expanded text is usually a more descriptive version of the nodeText property. For example, a node that represents a file can return the file name for the nodeText property and the full path name for the nodeExpandedText property.

Specified by:
getNodeExpandedText in interface com.sas.models.NodeInterface
Returns:
the nodeExpandedText property
See Also:
NodeInterface

setNodeExpandedText

public void setNodeExpandedText(java.lang.String text)
See Also:
NodeInterface

getNodeText

public java.lang.String getNodeText()
Description copied from interface: NodeInterface
Returns the value of the nodeText property.

Specified by:
getNodeText in interface com.sas.models.NodeInterface
Returns:
the nodeText property
See Also:
NodeInterface

setNodeText

public void setNodeText(java.lang.String text)
See Also:
NodeInterface

getNodeType

public java.lang.String getNodeType()
Description copied from interface: NodeInterface
Returns the value of the nodeType property. The type can be used for categorizing nodes.

Specified by:
getNodeType in interface com.sas.models.NodeInterface
Returns:
the nodeType property
See Also:
NodeInterface

setNodeType

public void setNodeType(java.lang.String type)
See Also:
NodeInterface

countNodeChildren

public int countNodeChildren(int maxCount)
Description copied from interface: SimpleNodeInterface
Counts the children of the current node. countNodeChildren differs from getNodeChildCount when the number of children is unknown, i.e. when getNodeChildCount returns -1. If your implementation of getNodeChildCount never returns -1, then simply define countNodeChildren as a return of getNodeChildCount, otherwise read-on.

countNodeChildren is an instruction to determine the number of children even though that number is not readily known. To limit the potential overhead of this determination, the maximum number of children to read may be specified.

Specified by:
countNodeChildren in interface com.sas.models.SimpleNodeInterface
Returns:
The number of children known to be available.
See Also:
SimpleNodeInterface

getNodeChild

public com.sas.models.SimpleNodeInterface getNodeChild(int nodeIndex)
Description copied from interface: SimpleNodeInterface
Returns the child node at the specified index. If the leafNode property value is true then this method should return null.

Specified by:
getNodeChild in interface com.sas.models.SimpleNodeInterface
Parameters:
nodeIndex - the 0-based index of the child node to retrieve
Returns:
the child at index or null if the leafNode property value is true.
See Also:
SimpleNodeInterface

getNodeChildCount

public int getNodeChildCount()
Description copied from interface: SimpleNodeInterface
Returns the number of children. If the number of children is unknown, -1 should be returned.

Specified by:
getNodeChildCount in interface com.sas.models.SimpleNodeInterface
Returns:
the number of children or -1 if unknown
See Also:
SimpleNodeInterface

getNodeChildren

public com.sas.models.SimpleNodeInterface[] getNodeChildren(int startIndex,
                                                            int count)
Description copied from interface: SimpleNodeInterface
Returns the specified range of children for the current node. If there are less children than are queried for, an implementation can return an array whose size if representative of the actual number of children being returned or an array whose size is the same as the number of children asked for. If the resulting array's size is the same as the number asked for and there are fewer children returned than asked for the implementation should assign the unused values in the array to null. If the leafNode property value is true then this method should return null.

Specified by:
getNodeChildren in interface com.sas.models.SimpleNodeInterface
Parameters:
startIndex - 0-based index which identifies the start of the range
count - the amount of children to get
Returns:
an array containing the specified range of children or null if the leafNode property value is true.
See Also:
SimpleNodeInterface

isLeafNode

public boolean isLeafNode()
Description copied from interface: SimpleNodeInterface
Indicates whether the current node is a leaf. A value of true indicates that the current node is a leaf and hence will not have any children.

Specified by:
isLeafNode in interface com.sas.models.SimpleNodeInterface
Returns:
true if the current node is a leaf, otherwise false
See Also:
SimpleNodeInterface

getRoot

public com.sas.models.NodeInterface getRoot()
Description copied from interface: TreeInterface
Returns a NodeInterface object to serve as the root node.

Specified by:
getRoot in interface com.sas.models.TreeInterface
Returns:
the root node as type NodeInterface
See Also:
TreeInterface

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from class: Component
Return a clone of the object.

Overrides:
clone in class SASListDelegate
Returns:
a clone of the object.
Throws:
java.lang.CloneNotSupportedException - if the model attached to the component being cloned will not allow the clone to attach.
See Also:
StaticOrderedCollectionInterface.clone()

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Creates a PropertyChangeEvent and calls notifyPropertyChange to fire the event to all registered listeners.

Specified by:
firePropertyChange in interface com.sas.ComponentInterface
Overrides:
firePropertyChange in class SASListDelegate
Parameters:
propertyName - the name of the property that has changed
oldValue - the old value of the property
newValue - the new value of the property
See Also:
ComponentInterface.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)

firePropertyChange

public void firePropertyChange(java.beans.PropertyChangeEvent event)
Calls notifyPropertyChange to fire the event to all registered listeners.

Specified by:
firePropertyChange in interface com.sas.ComponentInterface
Overrides:
firePropertyChange in class com.sas.Component
Parameters:
event - the event being fired
See Also:
ComponentInterface.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a listener for the java.beans.PropertyChangeEvent event.

Specified by:
addPropertyChangeListener in interface com.sas.beans.PropertyChangeSource
Specified by:
addPropertyChangeListener in interface com.sas.ComponentInterface
Overrides:
addPropertyChangeListener in class com.sas.Component
Parameters:
listener - an object which handles PropertyChangeEvent events. The listener is not added a second time if it already exists in the list of listeners for this event.
See Also:
PropertyChangeSource

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a listener for the java.beans.PropertyChangeEvent event. Nothing happens if the listener is not in the list of listeners for this event.

Specified by:
removePropertyChangeListener in interface com.sas.beans.PropertyChangeSource
Specified by:
removePropertyChangeListener in interface com.sas.ComponentInterface
Overrides:
removePropertyChangeListener in class com.sas.Component
Parameters:
listener - an object which handles PropertyChangeEvent events
See Also:
PropertyChangeSource

notifyPropertyChange

protected void notifyPropertyChange(java.beans.PropertyChangeEvent event)
Sends a PropertyChangeEvent event to all the PropertyChangeListener objects in the listener list. The listener list is copied first, so the event is sent only to each item which is in the list at the time of this copy, even if adds or removes are performed after the send has started.

Parameters:
event - the event to send



Copyright © 2009 SAS Institute Inc. All Rights Reserved.