org.sbml.jsbml.util
public class TreeNodeAdapter extends AbstractTreeNode
This class is a wrapper element for any Object
that should be linked
into a tree data structure as represented by AbstractTreeNode
, but
that might by itself not be an instance of TreeNode
, i.e., not
compatible with the remaining tree data structure. In analogy to
MutableTreeNode
we call this Object
userObject
(see getUserObject()
and setUserObject(Object)
).
This wrapper distinguishes the following special cases depending on the type
of userObject
when accessing the i-th child of this
TreeNode
. The userObject
is an instance of
TreeNode
: recursive operations are continued at this elementCollection
: recursion leads to the i-th element in the
Iterator
Map
: the key set is sorted (only possible if the keys implement
the Comparable
interface) and recursion continues at the i-th key.Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
Generated serial version identifier.
|
private java.lang.Object |
userObject
The object to be wrapped.
|
listOfListeners, parent, UNKNOWN_ATTRIBUTES, UNKNOWN_ELEMENTS
Constructor and Description |
---|
TreeNodeAdapter(java.lang.Object userObject,
javax.swing.tree.TreeNode parent)
Creates a new
TreeNode wrapper for the given userObject
that will be linked to the given AbstractTreeNode.parent within an exisiting
tree. |
TreeNodeAdapter(TreeNodeAdapter node)
Copy constructor for the given node.
|
Modifier and Type | Method and Description |
---|---|
javax.swing.tree.TreeNode |
clone() |
boolean |
equals(java.lang.Object object) |
boolean |
getAllowsChildren() |
javax.swing.tree.TreeNode |
getChildAt(int childIndex) |
int |
getChildCount() |
java.lang.Object |
getUserObject() |
int |
hashCode() |
boolean |
isSetUserObject() |
boolean |
isUserObjectRecursiveDataType()
Checks whether or not the user's object has been set (see
isSetUserObject() ) and if so if it belongs to those elements
returned by the method getChildAt(int) . |
void |
setUserObject(java.lang.Object object) |
java.lang.String |
toString() |
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, fireNodeRemovedEvent, firePropertyChange, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getParent, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, notifyChildChange, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
private static final long serialVersionUID
private java.lang.Object userObject
public TreeNodeAdapter(java.lang.Object userObject, javax.swing.tree.TreeNode parent)
TreeNode
wrapper for the given userObject
that will be linked to the given AbstractTreeNode.parent
within an exisiting
tree.userObject
- the element to be wrapped in a TreeNode
; may be null
.parent
- the parent TreeNode
of this new node, i.e., the
position within an existing tree where to link this new node.
May be null
.public TreeNodeAdapter(TreeNodeAdapter node)
node
- public javax.swing.tree.TreeNode clone()
clone
in class AbstractTreeNode
public boolean equals(java.lang.Object object)
equals
in class AbstractTreeNode
public boolean getAllowsChildren()
public javax.swing.tree.TreeNode getChildAt(int childIndex)
public int getChildCount()
public java.lang.Object getUserObject()
public int hashCode()
hashCode
in class AbstractTreeNode
public boolean isSetUserObject()
public boolean isUserObjectRecursiveDataType()
isSetUserObject()
) and if so if it belongs to those elements
returned by the method getChildAt(int)
.true
if the user's object has been defined and
belongs to those classes that are returned by the method
getChildAt(int)
.getChildAt(int)
,
isSetUserObject()
public void setUserObject(java.lang.Object object)
object
- public java.lang.String toString()
toString
in class AbstractTreeNode