private static Node[] getChildren(Node n, OutlineView outlineView, boolean canExpand) { if (outlineView != null) { if (!outlineView.isExpanded(n)) { if (canExpand) { outlineView.expandNode(n); } else { return n.getChildren().getNodes(true); } } return getChildrenInDisplayedOrder(n, outlineView); } else { return n.getChildren().getNodes(true); } }