org.sbml.jsbml.util
public interface TreeNodeWithChangeSupport extends java.lang.Cloneable, javax.swing.tree.TreeNode, java.io.Serializable
TreeNode
by
adding methods to keep track of changes within the tree, such as
adding/removing, or exchanging of child nodes or the change of any other
attributes.Modifier and Type | Method and Description |
---|---|
boolean |
addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners)
Adds recursively all given
TreeNodeChangeListener instances to
this element. |
boolean |
addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners,
boolean recursive) |
void |
addTreeNodeChangeListener(TreeNodeChangeListener listener)
Adds recursively a listener to the
TreeNodeWithChangeSupport
object and all of its sub-elements. |
void |
addTreeNodeChangeListener(TreeNodeChangeListener listener,
boolean recursive)
Adds a listener to this
TreeNodeWithChangeSupport object and
optionally also to all of its child nodes. |
void |
clearUserObjects()
Removes all of the mappings from the map of user objects (optional
operation).
|
boolean |
containsUserObjectKey(java.lang.Object key) |
java.util.List<? extends javax.swing.tree.TreeNode> |
filter(Filter filter)
Filters this tree data structure recursively and returns a list of all
TreeNode s that are accepted by the Filter . |
java.util.List<? extends javax.swing.tree.TreeNode> |
filter(Filter filter,
boolean retainInternalNodes)
Filters this tree data structure recursively and returns a list of all
TreeNode s that are accepted by the Filter . |
java.util.List<? extends javax.swing.tree.TreeNode> |
filter(Filter filter,
boolean retainInternalNodes,
boolean prune)
Filters this tree data structure recursively and returns a list of all
TreeNode s that are accepted by the Filter . |
void |
fireNodeAddedEvent()
All
TreeNodeChangeListener instances linked to this
TreeNode are informed about the adding of this Object to
an owning parent Object . |
void |
fireNodeRemovedEvent()
All
TreeNodeChangeListener instances linked to this
TreeNode are informed about the deletion of this TreeNode
from a parent Object . |
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
All
TreeNodeChangeListener s are informed about the change in this
TreeNodeWithChangeSupport . |
java.util.List<TreeNodeChangeListener> |
getListOfTreeNodeChangeListeners()
Returns all
TreeNodeChangeListener s that are assigned to this
element. |
javax.swing.tree.TreeNode |
getRoot() |
int |
getTreeNodeChangeListenerCount() |
java.lang.Object |
getUserObject(java.lang.Object key) |
boolean |
isRoot()
Opposite of
isSetParent() . |
boolean |
isSetParent() |
boolean |
isSetUserObjects()
Checks whether any user-defined key-value pairs have been attached
to this object.
|
void |
putUserObject(java.lang.Object key,
java.lang.Object userObject) |
void |
removeAllTreeNodeChangeListeners()
Removes all tree node change listeners from this element.
|
void |
removeAllTreeNodeChangeListeners(boolean recursive) |
boolean |
removeFromParent()
Removes itself from its parent.
|
void |
removeTreeNodeChangeListener(TreeNodeChangeListener listener)
Removes recursively the given change listener from this element.
|
void |
removeTreeNodeChangeListener(TreeNodeChangeListener listener,
boolean recursive)
Removes the given change listener from this element.
|
java.lang.Object |
removeUserObject(java.lang.Object key) |
java.util.Set<java.lang.Object> |
userObjectKeySet() |
boolean addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners)
TreeNodeChangeListener
instances to
this element.listeners
- the set of listeners to addtrue
if the set of listeners is added with success.void addTreeNodeChangeListener(TreeNodeChangeListener listener)
TreeNodeWithChangeSupport
object and all of its sub-elements. Calling this method is effectively
identical to the call
addTreeNodeChangeListener(TreeNodeChangeListener, boolean)
where
recursively = true
.listener
- the listener to addaddTreeNodeChangeListener(TreeNodeChangeListener, boolean)
void addTreeNodeChangeListener(TreeNodeChangeListener listener, boolean recursive)
TreeNodeWithChangeSupport
object and
optionally also to all of its child nodes.listener
- the listener to addrecursive
- if true
the given listener will be added to this node and
also recursively to all of its child nodes. If false
, the
listener will only be added to the current node.addTreeNodeChangeListener(TreeNodeChangeListener)
void clearUserObjects()
Map.clear()
boolean containsUserObjectKey(java.lang.Object key)
key
- Map.containsKey(java.lang.Object)
java.util.List<? extends javax.swing.tree.TreeNode> filter(Filter filter)
TreeNode
s that are accepted by the Filter
. Although
internal nodes that do not satisfy the filter criterion by themselves
are not contained in the resulting list, the recursion continues at
their children.filter
- A criterion to select a sub-set of nodes of this tree.List
of TreeNode
s that do all satisfy the
criterion of the given Filter
.filter(Filter, boolean)
java.util.List<? extends javax.swing.tree.TreeNode> filter(Filter filter, boolean retainInternalNodes)
TreeNode
s that are accepted by the Filter
. The second
argument decides whether or not internal nodes that do not by themselves
satisfy the filter criterion should still be retained in the result list.filter
- A criterion to select a sub-set of nodes of this tree.retainInternalNodes
- Decides if internal nodes should also be included in the
resulting List
if they do not by themselves satisfy
the Filter
but if these do have child elements that do
so. This might be useful in order to obtain a complete tree
path to interesting sub-elements.List
representing a subset of TreeNode
s that
satisfy the Filter
's criterion, or whose child nodes do
so.filter(Filter)
java.util.List<? extends javax.swing.tree.TreeNode> filter(Filter filter, boolean retainInternalNodes, boolean prune)
TreeNode
s that are accepted by the Filter
. The two
boolean switches let you decide if internal nodes that do not by
themselves satisfy the filter criterion should be retained in the list,
and if the recursion should be aborted as soon as the first hit is
discovered.filter
- retainInternalNodes
- decides whether or not internal nodes should be added to the
list of results even though these might not by themselves
satisfy the filter's criterion, but whose children do. This
feature can be useful, e.g., in order to keep the full tree
path to nodes of interestprune
- if this argument is true
, the recursive search is
aborted upon the discovery of the first hit.List
representing a subset of TreeNode
s that
satisfy the Filter
's criterion, or whose child nodes do
so.filter(Filter, boolean)
void fireNodeAddedEvent()
TreeNodeChangeListener
instances linked to this
TreeNode
are informed about the adding of this Object
to
an owning parent Object
.void fireNodeRemovedEvent()
TreeNodeChangeListener
instances linked to this
TreeNode
are informed about the deletion of this TreeNode
from a parent Object
.void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
TreeNodeChangeListener
s are informed about the change in this
TreeNodeWithChangeSupport
.propertyName
- Tells the TreeNodeChangeListener
the name of the
property whose value has been changed.oldValue
- This is the value before the change.newValue
- This gives the new value that is now the new value for the
given property..java.util.List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners()
TreeNodeChangeListener
s that are assigned to this
element.TreeNodeChangeListener
s that are assigned to this
element.javax.swing.tree.TreeNode getRoot()
TreeNode
without parent, which is the top-most ancestor
of this node.int getTreeNodeChangeListenerCount()
TreeNodeChangeListener
s currently assigned to
this TreeNodeWithChangeSupport
java.lang.Object getUserObject(java.lang.Object key)
boolean isRoot()
isSetParent()
.
Returns true
if this AbstractTreeNode
is the root
node of a tree, false
otherwise.true
if this AbstractTreeNode
is the root
node of a tree, false
otherwise.isSetParent()
boolean isSetParent()
boolean isSetUserObjects()
true
if at least one user-defined key-value pair has
been attached to this object.void putUserObject(java.lang.Object key, java.lang.Object userObject)
key
- some user-defined key under which the given userObject can be
found.userObject
- the userObject to setvoid removeAllTreeNodeChangeListeners()
void removeAllTreeNodeChangeListeners(boolean recursive)
boolean removeFromParent()
List
, it is simply cleared.
Will fail (and not delete itself) if it has no parent object. This function
will work for all objects whose parent is of type List
and most
instances of TreeNode
.false
if this element is a root node, true
otherwise.void removeTreeNodeChangeListener(TreeNodeChangeListener listener)
removeTreeNodeChangeListener(TreeNodeChangeListener, boolean)
where the second argument is true
.listener
- the listener to remove.removeTreeNodeChangeListener(TreeNodeChangeListener, boolean)
void removeTreeNodeChangeListener(TreeNodeChangeListener listener, boolean recursive)
listener
- the listener to remove.recursive
- switch to decide whether or not the given listener should be removed
in a recursive manner.removeTreeNodeChangeListener(TreeNodeChangeListener)
java.lang.Object removeUserObject(java.lang.Object key)
key
- java.util.Set<java.lang.Object> userObjectKeySet()
Map.keySet()
boolean addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners, boolean recursive)
listeners
- recursive
-