/** * Expands the node if the node's state is not equal to "Not started" (i.e. it has been completed) * and selects it. Then, continues down it's children by calling this same method. * * <p>The recursion stops as soon as it gets to a node which has not been started. * * @param n The node down which to recurse */ private void openTreeToCurrentStateRecursivly(Node n) { if (n instanceof ActivityNode) { if (!((ActivityNode) n).getCompletionState().equals("Planned") && !((ActivityNode) n).getCompletionState().equals("Contingent") && !((ActivityNode) n).getCompletionState().equals("Precluded")) { try { em.setSelectedNodes(new Node[] {n}); } catch (PropertyVetoException ex) { Exceptions.printStackTrace(ex); } treeTableView.expandNode(n); } else { } } else { } for (Node child : n.getChildren().getNodes()) { openTreeToCurrentStateRecursivly(child); } }
/** * Causes the tree to open up and set the selection to the point of the first activity which is * set to "Not Started" -- i.e. the latest active point in workflow. */ private void openTreeToCurrentState() { openTreeToCurrentStateRecursivly(em.getRootContext()); }