|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.models.Node
public class Node
Node is a generic implementation of NodeInterface and
MutableSimpleNodeInterface.
Node is a single unit in a hierarchical structure. It provides textual
descriptions, children and user specified data. PropertyChangeEvent events will be
fired for the properties of Node whenever they are set or modified.
| Field Summary | |
|---|---|
protected OrderedCollection |
children
nodeChildren property. |
protected StaticPropertyBagInterface |
defaultNodeStyle
defaultNodeStyle property. |
protected java.lang.String |
expandedNodeText
nodeExpandedText property. |
protected boolean |
externalUpdateSupported
externalUpdateSupported property. |
protected boolean |
hasChildren
Field used for leaf property. |
protected StaticPropertyBagInterface |
nodeStyle
nodeStyle property. |
protected java.lang.String |
nodeText
nodeText property. |
protected java.lang.String |
nodeType
nodeType property. |
protected java.lang.Object |
objectData
objectData property. |
static java.lang.String |
RB_KEY
|
| Constructor Summary | |
|---|---|
Node()
Constructs a Node object. |
|
Node(java.lang.String nodeText)
Constructs a Node object with the specified text. |
|
Node(java.lang.String nodeText,
java.lang.String nodeType)
Constructs a Node object with the specified text and type. |
|
| Method Summary | |
|---|---|
void |
addItems(java.util.Enumeration enumer)
Appends the enumeration of SimpleNodeInterface objects to the children of the current node. |
void |
addNodeChild(SimpleNodeInterface node)
Add the specified node to the end of the child list. |
void |
addNodeChild(SimpleNodeInterface node,
int index)
Adds a child at index. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a listener for the java.beans.PropertyChangeEvent event. |
boolean |
attachView()
Called during an attachModel call on the view. |
int |
countNodeChildren(int maximumChildCount)
Returns the number of children. |
void |
detachView()
Called during a detachModel call on the view. |
protected void |
firePropertyChange(java.beans.PropertyChangeEvent event)
Calls notifyPropertyChange to fire the event to all registered listeners. |
protected 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. |
StaticPropertyBagInterface |
getDefaultNodeStyle()
Returns the default node style for this node and all of this node's descendants. |
int |
getIndex(NodeInterface item,
int startIndex)
Returns the 0-based index associated with the NodeInterface object in the children collection (searches forward) |
SimpleNodeInterface |
getNodeChild(int index)
Returns the child node at the specified 0-based index. |
int |
getNodeChildCount()
Returns the number of children. |
StaticOrderedCollectionInterface |
getNodeChildren()
Returns the children of the current node. |
SimpleNodeInterface[] |
getNodeChildren(int startIndex,
int count)
Returns a range of child nodes. |
java.lang.String |
getNodeExpandedText()
Returns the expanded text for the current node. |
StaticPropertyBagInterface |
getNodeStyle()
Returns the style for this node. |
java.lang.String |
getNodeText()
Returns the text for the current node. |
java.lang.String |
getNodeType()
Returns the type of the current node. |
java.lang.String[] |
getNodeTypes()
Returns the complete set of types for a node. |
java.lang.Object |
getObjectData()
Returns user-supplied data for the current node. |
NodeInterface |
getRoot()
Returns the current node ( this) to serve as the root node. |
boolean |
isExternalUpdateSupported()
|
boolean |
isLeafNode()
Indicates whether the current Node is a leaf (has no children). |
void |
moveNodeChild(int startIndex,
int endIndex)
Moves the child at startIndex to endIndex. |
protected void |
notifyPropertyChange(java.beans.PropertyChangeEvent event)
Sends a PropertyChangeEvent event to all the
PropertyChangeListener objects in the listener list. |
void |
removeAllNodeChildren()
Removes all children. |
void |
removeNodeChild(int index)
Removes the child at index. |
void |
removeNodeChild(SimpleNodeInterface node)
Removes node from the current node. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a listener for the java.beans.PropertyChangeEvent event. |
void |
setDefaultNodeStyle(StaticPropertyBagInterface newValue)
Sets the default node style for this node and all of this node's descendants. |
void |
setExternalUpdateSupported(boolean newValue)
Sets the value of the externalUpdateSupported property. |
void |
setNodeChildren(StaticOrderedCollectionInterface newValue)
Sets the children for the current node. |
void |
setNodeExpandedText(java.lang.String newValue)
Sets the expanded text of the current node. |
void |
setNodeStyle(StaticPropertyBagInterface newValue)
Sets the node style for this node and all of this node's descendants. |
void |
setNodeText(java.lang.String newValue)
Sets the text of the current node. |
void |
setNodeType(java.lang.String newValue)
Sets the type of the current node. |
void |
setObjectData(java.lang.Object newValue)
Sets the object data for the current node. |
void |
sort(com.sas.util.Comparator comparator)
Sorts the children collection in place using the provided comparison function. |
java.lang.String |
toString()
Returns the value of the nodeText property. |
| Field Detail |
|---|
public static final java.lang.String RB_KEY
protected boolean hasChildren
false indicates
that the current node is a leaf.
protected OrderedCollection children
protected java.lang.String expandedNodeText
protected boolean externalUpdateSupported
protected java.lang.String nodeText
protected java.lang.String nodeType
protected java.lang.Object objectData
protected StaticPropertyBagInterface nodeStyle
protected StaticPropertyBagInterface defaultNodeStyle
| Constructor Detail |
|---|
public Node()
public Node(java.lang.String nodeText)
nodeText - the initial value for the nodeText property
public Node(java.lang.String nodeText,
java.lang.String nodeType)
nodeText - the initial value for the nodeText propertynodeType - the initial value for the nodeType property| Method Detail |
|---|
public int countNodeChildren(int maximumChildCount)
SimpleNodeInterface. Since the child count can never be unknown,
countNodeChildren should not be called. It ignores the
maximumChildCount parameter and returns the result of getNodeChildCount.
countNodeChildren in interface SimpleNodeInterfacemaximumChildCount - this parameter is ignored
getNodeChildCountpublic int getNodeChildCount()
getNodeChildCount in interface SimpleNodeInterfacepublic boolean isLeafNode()
isLeafNode in interface SimpleNodeInterfacetrue if the current node is a leaf, otherwise falsepublic SimpleNodeInterface getNodeChild(int index)
getNodeChild in interface SimpleNodeInterfaceindex - the 0-based index of the child to get
java.lang.IndexOutOfBoundsException - if the index is out of range [0, nodeChildCount-1]getNodeChildren(int, int),
setNodeChildren(com.sas.collection.StaticOrderedCollectionInterface)
public SimpleNodeInterface[] getNodeChildren(int startIndex,
int count)
getNodeChildren in interface SimpleNodeInterfacestartIndex - 0-based index which identifies the start of the rangecount - the amount of children to get
java.lang.IndexOutOfBoundsException - if startIndex is out of range
[0, nodeChildCount-1] or if
startIndex + count > nodeChildCountgetNodeChild(int),
setNodeChildren(com.sas.collection.StaticOrderedCollectionInterface)public java.lang.String getNodeExpandedText()
getNodeExpandedText in interface NodeInterfacesetNodeExpandedText(java.lang.String)public java.lang.String getNodeType()
getNodeType in interface NodeInterfacesetNodeType(java.lang.String)public java.lang.String getNodeText()
getNodeText in interface NodeInterfacesetNodeText(java.lang.String)public void addNodeChild(SimpleNodeInterface node)
node - the child to add
public void addNodeChild(SimpleNodeInterface node,
int index)
addNodeChild in interface MutableSimpleNodeInterfacenode - the child to addindex - the position at which to add the childMutableSimpleNodeInterfacepublic void removeNodeChild(SimpleNodeInterface node)
removeNodeChild(int).
removeNodeChild in interface MutableSimpleNodeInterfacenode - the child to removeremoveNodeChild(int),
MutableSimpleNodeInterfacepublic void removeNodeChild(int index)
removeNodeChild in interface MutableSimpleNodeInterfaceindex - the position at which to remove the childMutableSimpleNodeInterfacepublic void removeAllNodeChildren()
removeAllNodeChildren in interface MutableSimpleNodeInterfaceMutableSimpleNodeInterface
public void moveNodeChild(int startIndex,
int endIndex)
moveNodeChild in interface MutableSimpleNodeInterfacestartIndex - the current position of the childendIndex - the new position of the childMutableSimpleNodeInterfacepublic boolean isExternalUpdateSupported()
isExternalUpdateSupported in interface MutableSimpleNodeInterfaceMutableSimpleNodeInterface.isExternalUpdateSupported(),
setExternalUpdateSupported(boolean)public StaticPropertyBagInterface getNodeStyle()
getNodeStyle in interface StaticNodeStyleInterfacesetNodeStyle(com.sas.collection.StaticPropertyBagInterface)public StaticPropertyBagInterface getDefaultNodeStyle()
getDefaultNodeStyle in interface StaticNodeStyleInterfacesetDefaultNodeStyle(com.sas.collection.StaticPropertyBagInterface)public java.lang.String[] getNodeTypes()
getNodeTypes in interface StaticNodeStyleInterfacenull, or a string array of all the possible node types.public void addItems(java.util.Enumeration enumer)
enumer - the SimpleNodeInterface objects to add as children
public int getIndex(NodeInterface item,
int startIndex)
item - NodeInterface to search forstartIndex - the position where the search should start
java.lang.IndexOutOfBoundsException - if the start index
is invalidpublic StaticOrderedCollectionInterface getNodeChildren()
null.
This property is not serialized, therefore any listeners to the returned collection
need to be setup again after deserialization.
public java.lang.Object getObjectData()
getObjectData in interface com.sas.lang.ObjectDataInterfacesetObjectData(java.lang.Object)public NodeInterface getRoot()
this) to serve as the root node.
This is the implementation of TreeInterface which allows a single node
to be set as the model for a viewer that requires
TreeInterface (such as com.sas.visuals.TreeView).
getRoot in interface TreeInterfacethis)TreeInterface,
TreeViewpublic void setExternalUpdateSupported(boolean newValue)
newValue - true to allow external updates, false otherwiseisExternalUpdateSupported()public void setNodeChildren(StaticOrderedCollectionInterface newValue)
newValue - the new set of childrengetNodeChild(int),
getNodeChildren(int, int)public void setNodeExpandedText(java.lang.String newValue)
setNodeExpandedText in interface MutableNodeInterfacenewValue - the new value for the nodeExpandedText propertygetNodeExpandedText()public void setNodeType(java.lang.String newValue)
setNodeType in interface MutableNodeInterfacenewValue - the new value for the nodeType propertygetNodeType()public void setNodeText(java.lang.String newValue)
setNodeText in interface MutableNodeInterfacenewValue - the new value for the nodeText propertygetNodeText()public void setObjectData(java.lang.Object newValue)
setObjectData in interface com.sas.lang.ObjectDataInterfacenewValue - the new value for the objectData propertygetObjectData()public void sort(com.sas.util.Comparator comparator)
comparator - the comparison function to use for sorting
protected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
propertyName - the name of the property that has changedoldValue - the old value of the propertynewValue - the new value of the propertyprotected void firePropertyChange(java.beans.PropertyChangeEvent event)
event - the event being firedpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface com.sas.beans.PropertyChangeSourcelistener - 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.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface com.sas.beans.PropertyChangeSourcelistener - an object which handles PropertyChangeEvent eventsprotected void notifyPropertyChange(java.beans.PropertyChangeEvent event)
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.
event - the event to sendpublic boolean attachView()
attachModel call on the view. Node always returns
true indicating that attaching to a viewer is allowed.
attachView in interface ModelInterfacetrueModelInterface.detachView(),
ViewInterface.attachModel(com.sas.ModelInterface)public void detachView()
detachModel call on the view. The
detachView method serves
as a hook to receive notification that a view is detaching from it.
detachView in interface ModelInterfaceModelInterface.attachView(),
ViewInterface.detachModel(com.sas.ModelInterface)public java.lang.String toString()
toString in class java.lang.Objectpublic void setNodeStyle(StaticPropertyBagInterface newValue)
newValue - the new StaticPropertyBagInterface value for the
nodeStyle propertygetNodeStyle()public void setDefaultNodeStyle(StaticPropertyBagInterface newValue)
newValue - the new StaticPropertyBagInterface value for the
defaultNodeStyle propertygetDefaultNodeStyle()
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||