IDTYPE - The type of the item identifierBEANTYPE - The type of the Beanpublic abstract class MhuAbstractBeanContainer<IDTYPE,BEANTYPE> extends com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>> implements com.vaadin.data.Container.Filterable, com.vaadin.data.Container.SimpleFilterable, com.vaadin.data.Container.Sortable, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.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 |
MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE>
Resolver that maps beans to their (item) identifiers, removing the need
to explicitly specify item identifiers when there is no need to customize
this.
|
protected class |
MhuAbstractBeanContainer.PropertyBasedBeanIdResolver
A item identifier resolver that returns the value of a bean property.
|
com.vaadin.data.util.AbstractContainer.BaseItemSetChangeEvent, com.vaadin.data.util.AbstractContainer.BasePropertySetChangeEventcom.vaadin.data.Container.Editor, com.vaadin.data.Container.Filter, com.vaadin.data.Container.Filterable, com.vaadin.data.Container.Hierarchical, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeEvent, com.vaadin.data.Container.ItemSetChangeListener, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.Ordered, com.vaadin.data.Container.PropertySetChangeEvent, com.vaadin.data.Container.PropertySetChangeListener, com.vaadin.data.Container.PropertySetChangeNotifier, com.vaadin.data.Container.SimpleFilterable, com.vaadin.data.Container.Sortable, com.vaadin.data.Container.Viewer| Modifier and Type | Field and Description |
|---|---|
protected LinkedHashMap<String,MhuBeanItem.PojoPropertyDescriptor<BEANTYPE>> |
model
A description of the properties found in beans of type
type. |
| Modifier | Constructor and Description |
|---|---|
protected |
MhuAbstractBeanContainer(Class<? super BEANTYPE> type)
Constructs a
AbstractBeanContainer for beans of the given type. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAll(Collection<? extends BEANTYPE> collection)
Adds all the beans from a
Collection in one operation using the
bean item identifier resolver. |
protected MhuBeanItem<BEANTYPE> |
addBean(BEANTYPE bean)
Adds a bean to the container using the bean item id resolver to find its
identifier.
|
protected MhuBeanItem<BEANTYPE> |
addBeanAfter(IDTYPE previousItemId,
BEANTYPE bean)
Adds a bean to the container after a specified item identifier, using the
bean item id resolver to find its identifier.
|
protected MhuBeanItem<BEANTYPE> |
addBeanAt(int index,
BEANTYPE bean)
Adds a bean at a specified (filtered view) position in the container
using the bean item id resolver to find its identifier.
|
void |
addContainerFilter(com.vaadin.data.Container.Filter filter) |
void |
addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix) |
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue) |
protected MhuBeanItem<BEANTYPE> |
addItem(IDTYPE itemId,
BEANTYPE bean)
Adds the bean to the Container.
|
protected MhuBeanItem<BEANTYPE> |
addItemAfter(IDTYPE previousItemId,
IDTYPE newItemId,
BEANTYPE bean)
Adds the bean after the given bean.
|
protected MhuBeanItem<BEANTYPE> |
addItemAt(int index,
IDTYPE newItemId,
BEANTYPE bean)
Adds a new bean at the given index.
|
void |
addListener(com.vaadin.data.Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) |
void |
addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener listener) |
protected MhuBeanItem<BEANTYPE> |
createBeanItem(BEANTYPE bean)
Create a BeanItem for a bean using pre-parsed bean metadata (based on
getBeanType()). |
protected MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> |
createBeanPropertyResolver(Object propertyId)
Create an item identifier resolver using a named bean property.
|
MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> |
getBeanIdResolver()
Returns the resolver that finds the item ID for a bean.
|
Class<? super BEANTYPE> |
getBeanType()
Returns the type of beans this Container can contain.
|
Collection<com.vaadin.data.Container.Filter> |
getContainerFilters() |
com.vaadin.data.Property |
getContainerProperty(Object itemId,
Object propertyId) |
Collection<String> |
getContainerPropertyIds() |
MhuBeanItem<BEANTYPE> |
getItem(Object itemId) |
List<IDTYPE> |
getItemIds() |
com.vaadin.data.util.ItemSorter |
getItemSorter() |
Collection<?> |
getSortableContainerPropertyIds() |
Class<?> |
getType(Object propertyId) |
protected MhuBeanItem<BEANTYPE> |
getUnfilteredItem(Object itemId) |
boolean |
hasContainerFilters() |
protected boolean |
mergeAll(Collection<? extends BEANTYPE> collection,
boolean removeOverlapping,
Comparator<IDTYPE> comparator)
Merge all the beans from a
Collection in one operation using the
bean item identifier resolver. |
protected void |
registerNewItem(int position,
IDTYPE itemId,
MhuBeanItem<BEANTYPE> item) |
void |
removeAllContainerFilters() |
boolean |
removeAllItems() |
void |
removeContainerFilter(com.vaadin.data.Container.Filter filter) |
void |
removeContainerFilters(Object propertyId) |
boolean |
removeItem(Object itemId) |
void |
removeListener(com.vaadin.data.Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) |
void |
removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener listener) |
protected IDTYPE |
resolveBeanId(BEANTYPE bean)
Use the bean resolver to get the identifier for a bean.
|
protected void |
setBeanIdResolver(MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> beanIdResolver)
Sets the resolver that finds the item id for a bean, or null not to use
automatic resolving.
|
void |
setItemSorter(com.vaadin.data.util.ItemSorter itemSorter) |
void |
sort(Object[] propertyId,
boolean[] ascending) |
void |
valueChange(com.vaadin.data.Property.ValueChangeEvent event)
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, firstItemId, getAllItemIds, getFilteredItemIds, getFilters, getIdByIndex, getItemIds, getSortablePropertyIds, getVisibleItemIds, indexOfId, internalAddItemAfter, internalAddItemAt, internalAddItemAtEnd, internalRemoveAllItems, internalRemoveItem, isFiltered, isFirstId, isLastId, isPropertyFiltered, lastItemId, nextItemId, passesFilters, prevItemId, removeAllFilters, removeContainerProperty, 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, waitprotected LinkedHashMap<String,MhuBeanItem.PojoPropertyDescriptor<BEANTYPE>> model
type.
Determines the property ids that are present in the container.protected MhuAbstractBeanContainer(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)
getType in interface com.vaadin.data.Containerprotected MhuBeanItem<BEANTYPE> createBeanItem(BEANTYPE bean)
getBeanType()).bean - MhuBeanItem or null if bean is nullpublic Class<? super BEANTYPE> getBeanType()
public Collection<String> getContainerPropertyIds()
getContainerPropertyIds in interface com.vaadin.data.Containerpublic boolean removeAllItems()
removeAllItems in interface com.vaadin.data.ContainerremoveAllItems in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public MhuBeanItem<BEANTYPE> getItem(Object itemId)
getItem in interface com.vaadin.data.ContainergetItem in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>protected MhuBeanItem<BEANTYPE> getUnfilteredItem(Object itemId)
getUnfilteredItem in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public List<IDTYPE> getItemIds()
getItemIds in interface com.vaadin.data.ContainergetItemIds in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public com.vaadin.data.Property getContainerProperty(Object itemId, Object propertyId)
getContainerProperty in interface com.vaadin.data.Containerpublic boolean removeItem(Object itemId)
removeItem in interface com.vaadin.data.ContainerremoveItem in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public void valueChange(com.vaadin.data.Property.ValueChangeEvent event)
valueChange in interface com.vaadin.data.Property.ValueChangeListenerpublic void addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix)
addContainerFilter in interface com.vaadin.data.Container.SimpleFilterablepublic void removeAllContainerFilters()
removeAllContainerFilters in interface com.vaadin.data.Container.FilterableremoveAllContainerFilters in interface com.vaadin.data.Container.SimpleFilterablepublic void removeContainerFilters(Object propertyId)
removeContainerFilters in interface com.vaadin.data.Container.SimpleFilterablepublic void addContainerFilter(com.vaadin.data.Container.Filter filter)
throws com.vaadin.data.util.filter.UnsupportedFilterException
addContainerFilter in interface com.vaadin.data.Container.Filterablecom.vaadin.data.util.filter.UnsupportedFilterExceptionpublic void removeContainerFilter(com.vaadin.data.Container.Filter filter)
removeContainerFilter in interface com.vaadin.data.Container.Filterablepublic boolean hasContainerFilters()
hasContainerFilters in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public Collection<com.vaadin.data.Container.Filter> getContainerFilters()
getContainerFilters in interface com.vaadin.data.Container.FilterablegetContainerFilters in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public Collection<?> getSortableContainerPropertyIds()
getSortableContainerPropertyIds in interface com.vaadin.data.Container.Sortablepublic void sort(Object[] propertyId, boolean[] ascending)
sort in interface com.vaadin.data.Container.Sortablepublic com.vaadin.data.util.ItemSorter getItemSorter()
getItemSorter in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>public void setItemSorter(com.vaadin.data.util.ItemSorter itemSorter)
setItemSorter in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>protected void registerNewItem(int position,
IDTYPE itemId,
MhuBeanItem<BEANTYPE> item)
registerNewItem in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>protected MhuBeanItem<BEANTYPE> addItem(IDTYPE itemId, BEANTYPE bean)
Container.addItem(Object)protected MhuBeanItem<BEANTYPE> addItemAfter(IDTYPE previousItemId, IDTYPE newItemId, BEANTYPE bean)
Container.Ordered.addItemAfter(Object, Object)protected MhuBeanItem<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 MhuBeanItem<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 MhuBeanItem<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 MhuBeanItem<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(MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> beanIdResolver)
beanIdResolver - to use or null to disable automatic id resolutionpublic MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> getBeanIdResolver()
protected MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> createBeanPropertyResolver(Object propertyId)
propertyId - property identifier, which must map to a getter in BEANTYPE@Deprecated public void addListener(com.vaadin.data.Container.PropertySetChangeListener listener)
addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)addListener in interface com.vaadin.data.Container.PropertySetChangeNotifieraddListener in class com.vaadin.data.util.AbstractContainerpublic void addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener listener)
addPropertySetChangeListener in interface com.vaadin.data.Container.PropertySetChangeNotifieraddPropertySetChangeListener in class com.vaadin.data.util.AbstractContainer@Deprecated public void removeListener(com.vaadin.data.Container.PropertySetChangeListener listener)
removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)removeListener in interface com.vaadin.data.Container.PropertySetChangeNotifierremoveListener in class com.vaadin.data.util.AbstractContainerpublic void removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener listener)
removePropertySetChangeListener in interface com.vaadin.data.Container.PropertySetChangeNotifierremovePropertySetChangeListener in class com.vaadin.data.util.AbstractContainerpublic boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
addContainerProperty in interface com.vaadin.data.ContaineraddContainerProperty in class com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,MhuBeanItem<BEANTYPE>>UnsupportedOperationExceptionprotected boolean mergeAll(Collection<? extends BEANTYPE> collection, boolean removeOverlapping, Comparator<IDTYPE> comparator) throws IllegalStateException, IllegalArgumentException
Collection in one operation using the
bean item identifier resolver.
A bean id resolver must be set before calling this method.collection - The collection of beans to add. Must not be null.removeOverlapping - Remove beans out of the list which not included in the collection.comparator - Comparator to compare bean ids. Can be null to use default and maybe faster contains() method.IllegalStateException - if no bean identifier resolver has been setIllegalArgumentException - if the resolver returns a null itemId for one of the beans in
the collectionCopyright © 2015. All rights reserved.