public List<String> getAllTitles() { List<String> result = new LinkedList<String>(); BreadthFirstSearch bfs = new BreadthFirstSearch(this); TreePath path; do { path = bfs.next(); if (path != null) { TreeNavigatorNode node = (TreeNavigatorNode) path.getLastPathComponent(); result.add(node.getTitle()); } } while (path != null); return result; }
public TreeNavigatorNode find(JComponent comp) { BreadthFirstSearch bfs = new BreadthFirstSearch(this); TreePath path; do { path = bfs.next(); if (path != null) { TreeNavigatorNode node = (TreeNavigatorNode) path.getLastPathComponent(); if (node.getComponent() == comp) { return node; } } } while (path != null); return null; }
/** * Returns the components managed by this <tt>TreeNavigatorModel</tt> in reverse BFS order * * @return */ public List<JComponent> getComponents() { LinkedList<JComponent> result = new LinkedList<JComponent>(); BreadthFirstSearch bfs = new BreadthFirstSearch(this); TreePath path; do { path = bfs.next(); if (path != null) { TreeNavigatorNode node = (TreeNavigatorNode) path.getLastPathComponent(); if (node.getComponent() != null) { result.addFirst(node.getComponent()); } } } while (path != null); return result; }