public abstract class AbstractTreeNodeVisitor<T> extends java.lang.Object implements TreeVisitor
TreeVisitor.Acceptor, TreeVisitor.Action, TreeVisitor.ByComponent<C,T>, TreeVisitor.ByTreePath<T>
Constructor and Description |
---|
AbstractTreeNodeVisitor(java.util.function.Supplier<? extends T> supplier,
java.util.function.Predicate<? super javax.swing.tree.TreePath> predicate) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
contains(AbstractTreeNode node,
T element) |
protected T |
getContent(AbstractTreeNode node) |
T |
getElement() |
protected boolean |
isAncestor(T content,
T element) |
protected boolean |
matches(AbstractTreeNode node,
T element) |
TreeVisitor.Action |
visit(javax.swing.tree.TreePath path) |
protected TreeVisitor.Action |
visit(javax.swing.tree.TreePath path,
AbstractTreeNode node,
T element) |
protected static final Logger LOG
public AbstractTreeNodeVisitor(java.util.function.Supplier<? extends T> supplier, java.util.function.Predicate<? super javax.swing.tree.TreePath> predicate)
supplier
- that provides an element to search in a treepredicate
- that controls visiting children of found node:
null
to interrupt visiting,
true
to continue visiting with children,
false
to continue visiting without childrenpublic final T getElement()
null
if it is obsoletepublic TreeVisitor.Action visit(javax.swing.tree.TreePath path)
visit
in interface TreeVisitor
path
- a currently visited pathprotected TreeVisitor.Action visit(javax.swing.tree.TreePath path, AbstractTreeNode node, T element)
path
- a currently visited pathnode
- a node of a tree structureelement
- an element to findprotected boolean matches(AbstractTreeNode node, T element)
node
- a node of a tree structureelement
- an element to findtrue
if the specified node represents the given elementprotected boolean contains(AbstractTreeNode node, T element)
node
- a node of a tree structureelement
- an element to findtrue
if the specified node is an ancestor of the given elementprotected T getContent(AbstractTreeNode node)
node
- a node of a tree structurenull