org.openide.nodes
Class FilterNode.Children

java.lang.Object
  |
  +--org.openide.nodes.Children
        |
        +--org.openide.nodes.Children.Array
              |
              +--org.openide.nodes.Children.Keys
                    |
                    +--org.openide.nodes.FilterNode.Children
All Implemented Interfaces:
Cloneable
Enclosing class:
FilterNode

public static class FilterNode.Children
extends Children.Keys
implements Cloneable

Children for a filter node. Listens on changes in subnodes of the original node and asks this filter node to creates representants for these subnodes.

This class is used as the default for subnodes of filter node, but subclasses may modify it or provide a totally different implementation.


Inner classes inherited from class org.openide.nodes.Children
Children.Array, Children.Keys, Children.Map, Children.SortedArray, Children.SortedMap
 
Field Summary
protected  Node original
          Original node.
 
Fields inherited from class org.openide.nodes.Children.Array
nodes
 
Fields inherited from class org.openide.nodes.Children
LEAF, MUTEX
 
Constructor Summary
FilterNode.Children(Node or)
          Create children.
 
Method Summary
 boolean add(Node[] arr)
          Add nodes this container.
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(Object 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.
 boolean remove(Node[] arr)
          Remove nodes from the list.
protected  void removeNotify()
          Clears current keys, because all mirrored nodes disappeared.
 
Methods inherited from class org.openide.nodes.Children.Keys
destroyNodes, refreshKey, setBefore, setKeys, setKeys
 
Methods inherited from class org.openide.nodes.Children.Array
initCollection, refresh
 
Methods inherited from class org.openide.nodes.Children
getNode, getNodes, getNodesCount, isInitialized, nodes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

original

protected Node original
Original node. Should not be modified.
Constructor Detail

FilterNode.Children

public FilterNode.Children(Node or)
Create children.
Parameters:
or - original node to take children from
Method Detail

changeOriginal

protected final void changeOriginal(Node original)
Sets the original children for this children
Parameters:
orignal - The new original node.
Since:
1.39

finalize

protected void finalize()
Closes the listener, if any, on the original node.
Overrides:
finalize in class Object

clone

public Object clone()
Description copied from class: Children.Keys
Special handling for clonning.
Overrides:
clone in class Children.Keys
Following copied from class: org.openide.nodes.Children.Array
Returns:
the cloned array for this children

addNotify

protected void addNotify()
Initializes listening to changes in original node.
Overrides:
addNotify in class Children
Following copied from class: org.openide.nodes.Children
See Also:
Children.isInitialized()

removeNotify

protected void removeNotify()
Clears current keys, because all mirrored nodes disappeared.
Overrides:
removeNotify in class Children

copyNode

protected Node copyNode(Node node)
Allows subclasses to override creation of node representants for nodes in the mirrored children list. The default implementation simply uses Node.cloneNode().

Note that this method is only suitable for a 1-to-1 mirroring.

Parameters:
node - node to create copy of
Returns:
copy of the original node

findChild

public Node findChild(String name)
Description copied from class: Children
Find a child node by name. This may be overridden in subclasses to provide a more advanced way of finding the child, but the default implementation simply scans through the list of nodes to find the first one with the requested name.

Normally 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.

Overrides:
findChild in class Children
Following copied from class: org.openide.nodes.Children
Parameters:
name - (code) name of child node to find or null if any arbitrary child may be returned
Returns:
the node or null if it could not be found

createNodes

protected Node[] createNodes(Object key)
Create nodes representing copies of the original node's children. The default implementation returns exactly one representative for each original node, as returned by 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.
Overrides:
createNodes in class Children.Keys
Parameters:
key - the original child node
Returns:
zero or more nodes representing the original child node

add

public boolean add(Node[] arr)
Description copied from class: Children
Add nodes this container. 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.

Overrides:
add in class Children.Keys
Following copied from class: org.openide.nodes.Children
Parameters:
nodes - set of nodes to add to the list
Returns:
true if successfully added

remove

public boolean remove(Node[] arr)
Description copied from class: Children
Remove nodes from the list. Only nodes that are present are removed.
Overrides:
remove in class Children.Keys
Following copied from class: org.openide.nodes.Children
Parameters:
nodes - nodes to be removed
Returns:
true if the nodes could be removed

filterChildrenAdded

protected void filterChildrenAdded(NodeMemberEvent ev)
Called when the filter node adds a new child. The default implementation makes a corresponding change.
Parameters:
ev - info about the change

filterChildrenRemoved

protected void filterChildrenRemoved(NodeMemberEvent ev)
Called when the filter node removes a child. The default implementation makes a corresponding change.
Parameters:
ev - info about the change

filterChildrenReordered

protected void filterChildrenReordered(NodeReorderEvent ev)
Called when the filter node reorders its children. The default implementation makes a corresponding change.
Parameters:
ev - info about the change


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.