private void enumerateNodes(BaseUIComponent parent, List<Treenode> nodes) { for (Treenode child : parent.getChildren(Treenode.class)) { nodes.add(child); enumerateNodes(child, nodes); } }
/** * Returns the first visible child of a given class, if any. * * @param <T> The child class. * @param clazz The child class to consider. * @param recurse If true, all descendant levels are also searched using a breadth first * strategy. * @return The first visible child encountered, or null if not found. */ public <T extends BaseUIComponent> T getFirstVisibleChild(Class<T> clazz, boolean recurse) { for (T child : getChildren(clazz)) { if (child.isVisible()) { return child; } } if (recurse) { for (T child : getChildren(clazz)) { T comp = child.getFirstVisibleChild(clazz, recurse); if (comp != null) { return comp; } } } return null; }
/** * Returns true if any associated UI elements in the component subtree are visible. * * @param component Component subtree to examine. * @return True if any associated UI element in the subtree is visible. */ protected boolean hasVisibleElements(BaseUIComponent component) { for (BaseUIComponent child : component.getChildren(BaseUIComponent.class)) { ElementUI ele = getAssociatedElement(child); if (ele != null && ele.isVisible()) { return true; } if (hasVisibleElements(child)) { return true; } } return false; }