IDTYPE - The type of the item identifierBEANTYPE - The type of the BeanDataProvider@Deprecated public abstract class AbstractBeanContainer<IDTYPE,BEANTYPE> extends AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>> implements Container.Filterable, Container.SimpleFilterable, Container.Sortable, Property.ValueChangeListener, Container.PropertySetChangeNotifier
The properties of the container are determined automatically by introspecting the used JavaBean class and explicitly adding or removing properties is not supported. Only beans of the same type can be added to the container.
Subclasses should implement any public methods adding items to the container,
typically calling the protected methods addItem(Object, Object),
addItemAfter(Object, Object, Object) and
addItemAt(int, Object, Object).
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE>
Deprecated.
|
protected class |
AbstractBeanContainer.PropertyBasedBeanIdResolver
Deprecated.
|
AbstractInMemoryContainer.BaseItemAddEvent, AbstractInMemoryContainer.BaseItemRemoveEventAbstractContainer.BaseItemSetChangeEvent, AbstractContainer.BasePropertySetChangeEventContainer.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.ViewerContainer.Indexed.ItemAddEvent, Container.Indexed.ItemRemoveEvent| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBeanContainer(Class<? super BEANTYPE> type)
Deprecated.
Constructs a
AbstractBeanContainer for beans of the given type. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAll(Collection<? extends BEANTYPE> collection)
Deprecated.
Adds all the beans from a
Collection in one operation using the
bean item identifier resolver. |
protected BeanItem<BEANTYPE> |
addBean(BEANTYPE bean)
Deprecated.
Adds a bean to the container using the bean item id resolver to find its
identifier.
|
protected BeanItem<BEANTYPE> |
addBeanAfter(IDTYPE previousItemId,
BEANTYPE bean)
Deprecated.
Adds a bean to the container after a specified item identifier, using the
bean item id resolver to find its identifier.
|
protected BeanItem<BEANTYPE> |
addBeanAt(int index,
BEANTYPE bean)
Deprecated.
Adds a bean at a specified (filtered view) position in the container
using the bean item id resolver to find its identifier.
|
void |
addContainerFilter(Container.Filter filter)
Deprecated.
Adds a filter for the container.
|
void |
addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix)
Deprecated.
Add a filter for given property.
|
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Deprecated.
Adds a new Property to all Items in the Container.
|
protected boolean |
addContainerProperty(String propertyId,
VaadinPropertyDescriptor<BEANTYPE> propertyDescriptor)
Deprecated.
Adds a property for the container and all its items.
|
protected BeanItem<BEANTYPE> |
addItem(IDTYPE itemId,
BEANTYPE bean)
Deprecated.
Adds the bean to the Container.
|
protected BeanItem<BEANTYPE> |
addItemAfter(IDTYPE previousItemId,
IDTYPE newItemId,
BEANTYPE bean)
Deprecated.
Adds the bean after the given bean.
|
protected BeanItem<BEANTYPE> |
addItemAt(int index,
IDTYPE newItemId,
BEANTYPE bean)
Deprecated.
Adds a new bean at the given index.
|
void |
addListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addPropertySetChangeListener(com.vaadin.v7.data.Container.PropertySetChangeListener) |
void |
addNestedContainerBean(String propertyId)
Deprecated.
Adds a nested container properties for all sub-properties of a named
property to the container.
|
boolean |
addNestedContainerProperty(String propertyId)
Deprecated.
Adds a nested container property for the container, e.g.
|
void |
addPropertySetChangeListener(Container.PropertySetChangeListener listener)
Deprecated.
Implementation of the corresponding method in
PropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this. |
protected BeanItem<BEANTYPE> |
createBeanItem(BEANTYPE bean)
Deprecated.
Create a BeanItem for a bean using pre-parsed bean metadata (based on
getBeanType()). |
protected AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> |
createBeanPropertyResolver(Object propertyId)
Deprecated.
Create an item identifier resolver using a named bean property.
|
AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> |
getBeanIdResolver()
Deprecated.
Returns the resolver that finds the item ID for a bean.
|
Class<? super BEANTYPE> |
getBeanType()
Deprecated.
Returns the type of beans this Container can contain.
|
Collection<Container.Filter> |
getContainerFilters()
Deprecated.
Returns the filters which have been applied to the container.
|
Property |
getContainerProperty(Object itemId,
Object propertyId)
Deprecated.
Gets the Property identified by the given itemId and propertyId from the
Container.
|
Collection<String> |
getContainerPropertyIds()
Deprecated.
Gets the ID's of all Properties stored in the Container.
|
BeanItem<BEANTYPE> |
getItem(Object itemId)
Deprecated.
Gets the
Item with the given Item ID from the Container. |
List<IDTYPE> |
getItemIds()
Deprecated.
Gets the ID's of all visible (after filtering and sorting) Items stored
in the Container.
|
ItemSorter |
getItemSorter()
Deprecated.
Returns the ItemSorter used for comparing items in a sort.
|
Collection<?> |
getSortableContainerPropertyIds()
Deprecated.
Gets the container property IDs which can be used to sort the items.
|
Class<?> |
getType(Object propertyId)
Deprecated.
Gets the data type of all Properties identified by the given Property ID.
|
protected BeanItem<BEANTYPE> |
getUnfilteredItem(Object itemId)
Deprecated.
Get an item even if filtered out.
|
boolean |
hasContainerFilters()
Deprecated.
Returns true if any filters have been applied to the container.
|
protected void |
registerNewItem(int position,
IDTYPE itemId,
BeanItem<BEANTYPE> item)
Deprecated.
Registers a new item as having been added to the container.
|
void |
removeAllContainerFilters()
Deprecated.
Remove all active filters from the container.
|
boolean |
removeAllItems()
Deprecated.
Removes all Items from the Container.
|
void |
removeContainerFilter(Container.Filter filter)
Deprecated.
Removes a filter from the container.
|
void |
removeContainerFilters(Object propertyId)
Deprecated.
Remove all filters from the given property.
|
boolean |
removeContainerProperty(Object propertyId)
Deprecated.
Removes a Property specified by the given Property ID from the Container.
|
boolean |
removeItem(Object itemId)
Deprecated.
Removes the Item identified by
ItemId from the Container. |
void |
removeListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removePropertySetChangeListener(Container.PropertySetChangeListener) |
void |
removePropertySetChangeListener(Container.PropertySetChangeListener listener)
Deprecated.
Implementation of the corresponding method in
PropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this. |
protected IDTYPE |
resolveBeanId(BEANTYPE bean)
Deprecated.
Use the bean resolver to get the identifier for a bean.
|
protected void |
setBeanIdResolver(AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> beanIdResolver)
Deprecated.
Sets the resolver that finds the item id for a bean, or null not to use
automatic resolving.
|
void |
setItemSorter(ItemSorter itemSorter)
Deprecated.
Sets the ItemSorter used for comparing items in a sort.
|
void |
sort(Object[] propertyId,
boolean[] ascending)
Deprecated.
Sorts the container items.
|
void |
valueChange(Property.ValueChangeEvent event)
Deprecated.
Re-filter the container when one of the monitored properties changes.
|
addFilter, addItem, addItem, addItemAfter, addItemAfter, addItemAt, addItemAt, addItemSetChangeListener, addListener, containsId, doFilterContainer, doSort, filterAll, fireItemAdded, fireItemRemoved, fireItemsAdded, fireItemsRemoved, firstItemId, getAllItemIds, getFilteredItemIds, getFilters, getFirstVisibleItem, getIdByIndex, getItemIds, getSortablePropertyIds, getVisibleItemIds, indexOfId, internalAddItemAfter, internalAddItemAt, internalAddItemAtEnd, internalRemoveAllItems, internalRemoveItem, isFiltered, isFirstId, isLastId, isPropertyFiltered, lastItemId, nextItemId, passesFilters, prevItemId, removeAllFilters, removeFilter, removeFilters, removeItemSetChangeListener, removeListener, setAllItemIds, setFilteredItemIds, setFilters, size, sortContainerfireContainerPropertySetChange, fireContainerPropertySetChange, fireItemSetChange, fireItemSetChange, getItemSetChangeListeners, getListeners, getPropertySetChangeListeners, setItemSetChangeListeners, setPropertySetChangeListenersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddItemAfter, addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemIdaddItem, addItem, containsId, sizeprotected AbstractBeanContainer(Class<? super BEANTYPE> type)
AbstractBeanContainer for beans of the given type.type - the type of the beans that will be added to the container.IllegalArgumentException - If type is nullpublic Class<?> getType(Object propertyId)
Containerprotected BeanItem<BEANTYPE> createBeanItem(BEANTYPE bean)
getBeanType()).bean - BeanItem or null if bean is nullpublic Class<? super BEANTYPE> getBeanType()
public Collection<String> getContainerPropertyIds()
ContainergetContainerPropertyIds in interface Containerpublic boolean removeAllItems()
ContainerNote that Property ID and type information is preserved. This functionality is optional.
removeAllItems in interface ContainerremoveAllItems in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>true if the operation succeeded, false
if notpublic BeanItem<BEANTYPE> getItem(Object itemId)
ContainerItem with the given Item ID from the Container. If the
Container does not contain the requested Item, null is
returned.
Containers should not return Items that are filtered out.
protected BeanItem<BEANTYPE> getUnfilteredItem(Object itemId)
AbstractInMemoryContainergetUnfilteredItem in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>public List<IDTYPE> getItemIds()
Container
If the container is Container.Ordered, the collection returned by this
method should follow that order. If the container is Container.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.
getItemIds in interface ContainergetItemIds in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>public Property getContainerProperty(Object itemId, Object propertyId)
Containernull is
returned.getContainerProperty in interface ContaineritemId - ID of the visible Item which contains the PropertypropertyId - ID of the Property to retrievenullpublic boolean removeItem(Object itemId)
ContainerItemId from the Container.
Containers that support filtering should also allow removing an item that is currently filtered out.
This functionality is optional.
removeItem in interface ContainerremoveItem in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>itemId - ID of the Item to removetrue if the operation succeeded, false
if notpublic void valueChange(Property.ValueChangeEvent event)
valueChange in interface Property.ValueChangeListenerevent - value change event objectpublic void addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix)
Container.SimpleFilterable
The API Filterable#addContainerFilter(Filter) is recommended
instead of this method. A SimpleStringFilter can be used with
the new API to implement the old string filtering functionality.
The filter accepts items for which toString() of the value of the given property contains or starts with given filterString. Other items are not visible in the container when filtered.
If a container has multiple filters, only items accepted by all filters are visible.
addContainerFilter in interface Container.SimpleFilterablepropertyId - Property for which the filter is applied to.filterString - String that must match the value of the propertyignoreCase - Determine if the casing can be ignored when comparing
strings.onlyMatchPrefix - Only match prefixes; no other matches are included.public void removeAllContainerFilters()
Container.FilterableremoveAllContainerFilters in interface Container.FilterableremoveAllContainerFilters in interface Container.SimpleFilterablepublic void removeContainerFilters(Object propertyId)
Container.SimpleFilterableremoveContainerFilters in interface Container.SimpleFilterablepropertyId - for which to remove filterspublic void addContainerFilter(Container.Filter filter) throws UnsupportedFilterException
Container.FilterableIf a container has multiple filters, only items accepted by all filters are visible.
addContainerFilter in interface Container.FilterableUnsupportedFilterException - if the filter is not supported by the containerpublic void removeContainerFilter(Container.Filter filter)
Container.FilterableThis requires that the equals() method considers the filters as equivalent (same instance or properly implemented equals() method).
removeContainerFilter in interface Container.Filterablepublic boolean hasContainerFilters()
AbstractInMemoryContainerhasContainerFilters in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>public Collection<Container.Filter> getContainerFilters()
Container.FilterablegetContainerFilters in interface Container.FilterablegetContainerFilters in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>public Collection<?> getSortableContainerPropertyIds()
Container.SortablegetSortableContainerPropertyIds in interface Container.Sortablepublic void sort(Object[] propertyId, boolean[] ascending)
Container.SortableSorting a container can irreversibly change the order of its items or only change the order temporarily, depending on the container.
sort in interface Container.SortablepropertyId - Array of container property IDs, whose values are used to
sort the items in container as primary, secondary, ...
sorting criterion. All of the item IDs must be in the
collection returned by
Container.Sortable.getSortableContainerPropertyIds()ascending - Array of sorting order flags corresponding to each
property ID used in sorting. If this array is shorter than
propertyId array, ascending order is assumed for items
where the order is not specified. Use true to
sort in ascending order, false to use
descending order.public ItemSorter getItemSorter()
AbstractInMemoryContainerAbstractInMemoryContainer.setItemSorter(ItemSorter) for more information.getItemSorter in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>public void setItemSorter(ItemSorter itemSorter)
AbstractInMemoryContainerItemSorter.compare(Object, Object) method is called with item ids
to perform the sorting. A default ItemSorter is used if this is not
explicitly set.setItemSorter in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>itemSorter - The ItemSorter used for comparing two items in a sort (not
null).protected void registerNewItem(int position,
IDTYPE itemId,
BeanItem<BEANTYPE> item)
AbstractInMemoryContainerAbstractInMemoryContainer has already
been updated to reflect the new item when this method is called.registerNewItem in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>protected BeanItem<BEANTYPE> addItem(IDTYPE itemId, BEANTYPE bean)
Container.addItem(Object)protected BeanItem<BEANTYPE> addItemAfter(IDTYPE previousItemId, IDTYPE newItemId, BEANTYPE bean)
Container.Ordered#addItemAfter(Object, Object)protected BeanItem<BEANTYPE> addItemAt(int index, IDTYPE newItemId, BEANTYPE bean)
index - Index at which the bean should be added.newItemId - The item id for the bean to add to the container.bean - The bean to add to the container.protected BeanItem<BEANTYPE> addBean(BEANTYPE bean) throws IllegalStateException, IllegalArgumentException
bean - the bean to addIllegalStateException - if no bean identifier resolver has been setIllegalArgumentException - if an identifier cannot be resolved for the beanaddItem(Object, Object)protected BeanItem<BEANTYPE> addBeanAfter(IDTYPE previousItemId, BEANTYPE bean) throws IllegalStateException, IllegalArgumentException
previousItemId - the identifier of the bean after which this bean should be
added, null to add to the beginningbean - the bean to addIllegalStateException - if no bean identifier resolver has been setIllegalArgumentException - if an identifier cannot be resolved for the beanaddItemAfter(Object, Object, Object)protected BeanItem<BEANTYPE> addBeanAt(int index, BEANTYPE bean) throws IllegalStateException, IllegalArgumentException
index - the index (in the filtered view) at which to add the itembean - the bean to addIllegalStateException - if no bean identifier resolver has been setIllegalArgumentException - if an identifier cannot be resolved for the beanaddItemAfter(Object, Object, Object)protected void addAll(Collection<? extends BEANTYPE> collection) throws IllegalStateException, IllegalArgumentException
Collection in one operation using the
bean item identifier resolver. More efficient than adding them one by
one.
A bean id resolver must be set before calling this method.
Note: the behavior of this method changed in Vaadin 6.6 - now items are
added at the very end of the unfiltered container and not after the last
visible item if filtering is used.collection - The collection of beans to add. Must not be null.IllegalStateException - if no bean identifier resolver has been setIllegalArgumentException - if the resolver returns a null itemId for one of the beans in
the collectionprotected IDTYPE resolveBeanId(BEANTYPE bean)
bean - IllegalStateException - if no bean resolver is setprotected void setBeanIdResolver(AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> beanIdResolver)
beanIdResolver - to use or null to disable automatic id resolutionpublic AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> getBeanIdResolver()
protected AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> createBeanPropertyResolver(Object propertyId)
propertyId - property identifier, which must map to a getter in BEANTYPE@Deprecated public void addListener(Container.PropertySetChangeListener listener)
addPropertySetChangeListener(com.vaadin.v7.data.Container.PropertySetChangeListener)addListener in interface Container.PropertySetChangeNotifieraddListener in class AbstractContainerpublic void addPropertySetChangeListener(Container.PropertySetChangeListener listener)
AbstractContainerPropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this.addPropertySetChangeListener in interface Container.PropertySetChangeNotifieraddPropertySetChangeListener in class AbstractContainerlistener - The new Listener to be registeredPropertySetChangeNotifier#addListener(Container.PropertySetChangeListener)@Deprecated public void removeListener(Container.PropertySetChangeListener listener)
removePropertySetChangeListener(Container.PropertySetChangeListener)removeListener in interface Container.PropertySetChangeNotifierremoveListener in class AbstractContainerpublic void removePropertySetChangeListener(Container.PropertySetChangeListener listener)
AbstractContainerPropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this.removePropertySetChangeListener in interface Container.PropertySetChangeNotifierremovePropertySetChangeListener in class AbstractContainerlistener - Listener to be removedPropertySetChangeNotifier#removeListener(Container.
PropertySetChangeListener)public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
ContainerThis functionality is optional.
addContainerProperty in interface ContaineraddContainerProperty in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>propertyId - ID of the Propertytype - Data type of the new PropertydefaultValue - The value all created Properties are initialized totrue if the operation succeeded, false
if notUnsupportedOperationException - if the container does not support explicitly adding container
propertiesprotected final boolean addContainerProperty(String propertyId, VaadinPropertyDescriptor<BEANTYPE> propertyDescriptor)
propertyId - propertyDescriptor - public boolean addNestedContainerProperty(String propertyId)
propertyId - NestedMethodPropertypublic void addNestedContainerBean(String propertyId)
propertyId - NestedMethodProperty,
addNestedContainerProperty(String)public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
ContainerThis functionality is optional.
removeContainerProperty in interface ContainerremoveContainerProperty in class AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>propertyId - ID of the Property to removetrue if the operation succeeded, false
if notUnsupportedOperationException - if the container does not support removing container
propertiesCopyright © 2019 Vaadin Ltd. All rights reserved.