Class FilterNode

A proxy for another node.
Unless otherwise mentioned, all methods of the original node are delegated to.
If desired, you can disable delegation of certain methods which are concrete in Node
by calling disableDelegation(int).

Note: it is fine to subclass this class and use
it to filter things. But please do not ever try to cast a node to
FilterNode: it probably means you are doing something
wrong. Instead, ask whatever Node you have for a proper
kind of cookie (e.g. DataObject).

disableDelegation

protected final void disableDelegation(int mask)

Disable delegation of a set of methods.
The methods will retain their behavior from Node.

For example, if you wish to subclass FilterNode, giving your
node a distinctive display name and tooltip, and performing some special
action upon deletion, you may do so without risk of affecting the original
node as follows:

changeOriginal

changeChildren - If set to true changes children
of this node according to the new original node. If you pass
children which are not instance of class
FilterNode.Children into the constructor set this
parameter to false. Be aware
that this method aquires
write lock on the nodes hierarchy (Children.MUTEX). Take care not to call this method
under read lock.

Throws:

IllegalStateException - if children which are not
instance of FilterNode.Children were passed
into the constructor and the method was called with the parameter
changeChildren set to true.

getContextActions

Get a special set of actions
for situations when this node is displayed as a context.

For example, right-clicking on a parent node in a hierarchical view (such as
the normal Explorer) should use getActions. However, if this node
is serving as the parent of a (say) a window tab full of icons (e.g., in
IconView), and the users right-clicks on
the empty space in this pane, then this method should be used to get
the appropriate actions for a context menu.

Note that in the Windows UI system, e.g., these action sets are quite different.

getPreferredAction

Gets the preferred action for this node.
This action can but need not to be one from the action array returned
from Node.getActions(boolean).
In case it is, the context menu created from those actions
is encouraged to highlight the preferred action.
Override in subclasses accordingly.

getHtmlDisplayName

Get a display name containing HTML markup. Note: If you subclass
FilterNode and override getDisplayName(), this method will
always return null unless you override it as well (assuming that if you're
changing the display name, you don't want an HTML display name constructed
from the original node's display name to be what shows up in views of
this node). If getDisplayName() is not overridden,
this method will return whatever the original node returns from this
method.

Note that if you do override getDisplayName, you should also override
this method to return null.

equals

Test equality of original nodes.
Note that for subclasses of FilterNode, or filter nodes with non-default children,
the test reverts to object identity.
Note: if you wish that the Index cookie works correctly on
filtered nodes and their subnodes, and you are subclassing FilterNode or
using non-default children, you will probably want to override this method to test
equality of the specified node with this filter node's original node; otherwise Move Up
and Move Down actions may be disabled.

Note though that it is often better to provide your own index cookie from a filter
node. Only then it is possible to change the number of children relative to the original.
And in many cases this is easier anyway, as for example with
DataFolder.Index for data folders.