public class TreeNodeRemovedEvent
extends java.util.EventObject
EventObject
to notify a TreeNodeChangeListener
about a removed node and its previous position within the tree. To this end,
this TreeNodeRemovedEvent
contains a pointer to both the actual
removed node and its previous parent node. Note that when removing an element
from the SBML tree, its pointer to its parent is set to null
.
To give an example why information about the previous parent is necessary:
Imagine, an instance of speciesReference
has been removed from
the SBML tree. After removing it, the model does no longer point to an
element with its id. Many reaction
s
might have been the origin of this removed node. If a
TreeNodeChangeListener
wants to, e.g., undo this change,
it is necessary to identify the previous position of the node within the
tree. That's why this class has two important
methods, namely getSource()
and getPreviousParent()
.Constructor | Description |
---|---|
TreeNodeRemovedEvent(javax.swing.tree.TreeNode source,
javax.swing.tree.TreeNode prevParent) |
Creates a new
TreeNodeRemovedEvent that contains information about
an element that has just been removed from a tree together with its
previous parent node. |
TreeNodeRemovedEvent(TreeNodeRemovedEvent treeNodeRemovedEvent) |
Clone constructor.
|
Modifier and Type | Method | Description |
---|---|---|
javax.swing.tree.TreeNode |
getPreviousParent() |
Access the pointer to the previous parent node of the removed node, may be
null . |
javax.swing.tree.TreeNode |
getSource() |
|
java.lang.String |
toString() |
public TreeNodeRemovedEvent(javax.swing.tree.TreeNode source, javax.swing.tree.TreeNode prevParent)
TreeNodeRemovedEvent
that contains information about
an element that has just been removed from a tree together with its
previous parent node.source
- the node that has just been removed from the tree.prevParent
- the node that was the parent node of the removed element, may be
null
if the node didn't have a parent.public TreeNodeRemovedEvent(TreeNodeRemovedEvent treeNodeRemovedEvent)
treeNodeRemovedEvent
- public javax.swing.tree.TreeNode getPreviousParent()
null
.getSource()
public javax.swing.tree.TreeNode getSource()
getSource
in class java.util.EventObject
public java.lang.String toString()
toString
in class java.util.EventObject