Class HierarchicalContainer
- java.lang.Object
-
- com.vaadin.v7.data.util.AbstractContainer
-
- com.vaadin.v7.data.util.AbstractInMemoryContainer<Object,Object,Item>
-
- com.vaadin.v7.data.util.IndexedContainer
-
- com.vaadin.v7.data.util.HierarchicalContainer
-
- All Implemented Interfaces:
Container,Container.Filterable,Container.Hierarchical,Container.Indexed,Container.ItemSetChangeNotifier,Container.Ordered,Container.PropertySetChangeNotifier,Container.SimpleFilterable,Container.Sortable,Property.ValueChangeNotifier,Serializable,Cloneable
@Deprecated public class HierarchicalContainer extends IndexedContainer implements Container.Hierarchical
Deprecated.Use an appropriate implementation ofHierarchicalDataProvidersuch asTreeDataProviderorAbstractBackEndHierarchicalDataProvider.A specialized Container whose contents can be accessed like it was a tree-like structure.- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.v7.data.util.IndexedContainer
IndexedContainer.ItemSetChangeEvent
-
Nested classes/interfaces inherited from class com.vaadin.v7.data.util.AbstractInMemoryContainer
AbstractInMemoryContainer.BaseItemAddEvent, AbstractInMemoryContainer.BaseItemRemoveEvent
-
Nested classes/interfaces inherited from class com.vaadin.v7.data.util.AbstractContainer
AbstractContainer.BaseItemSetChangeEvent, AbstractContainer.BasePropertySetChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.v7.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
-
Nested classes/interfaces inherited from interface com.vaadin.v7.data.Container.Indexed
Container.Indexed.ItemAddEvent, Container.Indexed.ItemRemoveEvent
-
-
Constructor Summary
Constructors Constructor Description HierarchicalContainer()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ObjectaddItem()Deprecated.Creates a new Item into the Container, and assign it an automatic ID.ItemaddItem(Object itemId)Deprecated.Creates a new Item with the given ID in the Container.booleanareChildrenAllowed(Object itemId)Deprecated.Tests if the Item with given ID can have children.protected booleandoFilterContainer(boolean hasFilters)Deprecated.Filters the data in the container and updates internal data structures.protected voiddoSort()Deprecated.Perform the sorting of the data structures in the container.protected voidfireItemSetChange(Container.ItemSetChangeEvent event)Deprecated.Sends an Item set change event to all registered interested listeners.Collection<?>getChildren(Object itemId)Deprecated.Gets the IDs of all Items that are children of the specified Item.ObjectgetParent(Object itemId)Deprecated.Gets the ID of the parent Item of the specified Item.booleanhasChildren(Object itemId)Deprecated.Tests if the Item specified withitemIdhas child Items or if it is a leaf.booleanisIncludeParentsWhenFiltering()Deprecated.Used to control how filtering works.booleanisRoot(Object itemId)Deprecated.Tests if the Item specified withitemIdis a root Item.voidmoveAfterSibling(Object itemId, Object siblingId)Deprecated.Moves a node (an Item) in the container immediately after a sibling node.protected booleanpassesFilters(Object itemId)Deprecated.Checks if the given itemId passes the filters set for the container.booleanremoveAllItems()Deprecated.Removes all Items from the Container.booleanremoveItem(Object itemId)Deprecated.Removes the Item identified byItemIdfrom the Container.static booleanremoveItemRecursively(Container.Hierarchical container, Object itemId)Deprecated.Removes the Item identified by given itemId and all its children from the given Container.booleanremoveItemRecursively(Object itemId)Deprecated.Removes the Item identified by given itemId and all its children.Collection<?>rootItemIds()Deprecated.Gets the IDs of all Items in the container that don't have a parent.booleansetChildrenAllowed(Object itemId, boolean childrenAllowed)Deprecated.Sets the given Item's capability to have children.voidsetIncludeParentsWhenFiltering(boolean includeParentsWhenFiltering)Deprecated.Controls how the filtering of the container works.booleansetParent(Object itemId, Object newParentId)Deprecated.Sets the parent of an Item.-
Methods inherited from class com.vaadin.v7.data.util.IndexedContainer
addContainerFilter, addContainerFilter, addContainerProperty, addItemAfter, addItemAfter, addItemAt, addItemAt, addListener, addListener, addPropertySetChangeListener, addValueChangeListener, clone, fireItemAdded, fireItemSetChange, getContainerFilters, getContainerProperty, getContainerPropertyIds, getItemSorter, getListeners, getSortableContainerPropertyIds, getType, getUnfilteredItem, hasContainerFilters, registerNewItem, removeAllContainerFilters, removeContainerFilter, removeContainerFilters, removeContainerProperty, removeListener, removeListener, removePropertySetChangeListener, removeValueChangeListener, setItemSorter, sort
-
Methods inherited from class com.vaadin.v7.data.util.AbstractInMemoryContainer
addFilter, addItemSetChangeListener, addListener, containsId, filterAll, fireItemRemoved, fireItemsAdded, fireItemsRemoved, firstItemId, getAllItemIds, getFilteredItemIds, getFilters, getFirstVisibleItem, getIdByIndex, getItem, getItemIds, getItemIds, getSortablePropertyIds, getVisibleItemIds, indexOfId, internalAddItemAfter, internalAddItemAt, internalAddItemAtEnd, internalRemoveAllItems, internalRemoveItem, isFiltered, isFirstId, isLastId, isPropertyFiltered, lastItemId, nextItemId, prevItemId, removeAllFilters, removeFilter, removeFilters, removeItemSetChangeListener, removeListener, setAllItemIds, setFilteredItemIds, setFilters, size, sortContainer
-
Methods inherited from class com.vaadin.v7.data.util.AbstractContainer
fireContainerPropertySetChange, fireContainerPropertySetChange, getItemSetChangeListeners, getPropertySetChangeListeners, setItemSetChangeListeners, setPropertySetChangeListeners
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.v7.data.Container
addContainerProperty, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeContainerProperty, size
-
Methods inherited from interface com.vaadin.v7.data.Container.Ordered
firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId
-
-
-
-
Method Detail
-
areChildrenAllowed
public boolean areChildrenAllowed(Object itemId)
Deprecated.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)
Deprecated.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)
Deprecated.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)
Deprecated.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)
Deprecated.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()
Deprecated.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 childrenAllowed)
Deprecated.Sets the given Item's capability to have children. If the Item identified with the itemId already has children and the areChildrenAllowed is false this method fails and
falseis returned; the children must be first explicitly removed withsetParent(Object itemId, Object newParentId)orContainer.removeItem(Object itemId).- Specified by:
setChildrenAllowedin interfaceContainer.Hierarchical- Parameters:
itemId- the ID of the Item in the container whose child capability is to be set.childrenAllowed- the boolean value specifying if the Item can have children or not.- Returns:
trueif the operation succeeded,falseif not
-
setParent
public boolean setParent(Object itemId, Object newParentId)
Deprecated.Sets the parent of an Item. The new parent item must exist and be able to have children. (
canHaveChildren(newParentId) == true). It is also possible to detach a node from the hierarchy (and thus make it root) by setting the parentnull.- Specified by:
setParentin interfaceContainer.Hierarchical- Parameters:
itemId- the ID of the item to be set as the child of the Item identified with newParentId.newParentId- the ID of the Item that's to be the new parent of the Item identified with itemId.- Returns:
trueif the operation succeeded,falseif not
-
moveAfterSibling
public void moveAfterSibling(Object itemId, Object siblingId)
Deprecated.Moves a node (an Item) in the container immediately after a sibling node. The two nodes must have the same parent in the container.- Parameters:
itemId- the identifier of the moved node (Item)siblingId- the identifier of the reference node (Item), after which the other node will be located
-
addItem
public Object addItem()
Deprecated.Description copied from class:IndexedContainerCreates a new Item into the Container, and assign it an automatic ID.The new ID is returned, or
nullif the operation fails. After a successful call you can use themethod to fetch the Item.getItemThis functionality is optional.
The item ID is generated from a sequence of Integers. The id of the first added item is 1.
- Specified by:
addItemin interfaceContainer- Overrides:
addItemin classIndexedContainer- Returns:
- ID of the newly created Item, or
nullin case of a failure
-
fireItemSetChange
protected void fireItemSetChange(Container.ItemSetChangeEvent event)
Deprecated.Description copied from class:AbstractContainerSends an Item set change event to all registered interested listeners.- Overrides:
fireItemSetChangein classAbstractContainer- Parameters:
event- the item set change event to send, optionally with additional information
-
addItem
public Item addItem(Object itemId)
Deprecated.Description copied from interface:ContainerCreates a new Item with the given ID in the Container.The new Item is returned, and it is ready to have its Properties modified. Returns
nullif the operation fails or the Container already contains a Item with the given ID.This functionality is optional.
- Specified by:
addItemin interfaceContainer- Overrides:
addItemin classIndexedContainer- Parameters:
itemId- ID of the Item to be created- Returns:
- Created new Item, or
nullin case of a failure
-
removeAllItems
public boolean removeAllItems()
Deprecated.Description copied from interface:ContainerRemoves all Items from the Container.Note that Property ID and type information is preserved. This functionality is optional.
- Specified by:
removeAllItemsin interfaceContainer- Overrides:
removeAllItemsin classIndexedContainer- Returns:
trueif the operation succeeded,falseif not
-
removeItem
public boolean removeItem(Object itemId)
Deprecated.Description copied from interface:ContainerRemoves the Item identified byItemIdfrom the Container.Containers that support filtering should also allow removing an item that is currently filtered out.
This functionality is optional.
- Specified by:
removeItemin interfaceContainer- Specified by:
removeItemin interfaceContainer.Hierarchical- Overrides:
removeItemin classIndexedContainer- Parameters:
itemId- ID of the Item to remove- Returns:
trueif the operation succeeded,falseif not
-
removeItemRecursively
public boolean removeItemRecursively(Object itemId)
Deprecated.Removes the Item identified by given itemId and all its children.- Parameters:
itemId- the identifier of the Item to be removed- Returns:
- true if the operation succeeded
- See Also:
removeItem(Object)
-
removeItemRecursively
public static boolean removeItemRecursively(Container.Hierarchical container, Object itemId)
Deprecated.Removes the Item identified by given itemId and all its children from the given Container.- Parameters:
container- the container where the item is to be removeditemId- the identifier of the Item to be removed- Returns:
- true if the operation succeeded
-
doSort
protected void doSort()
Deprecated.Description copied from class:AbstractInMemoryContainerPerform the sorting of the data structures in the container. This is invoked when theitemSorterhas been prepared for the sort operation. Typically this method callsCollections.sort(aCollection, getItemSorter())on all arrays (containing item ids) that need to be sorted.- Overrides:
doSortin classAbstractInMemoryContainer<Object,Object,Item>
-
isIncludeParentsWhenFiltering
public boolean isIncludeParentsWhenFiltering()
Deprecated.Used to control how filtering works. @seesetIncludeParentsWhenFiltering(boolean)for more information.- Returns:
- true if all parents for items that match the filter are included when filtering, false if only the matching items are included
-
setIncludeParentsWhenFiltering
public void setIncludeParentsWhenFiltering(boolean includeParentsWhenFiltering)
Deprecated.Controls how the filtering of the container works. Set this to true to make filtering include parents for all matched items in addition to the items themselves. Setting this to false causes the filtering to only include the matching items and make items with excluded parents into root items.- Parameters:
includeParentsWhenFiltering- true to include all parents for items that match the filter, false to only include the matching items
-
doFilterContainer
protected boolean doFilterContainer(boolean hasFilters)
Deprecated.Description copied from class:AbstractInMemoryContainerFilters the data in the container and updates internal data structures. This method should reset any internal data structures and then repopulate them soAbstractInMemoryContainer.getItemIds()and other methods only return the filtered items.- Overrides:
doFilterContainerin classAbstractInMemoryContainer<Object,Object,Item>- Parameters:
hasFilters- true if filters has been set for the container, false otherwise- Returns:
- true if the item set has changed as a result of the filtering
-
passesFilters
protected boolean passesFilters(Object itemId)
Deprecated.Description copied from class:AbstractInMemoryContainerChecks if the given itemId passes the filters set for the container. The caller should make sure the itemId exists in the container. For non-existing itemIds the behavior is undefined.- Overrides:
passesFiltersin classAbstractInMemoryContainer<Object,Object,Item>- Parameters:
itemId- An itemId that exists in the container.- Returns:
- true if the itemId passes all filters or no filters are set, false otherwise.
-
-