|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.util.AbstractContainer
com.vaadin.data.util.AbstractInMemoryContainer<IDTYPE,String,BeanItem<BEANTYPE>>
com.vaadin.data.util.AbstractBeanContainer<IDTYPE,BEANTYPE>
com.vaadin.data.util.BeanContainer<IDTYPE,BEANTYPE>
IDTYPE
- The type of the item identifierBEANTYPE
- The type of the Beanpublic class BeanContainer<IDTYPE,BEANTYPE>
An in-memory container for JavaBeans.
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.
In BeanContainer (unlike BeanItemContainer
), the item IDs do not have
to be the beans themselves. The container can be used either with explicit
item IDs or the item IDs can be generated when adding beans.
To use explicit item IDs, use the methods addItem(Object, Object)
,
addItemAfter(Object, Object, Object)
and
addItemAt(int, Object, Object)
.
If a bean id resolver is set using
setBeanIdResolver(com.vaadin.data.util.AbstractBeanContainer.BeanIdResolver)
or setBeanIdProperty(Object)
, the methods addBean(Object)
,
addBeanAfter(Object, Object)
, addBeanAt(int, Object)
and
addAll(java.util.Collection)
can be used to add items to the
container. If one of these methods is called, the resolver is used to
generate an identifier for the item (must not return null).
Note that explicit item identifiers can also be used when a resolver has been
set by calling the addItem*() methods - the resolver is only used when adding
beans using the addBean*() or addAll(Collection)
methods.
It is not possible to add additional properties to the container and nested bean properties are not supported.
AbstractBeanContainer
,
BeanItemContainer
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractBeanContainer |
---|
AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE>, AbstractBeanContainer.PropertyBasedBeanIdResolver |
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractContainer |
---|
AbstractContainer.BaseItemSetChangeEvent, AbstractContainer.BasePropertySetChangeEvent |
Constructor Summary | |
---|---|
BeanContainer(Class<? super BEANTYPE> type)
|
Method Summary | |
---|---|
void |
addAll(Collection<? extends BEANTYPE> collection)
Adds all the beans from a Collection in one operation using the
bean item identifier resolver. |
BeanItem<BEANTYPE> |
addBean(BEANTYPE bean)
Adds a bean to the container using the bean item id resolver to find its identifier. |
BeanItem<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. |
BeanItem<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. |
BeanItem<BEANTYPE> |
addItem(IDTYPE itemId,
BEANTYPE bean)
Adds the bean to the Container. |
BeanItem<BEANTYPE> |
addItemAfter(IDTYPE previousItemId,
IDTYPE newItemId,
BEANTYPE bean)
Adds the bean after the given item id. |
BeanItem<BEANTYPE> |
addItemAt(int index,
IDTYPE newItemId,
BEANTYPE bean)
Adds a new bean at the given index. |
void |
setBeanIdProperty(Object propertyId)
Sets the bean id resolver to use a property of the beans as the identifier. |
void |
setBeanIdResolver(AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> beanIdResolver)
Sets the resolver that finds the item id for a bean, or null not to use automatic resolving. |
Methods inherited from class com.vaadin.data.util.AbstractContainer |
---|
fireContainerPropertySetChange, fireContainerPropertySetChange, fireItemSetChange, fireItemSetChange, getItemSetChangeListeners, getListeners, getPropertySetChangeListeners, setItemSetChangeListeners, setPropertySetChangeListeners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Container.Ordered |
---|
addItemAfter, addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId |
Constructor Detail |
---|
public BeanContainer(Class<? super BEANTYPE> type)
Method Detail |
---|
public BeanItem<BEANTYPE> addItem(IDTYPE itemId, BEANTYPE bean)
addItem
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
Container.addItem(Object)
public BeanItem<BEANTYPE> addItemAfter(IDTYPE previousItemId, IDTYPE newItemId, BEANTYPE bean)
addItemAfter
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
Container.Ordered.addItemAfter(Object, Object)
public BeanItem<BEANTYPE> addItemAt(int index, IDTYPE newItemId, BEANTYPE bean)
addItemAt
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
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.
public void setBeanIdProperty(Object propertyId)
propertyId
- the identifier of the property to use to find item identifierspublic void setBeanIdResolver(AbstractBeanContainer.BeanIdResolver<IDTYPE,BEANTYPE> beanIdResolver)
AbstractBeanContainer
setBeanIdResolver
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
beanIdResolver
- to use or null to disable automatic id resolutionpublic BeanItem<BEANTYPE> addBean(BEANTYPE bean) throws IllegalStateException, IllegalArgumentException
AbstractBeanContainer
addBean
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
bean
- the bean to add
IllegalStateException
- if no bean identifier resolver has been set
IllegalArgumentException
- if an identifier cannot be resolved for the beanAbstractBeanContainer.addItem(Object, Object)
public BeanItem<BEANTYPE> addBeanAfter(IDTYPE previousItemId, BEANTYPE bean) throws IllegalStateException, IllegalArgumentException
AbstractBeanContainer
addBeanAfter
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
previousItemId
- the identifier of the bean after which this bean should be
added, null to add to the beginningbean
- the bean to add
IllegalStateException
- if no bean identifier resolver has been set
IllegalArgumentException
- if an identifier cannot be resolved for the beanAbstractBeanContainer.addItemAfter(Object, Object, Object)
public BeanItem<BEANTYPE> addBeanAt(int index, BEANTYPE bean) throws IllegalStateException, IllegalArgumentException
AbstractBeanContainer
addBeanAt
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
index
- the index (in the filtered view) at which to add the itembean
- the bean to add
IllegalStateException
- if no bean identifier resolver has been set
IllegalArgumentException
- if an identifier cannot be resolved for the beanAbstractBeanContainer.addItemAfter(Object, Object, Object)
public void addAll(Collection<? extends BEANTYPE> collection) throws IllegalStateException
AbstractBeanContainer
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.
addAll
in class AbstractBeanContainer<IDTYPE,BEANTYPE>
collection
- The collection of beans to add. Must not be null.
IllegalStateException
- if no bean identifier resolver has been set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |