public interface PathFinder
LogicalViewProvider
.Modifier and Type | Method and Description |
---|---|
Node |
findPath(Node root,
Object target)
Try to find a given node in the logical view.
|
Node findPath(Node root, Object target)
private static boolean isAncestor(Node root, Node n) { if (n == null) return false; if (n == root) return true; return isAncestor(root, n.getParentNode()); } // ... Node root = ...; Object target = ...; LogicalViewProvider lvp = ...; Node n = lvp.findPath(root, target); if (n != null) { assert isAncestor(root, n); Lookup.Template tmpl = new Lookup.Template(null, null, target); Collection res = n.getLookup().lookup(tmpl).allInstances(); assert Collections.singleton(target).equals(new HashSet(res)); }
root
- a root node. E.g. a node from LogicalViewProvider.createLogicalView()
or some wapper
(FilterNode) around the node. The provider of the functionality is
responsible for finding the appropriate node in the wrapper's children.target
- a target cookie, such as a DataObject