Interface Container
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
Collapsible,Container.Filterable,Container.Hierarchical,Container.Indexed,Container.Ordered,Container.SimpleFilterable,Container.Sortable
- All Known Implementing Classes:
AbstractBeanContainer,AbstractContainer,AbstractInMemoryContainer,AbstractSelect,BeanContainer,BeanItemContainer,ComboBox,ContainerHierarchicalWrapper,ContainerOrderedWrapper,FilesystemContainer,GeneratedPropertyContainer,HierarchicalContainer,HierarchicalContainerOrderedWrapper,IndexedContainer,ListSelect,NativeSelect,OptionGroup,Select,SQLContainer,Table,Tree,TreeTable,TwinColSelect
@Deprecated public interface Container extends Serializable
Deprecated.As of 8.0, replaced byDataProviderA specialized set of identified Items. Basically the Container is a set of
Items, but it imposes certain constraints on its contents. These constraints state the following:- All Items in the Container must have the same number of Properties.
- All Items in the Container must have the same Property ID's (see
Item.getItemPropertyIds()). - All Properties in the Items corresponding to the same Property ID must have the same data type.
- All Items within a container are uniquely identified by their non-null IDs.
The Container can be visualized as a representation of a relational database table. Each Item in the Container represents a row in the table, and all cells in a column (identified by a Property ID) have the same data type. Note that as with the cells in a database table, no Property in a Container may be empty, though they may contain
nullvalues.Note that though uniquely identified, the Items in a Container are not necessarily
orderedorindexed.Containers can derive Item ID's from the item properties or use other, container specific or user specified identifiers.
If a container is
filteredorsorted, most of the the methods of the container interface and its subinterfaces (container size,containsId(Object), iteration and indices etc.) relate to the filtered and sorted view, not to the full container contents. See individual method javadoc for exceptions to this (adding and removing items).
The Container interface is split to several subinterfaces so that a class can implement only the ones it needs.
- Since:
- 3.0
- Author:
- Vaadin Ltd
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceContainer.EditorDeprecated.static interfaceContainer.FilterDeprecated.As of 8.0, the whole filtering feature is integrated intoDataProvider.static interfaceContainer.FilterableDeprecated.static interfaceContainer.HierarchicalDeprecated.SeeHierarchicalDataProviderand its implementations.static interfaceContainer.IndexedDeprecated.static interfaceContainer.ItemSetChangeEventDeprecated.static interfaceContainer.ItemSetChangeListenerDeprecated.static interfaceContainer.ItemSetChangeNotifierDeprecated.static interfaceContainer.OrderedDeprecated.static interfaceContainer.PropertySetChangeEventDeprecated.static interfaceContainer.PropertySetChangeListenerDeprecated.static interfaceContainer.PropertySetChangeNotifierDeprecated.static interfaceContainer.SimpleFilterableDeprecated.static interfaceContainer.SortableDeprecated.As of 8.0, sorting is integrated intoDataProviderandQuery.getSortOrders().static interfaceContainer.ViewerDeprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleanaddContainerProperty(Object propertyId, Class<?> type, Object defaultValue)Deprecated.Adds a new Property to all Items in the Container.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.booleancontainsId(Object itemId)Deprecated.Tests if the Container contains the specified Item.PropertygetContainerProperty(Object itemId, Object propertyId)Deprecated.Gets the Property identified by the given itemId and propertyId from the Container.Collection<?>getContainerPropertyIds()Deprecated.Gets the ID's of all Properties stored in the Container.ItemgetItem(Object itemId)Deprecated.Gets theItemwith the given Item ID from the Container.Collection<?>getItemIds()Deprecated.Gets the ID's of all visible (after filtering and sorting) Items stored in the Container.Class<?>getType(Object propertyId)Deprecated.Gets the data type of all Properties identified by the given Property ID.booleanremoveAllItems()Deprecated.Removes all Items from the Container.booleanremoveContainerProperty(Object propertyId)Deprecated.Removes a Property specified by the given Property ID from the Container.booleanremoveItem(Object itemId)Deprecated.Removes the Item identified byItemIdfrom the Container.intsize()Deprecated.Gets the number of visible Items in the Container.
-
-
-
Method Detail
-
getItem
Item getItem(Object itemId)
Deprecated.Gets theItemwith the given Item ID from the Container. If the Container does not contain the requested Item,nullis returned.Containers should not return Items that are filtered out.
-
getContainerPropertyIds
Collection<?> getContainerPropertyIds()
Deprecated.Gets the ID's of all Properties stored in the Container. The ID's cannot be modified through the returned collection.- Returns:
- unmodifiable collection of Property IDs
-
getItemIds
Collection<?> getItemIds()
Deprecated.Gets the ID's of all visible (after filtering and sorting) Items stored in the Container. The ID's cannot be modified through the returned collection.If the container is
Container.Ordered, the collection returned by this method should follow that order. If the container isContainer.Sortable, the items should be in the sorted order.Calling this method for large lazy containers can be an expensive operation and should be avoided when practical.
- Returns:
- unmodifiable collection of Item IDs
-
getContainerProperty
Property getContainerProperty(Object itemId, Object propertyId)
Deprecated.Gets the Property identified by the given itemId and propertyId from the Container. If the Container does not contain the item or it is filtered out, or the Container does not have the Property,nullis returned.- Parameters:
itemId- ID of the visible Item which contains the PropertypropertyId- ID of the Property to retrieve- Returns:
- Property with the given ID or
null
-
getType
Class<?> getType(Object propertyId)
Deprecated.Gets the data type of all Properties identified by the given Property ID.- Parameters:
propertyId- ID identifying the Properties- Returns:
- data type of the Properties
-
size
int size()
Deprecated.Gets the number of visible Items in the Container.Filtering can hide items so that they will not be visible through the container API.
- Returns:
- number of Items in the Container
-
containsId
boolean containsId(Object itemId)
Deprecated.Tests if the Container contains the specified Item.Filtering can hide items so that they will not be visible through the container API, and this method should respect visibility of items (i.e. only indicate visible items as being in the container) if feasible for the container.
- Parameters:
itemId- ID the of Item to be tested- Returns:
- boolean indicating if the Container holds the specified Item
-
addItem
Item addItem(Object itemId) throws UnsupportedOperationException
Deprecated.Creates 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.
- Parameters:
itemId- ID of the Item to be created- Returns:
- Created new Item, or
nullin case of a failure - Throws:
UnsupportedOperationException- if adding an item with an explicit item ID is not supported by the container
-
addItem
Object addItem() throws UnsupportedOperationException
Deprecated.Creates 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.
- Returns:
- ID of the newly created Item, or
nullin case of a failure - Throws:
UnsupportedOperationException- if adding an item without an explicit item ID is not supported by the container
-
removeItem
boolean removeItem(Object itemId) throws UnsupportedOperationException
Deprecated.Removes 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.
- Parameters:
itemId- ID of the Item to remove- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException- if the container does not support removing individual items
-
addContainerProperty
boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
Deprecated.Adds a new Property to all Items in the Container. The Property ID, data type and default value of the new Property are given as parameters.This functionality is optional.
- Parameters:
propertyId- ID of the Propertytype- Data type of the new PropertydefaultValue- The value all created Properties are initialized to- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException- if the container does not support explicitly adding container properties
-
removeContainerProperty
boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
Deprecated.Removes a Property specified by the given Property ID from the Container. Note that the Property will be removed from all Items in the Container.This functionality is optional.
- Parameters:
propertyId- ID of the Property to remove- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException- if the container does not support removing container properties
-
removeAllItems
boolean removeAllItems() throws UnsupportedOperationExceptionDeprecated.Removes all Items from the Container.Note that Property ID and type information is preserved. This functionality is optional.
- Returns:
trueif the operation succeeded,falseif not- Throws:
UnsupportedOperationException- if the container does not support removing all items
-
-