public static class FilterNode.Children extends Children.Keys<Node> implements Cloneable
This class is used as the default for subnodes of filter node, but subclasses may modify it or provide a totally different implementation.
FilterNode.Children is not well suited to cases where you need to insert
additional nodes at the beginning or end of the list, or where you may need
to merge together multiple original children lists, or reorder them, etc.
That is because the keys are of type Node, one for each original
child, and the keys are reset during addNotify(), filterChildrenAdded(org.openide.nodes.NodeMemberEvent),
filterChildrenRemoved(org.openide.nodes.NodeMemberEvent), and filterChildrenReordered(org.openide.nodes.NodeReorderEvent), so it is
not trivial to use different keys: you would need to override addNotify
(calling super first!) and the other three update methods. For such complex cases
you will do better by creating your own Children.Keys subclass, setting
keys that are useful to you, and keeping a NodeListener on the original
node to handle changes.
Children.Array, Children.Keys<T>, Children.Map<T>, Children.SortedArray, Children.SortedMap<T>| Modifier and Type | Field and Description |
|---|---|
protected Node |
original
Original node.
|
nodes| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Node[] arr)
Deprecated.
|
protected void |
addNotify()
Initializes listening to changes in original node.
|
protected void |
changeOriginal(Node original)
Sets the original children for this children.
|
Object |
clone()
Special handling for clonning.
|
protected Node |
copyNode(Node node)
Allows subclasses to override
creation of node representants for nodes in the mirrored children
list.
|
protected Node[] |
createNodes(Node key)
Create nodes representing copies of the original node's children.
|
protected void |
filterChildrenAdded(NodeMemberEvent ev)
Called when the filter node adds a new child.
|
protected void |
filterChildrenRemoved(NodeMemberEvent ev)
Called when the filter node removes a child.
|
protected void |
filterChildrenReordered(NodeReorderEvent ev)
Called when the filter node reorders its children.
|
protected void |
finalize()
Closes the listener, if any, on the original node.
|
Node |
findChild(String name)
Find a child node by name.
|
Node[] |
getNodes(boolean optimalResult)
Implementation that ensures the original node is fully initialized
if optimal result is requested.
|
int |
getNodesCount(boolean optimalResult)
Get the number of nodes in the list
|
boolean |
remove(Node[] arr)
Deprecated.
|
protected void |
removeNotify()
Clears current keys, because all mirrored nodes disappeared.
|
destroyNodes, refreshKey, setBefore, setKeys, setKeysinitCollection, refreshcreate, createLazy, getNode, getNodeAt, getNodes, getNodesCount, isInitialized, nodes, snapshotprotected Node original
public Children(Node or)
or - original node to take children fromprotected final void changeOriginal(Node original)
Children.MUTEX).
Take care not to call this method under read lock.original - The new original node.protected void finalize()
public Object clone()
Children.Keysclone in class Children.Keys<Node>protected void addNotify()
addNotify in class ChildrenChildren.isInitialized()protected void removeNotify()
removeNotify in class Childrenprotected Node copyNode(Node node)
Node.cloneNode().
Note that this method is only suitable for a 1-to-1 mirroring.
node - node to create copy ofpublic Node findChild(String name)
ChildrenNormally the list of nodes should have been computed by the time this returns,
but see Children.getNodes() for an important caveat as to why this may not
be doing what you want and what to do instead.
protected Node[] createNodes(Node key)
copyNode(org.openide.nodes.Node).
Subclasses may override this to avoid displaying a copy of an original child at all,
or even to display multiple nodes representing the original.createNodes in class Children.Keys<Node>key - the original child node@Deprecated public boolean add(Node[] arr)
ChildrenChildren.Keys.setKeys(java.util.Collection<? extends T>) instead.
The parent node of these nodes
is changed to the parent node of this list. Each node can be added
only once. If there is some reason a node cannot be added, for example
if the node expects only a special type of subnodes, the method should
do nothing and return false to signal that the addition has not been successful.
This method should be implemented by subclasses to filter some nodes, etc.
add in class Children.Keys<Node>arr - set of nodes to add to the listtrue if successfully added@Deprecated public boolean remove(Node[] arr)
Childrenremove in class Children.Keys<Node>arr - nodes to be removedtrue if the nodes could be removedprotected void filterChildrenAdded(NodeMemberEvent ev)
ev - info about the changeprotected void filterChildrenRemoved(NodeMemberEvent ev)
ev - info about the changeprotected void filterChildrenReordered(NodeReorderEvent ev)
ev - info about the changepublic Node[] getNodes(boolean optimalResult)
public int getNodesCount(boolean optimalResult)
ChildrengetNodesCount in class ChildrenoptimalResult - whether to try to perform full initialization
or to simply delegate to Children.getNodesCount()Built on August 24 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.