org.sbml.jsbml.util
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()
.Modifier and Type | Field and Description |
---|---|
private javax.swing.tree.TreeNode |
previosParent
The previous parent node in the tree, i.e., the node that was the parent of
the deleted node (see
getSource() ) before the deletion. |
private static long |
serialVersionUID
Generated serial version identifier.
|
Constructor and Description |
---|
TreeNodeRemovedEvent(TreeNodeRemovedEvent treeNodeRemovedEvent)
Clone constructor.
|
TreeNodeRemovedEvent(javax.swing.tree.TreeNode source,
javax.swing.tree.TreeNode previousParent)
Creates a new
TreeNodeRemovedEvent that contains information about
an element that has just been removed from a tree together with its
previous parent node. |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
clone() |
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() |
private static final long serialVersionUID
private javax.swing.tree.TreeNode previosParent
getSource()
) before the deletion.public TreeNodeRemovedEvent(javax.swing.tree.TreeNode source, javax.swing.tree.TreeNode previousParent)
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.previousParent
- 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
- protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
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