if (isExpanded(itemId) && hasChildren(itemId)) { iteratorStack.push(getChildren(itemId).iterator());
/** * Collapses the items recursively. * * Collapse all the children recursively starting from an item. Operation * succeeds only if all expandable items are collapsed. * * @param startItemId * @return True if the collapse operation succeeded */ public boolean collapseItemsRecursively(Object startItemId) { boolean result = true; // Initial stack final Stack<Object> todo = new Stack<Object>(); todo.add(startItemId); // Collapse recursively while (!todo.isEmpty()) { final Object id = todo.pop(); if (areChildrenAllowed(id) && !collapseItem(id)) { result = false; } if (hasChildren(id)) { todo.addAll(getChildren(id)); } } return result; }
/** * Expands the items recursively * * Expands all the children recursively starting from an item. Operation * succeeds only if all expandable items are expanded. * * @param startItemId * @return True if the expand operation succeeded */ public boolean expandItemsRecursively(Object startItemId) { boolean result = true; // Initial stack final Stack<Object> todo = new Stack<Object>(); todo.add(startItemId); // Expands recursively while (!todo.isEmpty()) { final Object id = todo.pop(); if (areChildrenAllowed(id) && !expandItem(id, false)) { result = false; } if (hasChildren(id)) { todo.addAll(getChildren(id)); } } markAsDirty(); return result; }
if (isExpanded(itemId) && hasChildren(itemId) && areChildrenAllowed(itemId)) { iteratorStack.push(getChildren(itemId).iterator());
if (m_tree.hasChildren(itemToExpandId)) { return;