/** * Removes the Item identified by given itemId and all its children. * * @see #removeItem(Object) * @param itemId * the identifier of the Item to be removed * @return true if the operation succeeded */ public boolean removeItemRecursively(Object itemId) { return HierarchicalContainer.removeItemRecursively(this, itemId); }
/** * Removes the Item identified by given itemId and all its children. * * @see #removeItem(Object) * @param itemId * the identifier of the Item to be removed * @return true if the operation succeeded */ public boolean removeItemRecursively(Object itemId) { disableContentsChangeEvents(); try { return removeItemRecursively(this, itemId); } finally { enableAndFireContentsChangeEvents(); } }
/** * Removes the Item identified by given itemId and all its children from the * given Container. * * @param container * the container where the item is to be removed * @param itemId * the identifier of the Item to be removed * @return true if the operation succeeded */ public static boolean removeItemRecursively( Container.Hierarchical container, Object itemId) { boolean success = true; Collection<?> children2 = container.getChildren(itemId); if (children2 != null) { for (Object o : children2.toArray()) { boolean removeItemRecursively = removeItemRecursively(container, o); if (!removeItemRecursively) { success = false; } } } // remove the root of subtree if children where successfully removed if (success) { success = container.removeItem(itemId); } return success; }