|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.opi.io.DefaultIOItemBrowseTreeNode
This class represents browse information about items (leafs) and groups (branches) on an communication server, ie. an OPC server, being capable of presenting available items in a tree-like format.
Please refer to
OpcClientApi.getServerItemsInfo()
for more
detailed information on how to obtain instances of this class
Field Summary | |
protected boolean |
allowsChildren
true if the node is able to have children |
protected Vector |
children
array of children, may be null if this node has no children |
static Enumeration |
EMPTY_ENUMERATION
An enumeration that is always empty. |
protected IOItemBrowseTreeNode |
parent
this node's parent, or null if this node has no parent |
protected Object |
userObject
optional user object |
Constructor Summary | |
DefaultIOItemBrowseTreeNode(String shortName,
String longName)
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object. |
|
DefaultIOItemBrowseTreeNode(String shortName,
String longName,
boolean allowsChildren)
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object. |
Method Summary | |
void |
add(IOItemBrowseTreeNode aNode)
Append the specified node to the end of this nodes children list |
Enumeration |
children()
Creates and returns a forward-order enumeration of this node's children. |
boolean |
getAllowsChildren()
Returns true if this node is allowed to have children. |
IOItemBrowseTreeNode |
getChildAt(int index)
Returns the child at the specified index in this node's child array. |
int |
getChildCount()
Returns the number of children of this node. |
int |
getIndex(IOItemBrowseTreeNode aChild)
Returns the index of the specified child in this node's child array. |
String |
getLongName()
Returns the long representation of this item |
IOItemBrowseTreeNode |
getParent()
Returns this node's parent or null if this node has no parent. |
String |
getShortName()
Returns the short representation of this item |
boolean |
isLeaf()
Returns true if this node has no children. |
boolean |
isNodeChild(IOItemBrowseTreeNode aNode)
Returns true if aNode is a child of this node. |
void |
setParent(IOItemBrowseTreeNode newParent)
Sets this node's parent to newParent but does not
change the parent's child array. |
String |
toString()
Returns the short name for this object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Enumeration EMPTY_ENUMERATION
protected IOItemBrowseTreeNode parent
protected Vector children
protected transient Object userObject
protected boolean allowsChildren
Constructor Detail |
public DefaultIOItemBrowseTreeNode(String shortName, String longName)
shortName
- a String
valuelongName
- a String
valuepublic DefaultIOItemBrowseTreeNode(String shortName, String longName, boolean allowsChildren)
shortName
- a String
valuelongName
- a String
valueallowsChildren
- if true, the node is allowed to have child
nodes - otherwise, it is always a leaf nodeMethod Detail |
public String getShortName()
getShortName
in interface IOItemBrowseTreeNode
public String getLongName()
getLongName
in interface IOItemBrowseTreeNode
public void add(IOItemBrowseTreeNode aNode)
aNode
- an IOItemBrowseTreeNode
valuepublic IOItemBrowseTreeNode getChildAt(int index)
getChildAt
in interface IOItemBrowseTreeNode
index
- an index into this node's child array
ArrayIndexOutOfBoundsException
- if index
is out of boundspublic int getChildCount()
getChildCount
in interface IOItemBrowseTreeNode
public void setParent(IOItemBrowseTreeNode newParent)
newParent
but does not
change the parent's child array. This method is called from
insert()
and remove()
to
reassign a child's parent, it should not be messaged from anywhere
else.
newParent
- this node's new parentpublic IOItemBrowseTreeNode getParent()
getParent
in interface IOItemBrowseTreeNode
public int getIndex(IOItemBrowseTreeNode aChild)
-1
. This method performs a linear search and is O(n)
where n is the number of children.
getIndex
in interface IOItemBrowseTreeNode
aChild
- the IOItemBrowseTreeNode to search for among this node's
children
-1
if the specified node is a not
a child of this node
IllegalArgumentException
- if aChild
is nullpublic boolean isNodeChild(IOItemBrowseTreeNode aNode)
aNode
is a child of this node. If
aNode
is null, this method returns false.
aNode
is a child of this node; false if
aNode
is nullpublic boolean getAllowsChildren()
getAllowsChildren
in interface IOItemBrowseTreeNode
public boolean isLeaf()
getAllowsChildren
isLeaf
in interface IOItemBrowseTreeNode
getAllowsChildren()
public Enumeration children()
children
in interface IOItemBrowseTreeNode
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |