BEANTYPE - The type of the Beanpublic class MhuBeanItemContainer<BEANTYPE> extends MhuAbstractBeanContainer<BEANTYPE,BEANTYPE>
The properties of the container are determined automatically by introspecting the used JavaBean class. Only beans of the same type can be added to the container.
BeanItemContainer uses the beans themselves as identifiers. The
Object.hashCode() of a bean is used when storing and looking up beans
so it must not change during the lifetime of the bean (it should not depend
on any part of the bean that can be modified). Typically this restricts the
implementation of Object.equals(Object) as well in order for it to
fulfill the contract between equals() and hashCode().
To add items to the container, use the methods addBean(Object),
MhuAbstractBeanContainer.addBeanAfter(Object, Object) and MhuAbstractBeanContainer.addBeanAt(int, Object).
Also addItem(Object), addItemAfter(Object, Object) and
addItemAt(int, Object) can be used as synonyms for them.
It is not possible to add additional properties to the container.
MhuAbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE>, MhuAbstractBeanContainer.PropertyBasedBeanIdResolvercom.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.Viewermodel| Constructor and Description |
|---|
MhuBeanItemContainer(Class<? super BEANTYPE> type)
Constructs a
BeanItemContainer for beans of the given type. |
MhuBeanItemContainer(Class<? super BEANTYPE> type,
Collection<? extends BEANTYPE> collection)
Constructs a
BeanItemContainer and adds the given beans to it. |
MhuBeanItemContainer(Collection<? extends BEANTYPE> collection)
Deprecated.
As of 6.5, use
#BeanItemContainer(Class, Collection)
instead |
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(Collection<? extends BEANTYPE> collection)
Adds all the beans from a
Collection in one go. |
MhuBeanItem<BEANTYPE> |
addBean(BEANTYPE bean)
Adds the bean to the Container.
|
MhuBeanItem<BEANTYPE> |
addItem(Object itemId)
Adds the bean to the Container.
|
MhuBeanItem<BEANTYPE> |
addItemAfter(Object previousItemId,
Object newItemId)
Adds the bean after the given bean.
|
MhuBeanItem<BEANTYPE> |
addItemAt(int index,
Object newItemId)
Adds a new bean at the given index.
|
void |
configureTableByAnnotations(com.vaadin.ui.Table table,
String schema,
de.mhus.lib.core.util.MNls nls) |
static com.vaadin.ui.Table.Align |
mapToVaadin(de.mhus.lib.annotations.vaadin.Align align) |
boolean |
mergeAll(Collection<? extends BEANTYPE> collection,
boolean remove,
Comparator<BEANTYPE> comparator)
Merge all the beans from a
Collection in one operation using the
bean item identifier resolver. |
void |
refresh() |
protected void |
setBeanIdResolver(MhuAbstractBeanContainer.BeanIdResolver<BEANTYPE,BEANTYPE> beanIdResolver)
Unsupported in BeanItemContainer.
|
addBeanAfter, addBeanAt, addContainerFilter, addContainerFilter, addContainerProperty, addItem, addItemAfter, addItemAt, addListener, addPropertySetChangeListener, createBeanItem, createBeanPropertyResolver, getBeanIdResolver, getBeanType, getContainerFilters, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getItemSorter, getSortableContainerPropertyIds, getType, getUnfilteredItem, hasContainerFilters, registerNewItem, removeAllContainerFilters, removeAllItems, removeContainerFilter, removeContainerFilters, removeItem, removeListener, removePropertySetChangeListener, resolveBeanId, setItemSorter, sort, valueChangeaddFilter, addItem, addItemAfter, 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, waitpublic MhuBeanItemContainer(Class<? super BEANTYPE> type) throws IllegalArgumentException
BeanItemContainer for beans of the given type.type - the type of the beans that will be added to the container.IllegalArgumentException - If type is null@Deprecated public MhuBeanItemContainer(Collection<? extends BEANTYPE> collection) throws IllegalArgumentException
#BeanItemContainer(Class, Collection)
insteadBeanItemContainer and adds the given beans to it.
The collection must not be empty.
MhuBeanItemContainer#BeanItemContainer(Class) can be used for
creating an initially empty BeanItemContainer.
Note that when using this constructor, the actual class of the first item
in the collection is used to determine the bean properties supported by
the container instance, and only beans of that class or its subclasses
can be added to the collection. If this is problematic or empty
collections need to be supported, use #BeanItemContainer(Class)
and addAll(Collection) instead.collection - a non empty Collection of beans.IllegalArgumentException - If the collection is null or empty.public MhuBeanItemContainer(Class<? super BEANTYPE> type, Collection<? extends BEANTYPE> collection) throws IllegalArgumentException
BeanItemContainer and adds the given beans to it.type - the type of the beans that will be added to the container.collection - a Collection of beans (can be empty or null).IllegalArgumentException - If type is nullpublic void refresh()
public void configureTableByAnnotations(com.vaadin.ui.Table table,
String schema,
de.mhus.lib.core.util.MNls nls)
public static com.vaadin.ui.Table.Align mapToVaadin(de.mhus.lib.annotations.vaadin.Align align)
public void addAll(Collection<? extends BEANTYPE> collection)
Collection in one go. More efficient
than adding them one by one.addAll in class MhuAbstractBeanContainer<BEANTYPE,BEANTYPE>collection - The collection of beans to add. Must not be null.public MhuBeanItem<BEANTYPE> addItemAfter(Object previousItemId, Object newItemId) throws IllegalArgumentException
addItemAfter in interface com.vaadin.data.Container.OrderedaddItemAfter in class com.vaadin.data.util.AbstractInMemoryContainer<BEANTYPE,String,MhuBeanItem<BEANTYPE>>previousItemId - the bean (of type BT) after which to add newItemIdnewItemId - the bean (of type BT) to add (not null)IllegalArgumentExceptionContainer.Ordered.addItemAfter(Object, Object)public MhuBeanItem<BEANTYPE> addItemAt(int index, Object newItemId) throws IllegalArgumentException
addItemAt in interface com.vaadin.data.Container.IndexedaddItemAt in class com.vaadin.data.util.AbstractInMemoryContainer<BEANTYPE,String,MhuBeanItem<BEANTYPE>>index - Index at which the bean should be added.newItemId - The bean to add to the container.IllegalArgumentExceptionpublic MhuBeanItem<BEANTYPE> addItem(Object itemId)
addItem in interface com.vaadin.data.ContaineraddItem in class com.vaadin.data.util.AbstractInMemoryContainer<BEANTYPE,String,MhuBeanItem<BEANTYPE>>Container.addItem(Object)public MhuBeanItem<BEANTYPE> addBean(BEANTYPE bean)
addBean in class MhuAbstractBeanContainer<BEANTYPE,BEANTYPE>bean - the bean to addContainer.addItem(Object)protected void setBeanIdResolver(MhuAbstractBeanContainer.BeanIdResolver<BEANTYPE,BEANTYPE> beanIdResolver) throws UnsupportedOperationException
setBeanIdResolver in class MhuAbstractBeanContainer<BEANTYPE,BEANTYPE>beanIdResolver - to use or null to disable automatic id resolutionUnsupportedOperationExceptionpublic boolean mergeAll(Collection<? extends BEANTYPE> collection, boolean remove, Comparator<BEANTYPE> comparator)
MhuAbstractBeanContainerCollection in one operation using the
bean item identifier resolver.
A bean id resolver must be set before calling this method.mergeAll in class MhuAbstractBeanContainer<BEANTYPE,BEANTYPE>collection - The collection of beans to add. Must not be null.remove - 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.Copyright © 2015. All rights reserved.