Class HierarchicalContainerOrderedWrapper
- java.lang.Object
-
- com.vaadin.data.util.ContainerOrderedWrapper
-
- com.vaadin.data.util.HierarchicalContainerOrderedWrapper
-
- All Implemented Interfaces:
Container,Container.Hierarchical,Container.ItemSetChangeNotifier,Container.Ordered,Container.PropertySetChangeNotifier,Serializable
public class HierarchicalContainerOrderedWrapper extends ContainerOrderedWrapper implements Container.Hierarchical
A wrapper class for adding external ordering to containers not implementing theContainer.Orderedinterface while retainingContainer.Hierarchicalfeatures.- See Also:
ContainerOrderedWrapper, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.data.Container
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeEvent, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer
-
-
Constructor Summary
Constructors Constructor Description HierarchicalContainerOrderedWrapper(Container.Hierarchical toBeWrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareChildrenAllowed(Object itemId)Tests if the Item with given ID can have children.Collection<?>getChildren(Object itemId)Gets the IDs of all Items that are children of the specified Item.ObjectgetParent(Object itemId)Gets the ID of the parent Item of the specified Item.booleanhasChildren(Object itemId)Tests if the Item specified withitemIdhas child Items or if it is a leaf.booleanisRoot(Object itemId)Tests if the Item specified withitemIdis a root Item.Collection<?>rootItemIds()Gets the IDs of all Items in the container that don't have a parent.booleansetChildrenAllowed(Object itemId, boolean areChildrenAllowed)Sets the given Item's capability to have children.booleansetParent(Object itemId, Object newParentId)Sets the parent of an Item.-
Methods inherited from class com.vaadin.data.util.ContainerOrderedWrapper
addContainerProperty, addItem, addItem, addItemAfter, addItemAfter, addItemSetChangeListener, addListener, addListener, addPropertySetChangeListener, containsId, firstItemId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, isFirstId, isLastId, lastItemId, nextItemId, prevItemId, removeAllItems, removeContainerProperty, removeItem, removeItemSetChangeListener, removeListener, removeListener, removePropertySetChangeListener, size, updateOrderWrapper
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.data.Container
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, size
-
Methods inherited from interface com.vaadin.data.Container.Hierarchical
removeItem
-
-
-
-
Constructor Detail
-
HierarchicalContainerOrderedWrapper
public HierarchicalContainerOrderedWrapper(Container.Hierarchical toBeWrapped)
-
-
Method Detail
-
areChildrenAllowed
public boolean areChildrenAllowed(Object itemId)
Description copied from interface:Container.HierarchicalTests if the Item with given ID can have children.- Specified by:
areChildrenAllowedin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item in the container whose child capability is to be tested- Returns:
trueif the specified Item exists in the Container and it can have children,falseif it's not found from the container or it can't have children.
-
getChildren
public Collection<?> getChildren(Object itemId)
Description copied from interface:Container.HierarchicalGets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.- Specified by:
getChildrenin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item whose children the caller is interested in- Returns:
- An unmodifiable
collectioncontaining the IDs of all other Items that are children in the container hierarchy;nullif item does not have any children.
-
getParent
public Object getParent(Object itemId)
Description copied from interface:Container.HierarchicalGets the ID of the parent Item of the specified Item.- Specified by:
getParentin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item whose parent the caller wishes to find out.- Returns:
- the ID of the parent Item. Will be
nullif the specified Item is a root element.
-
hasChildren
public boolean hasChildren(Object itemId)
Description copied from interface:Container.HierarchicalTests if the Item specified with
itemIdhas child Items or if it is a leaf. TheContainer.Hierarchical.getChildren(Object itemId)method always returnsnullfor leaf Items.Note that being a leaf does not imply whether or not an Item is allowed to have children.
- Specified by:
hasChildrenin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item to be tested- Returns:
trueif the specified Item has children,falseif not (is a leaf)
-
isRoot
public boolean isRoot(Object itemId)
Description copied from interface:Container.HierarchicalTests if the Item specified withitemIdis a root Item. The hierarchical container can have more than one root and must have at least one unless it is empty. TheContainer.Hierarchical.getParent(Object itemId)method always returnsnullfor root Items.- Specified by:
isRootin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item whose root status is to be tested- Returns:
trueif the specified Item is a root,falseif not
-
rootItemIds
public Collection<?> rootItemIds()
Description copied from interface:Container.HierarchicalGets the IDs of all Items in the container that don't have a parent. Such items are calledrootItems. The returned collection is unmodifiable.- Specified by:
rootItemIdsin interfaceContainer.Hierarchical- Returns:
- An unmodifiable
collectioncontaining IDs of all root elements of the container
-
setChildrenAllowed
public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) throws UnsupportedOperationException
Description copied from interface:Container.HierarchicalSets the given Item's capability to have children. If the Item identified with
itemIdalready has children andis false this method fails andContainer.Hierarchical.areChildrenAllowed(Object)falseis returned.The children must be first explicitly removed with
Container.Hierarchical.setParent(Object itemId, Object newParentId)orContainer.removeItem(Object itemId).This operation is optional. If it is not implemented, the method always returns
false.- Specified by:
setChildrenAllowedin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the Item in the container whose child capability is to be setareChildrenAllowed- boolean value specifying if the Item can have children or not- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException
-
setParent
public boolean setParent(Object itemId, Object newParentId) throws UnsupportedOperationException
Description copied from interface:Container.HierarchicalSets the parent of an Item. The new parent item must exist and be able to have children. (
). It is also possible to detach a node from the hierarchy (and thus make it root) by setting the parentContainer.Hierarchical.areChildrenAllowed(Object)== truenull.This operation is optional.
- Specified by:
setParentin interfaceContainer.Hierarchical- Parameters:
itemId- ID of the item to be set as the child of the Item identified withnewParentIdnewParentId- ID of the Item that's to be the new parent of the Item identified withitemId- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException
-
-