|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.addon.jpacontainer.JPAContainer<T>
public class JPAContainer<T>
This is the main container class of JPAContainer (and the default
implementation of EntityContainer). You can use it in your
applications like so: In the example code,
EntityContainer<MyEntity> container = new JPAContainer<MyEntity>(
MyEntity.class);
container.setEntityProvider(myEntityProvider);
...
myTable.setContainerDataSource(container);
myEntityProvider is an
instance of an EntityProvider that, like the name suggests, is
responsible for providing the entities to the container. If the container
should be writable, the entity provider must implement the
MutableEntityProvider interface and if buffering is desired (i.e.
write-through turned off) the BatchableEntityProvider interface as
well. There are ready-made implementations of all these interfaces that can
be used out-of-the-box (check the See Also section of this Javadoc).
All sorting and filtering is handled by the entity provider, which in turn normally delegates it to the database. Therefore, only persistent properties can be filtered and/or sorted by.
It is possible to use JPAContainer as a hierarchical container if the entities in the container can be related to each other by means of a parent property. For example:
@Entity
public class Node {
...
@ManyToOne
private Node parent;
...
}
Note, however, that the implementation of HierarchicalEntityContainer
is still experimental and has some limitations. For example, the data is
always read directly from the entity provider regardless of whether buffering
is used or not. Therefore, this feature should be used with care in
production systems.
When using buffered mode, the following rules apply:
BatchableEntityProvider in the same order that they were
recorded.
Please note, that if an entity is modified twice or more, updates are
"merged". This is something that implementations of
BatchableEntityProvider need to be aware of.
Also note, that it is possible to use buffered mode even if the entities
returned from the entity provider are not explicitly detached (see
EntityProvider.isEntitiesDetached()), but this should be avoided
unless you know what you are doing.
LocalEntityProvider,
CachingLocalEntityProvider,
BatchableLocalEntityProvider,
Serialized Form| Nested Class Summary | |
|---|---|
class |
JPAContainer.AllItemsRefreshedEvent
|
class |
JPAContainer.AllItemsRemovedEvent
Event indicating that all the items have been removed from the container. |
class |
JPAContainer.ChangesCommittedEvent
Event indicating that the changes have been committed. |
class |
JPAContainer.ChangesDiscardedEvent
Event indicating that the changes have been discarded. |
class |
JPAContainer.ContainerSortedEvent
Event indicating that the container has been resorted. |
class |
JPAContainer.ItemAddedEvent
Event indicating that an item has been added to the container. |
class |
JPAContainer.ItemEvent
Abstract base class for events concerning single EntityItems. |
class |
JPAContainer.ItemNotFoundEvent
Event fired by containsId(java.lang.Object) when the
result is false and isContainsIdFiresItemSetChangeIfNotFound()
is true. |
class |
JPAContainer.ItemRemovedEvent
Event indicating that an item has been removed from the container. |
class |
JPAContainer.ItemUpdatedEvent
Event indicating that an item has been updated inside the container. |
class |
JPAContainer.ProviderChangedEvent
Event fired when a EntityProviderChangeEvent is received by the
container. |
| Nested classes/interfaces inherited from interface com.vaadin.addon.jpacontainer.AdvancedFilterable |
|---|
AdvancedFilterable.FiltersAppliedEvent<C extends com.vaadin.data.Container & AdvancedFilterable> |
| Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
|---|
com.vaadin.data.Buffered.SourceException |
| Constructor Summary | |
|---|---|
JPAContainer(Class<T> entityClass)
Creates a new JPAContainer instance for entities of class
entityClass. |
|
| Method Summary | |
|---|---|
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)
This functionality is not supported by this implementation. |
Object |
addEntity(T entity)
Adds a new entity to the container. |
Object |
addItem()
This functionality is not fully supported by this implementation. The implementation tries to call empty parameter constructor and add entity as such to database. |
com.vaadin.data.Item |
addItem(Object itemId)
This functionality is not supported by this implementation. |
Object |
addItemAfter(Object previousItemId)
This functionality is not supported by this implementation. |
com.vaadin.data.Item |
addItemAfter(Object previousItemId,
Object newItemId)
This functionality is not supported by this implementation. |
Object |
addItemAt(int index)
This functionality is not supported by this implementation. |
com.vaadin.data.Item |
addItemAt(int index,
Object newItemId)
This functionality is not supported by this implementation. |
void |
addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
|
void |
addListener(com.vaadin.data.Container.ItemSetChangeListener listener)
|
void |
addNestedContainerProperty(String nestedProperty)
Adds the nested property nestedProperty to the set of
properties. |
void |
applyFilters()
Applies the filters to the data, possibly causing the items in the container to change. |
boolean |
areChildrenAllowed(Object itemId)
|
void |
commit()
|
boolean |
containsId(Object itemId)
|
EntityItem<T> |
createEntityItem(T entity)
Creates a new EntityItem for entity without adding
it to the container. |
void |
discard()
|
protected boolean |
doContainsId(Object itemId)
|
protected EntityProvider<T> |
doGetEntityProvider()
Checks that the entity provider is not null and returns it. |
void |
entityProviderChange(EntityProviderChangeEvent<T> event)
Notifies the client that event has occurred. |
protected void |
fireContainerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent event)
Publishes event to all registered
ItemSetChangeListeners. |
Object |
firstItemId()
|
List<com.vaadin.data.Container.Filter> |
getAppliedFilters()
Gets the list of filters that are currently applied. |
protected com.vaadin.data.Container.Filter |
getAppliedFiltersAsConjunction()
Returns a conjunction (filter1 AND filter2 AND ... |
Collection<?> |
getChildren(Object itemId)
|
Collection<com.vaadin.data.Container.Filter> |
getContainerFilters()
|
com.vaadin.data.Property |
getContainerProperty(Object itemId,
Object propertyId)
|
Collection<String> |
getContainerPropertyIds()
|
Class<T> |
getEntityClass()
Gets the class of the entities that are/can be contained in this container. |
protected EntityClassMetadata<T> |
getEntityClassMetadata()
Gets the mapping metadata of the entity class. |
EntityProvider<T> |
getEntityProvider()
Gets the entity provider that is used for fetching and storing entities. |
Collection<Object> |
getFilterablePropertyIds()
Gets the IDs of all the properties that are filterable. |
List<com.vaadin.data.Container.Filter> |
getFilters()
Gets the list of filters to apply. |
Object |
getIdByIndex(int index)
|
EntityItem<T> |
getItem(Object itemId)
|
Collection<Object> |
getItemIds()
This impementation does not use lazy loading and performs bad when the number of items is large! Do not use unless you absolutely have to! |
List<?> |
getItemIds(int startIndex,
int numberOfItems)
|
Object |
getParent(Object itemId)
|
String |
getParentProperty()
Gets the name of the persistent property that contains the reference to the parent entity. |
PropertyKind |
getPropertyKind(Object propertyId)
|
QueryModifierDelegate |
getQueryModifierDelegate()
Gets the QueryModifierDelegate set for this container. |
Collection<String> |
getSortableContainerPropertyIds()
|
protected List<SortBy> |
getSortByList()
Gets all the properties that the items should be sorted by, if any. |
Class<?> |
getType(Object propertyId)
|
boolean |
hasChildren(Object itemId)
|
boolean |
hasUnappliedFilters()
Checks if there are filters that have not yet been applied, or applied filters that have been removed using #removeAllFilters() or
#removeFilter(com.vaadin.addon.jpacontainer.Filter) . |
int |
indexOfId(Object itemId)
This implementation does not use lazy loading and performs extremely bad when the number of items is large! Do not use unless you absolutely have to! |
boolean |
isApplyFiltersImmediately()
Returns whether the filters should be applied immediately when a filter is added or removed. |
boolean |
isAutoCommit()
Alias of Buffered#isWriteThrough() . |
boolean |
isBuffered()
|
boolean |
isContainsIdFiresItemSetChangeIfNotFound()
Returns whether the containsId(java.lang.Object) method will
fire an item set change event if it returns false. |
boolean |
isFilterable(Object propertyId)
Checks if propertyId is filterable. |
boolean |
isFireContainerItemSetChangeEvents()
Tests whether the container should fire an item set change event when it detects a change in the entity provider (such as an entity being added, updated or deleted). |
protected boolean |
isFireItemSetChangeOnProviderChange()
|
boolean |
isFirstId(Object itemId)
|
boolean |
isLastId(Object itemId)
|
boolean |
isModified()
|
boolean |
isReadOnly()
Returns whether the container is read only or writable. |
boolean |
isReadThrough()
|
boolean |
isRoot(Object itemId)
|
boolean |
isWriteThrough()
|
Object |
lastItemId()
|
Object |
nextItemId(Object itemId)
|
Object |
prevItemId(Object itemId)
|
void |
refresh()
Refreshes the entire container from the database. |
void |
refreshItem(Object itemId)
Causes all EntityItems created from this container and identified by given entityId to be refreshed. |
void |
removeAllContainerFilters()
|
boolean |
removeAllItems()
This feature is not well optimized. |
void |
removeContainerFilter(com.vaadin.data.Container.Filter filter)
|
void |
removeContainerFilters(Object propertyId)
|
boolean |
removeContainerProperty(Object propertyId)
|
boolean |
removeItem(Object itemId)
|
void |
removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
|
void |
removeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
|
protected void |
requireWritableContainer()
Checks that the container is writable, i.e. |
Collection<?> |
rootItemIds()
|
void |
setAdditionalFilterablePropertyIds(String... propertyIds)
Sometimes, it may be necessary to filter by properties that do not show up in the container. |
void |
setApplyFiltersImmediately(boolean applyFiltersImmediately)
Sets whether the filters should be applied immediately when a filter is added or removed. |
void |
setAutoCommit(boolean autoCommit)
Alias of Buffered#setWriteThrough(boolean) . |
void |
setBuffered(boolean buffered)
|
boolean |
setChildrenAllowed(Object itemId,
boolean areChildrenAllowed)
This functionality is not supported by this implementation. |
void |
setContainsIdFiresItemSetChangeIfNotFound(boolean value)
See isContainsIdFiresItemSetChangeIfNotFound(). |
void |
setEntityProvider(EntityProvider<T> entityProvider)
Sets the entity provider to use for fetching and storing entities. |
void |
setFireContainerItemSetChangeEvents(boolean value)
Specifies whether the container should fire an item set change event when it detects a change in the entity provider (such as an entity being added, updated or deleted). |
protected void |
setFireItemSetChangeOnProviderChange(boolean fireItemSetChangeOnProviderChange)
Specifies whether the container should fire an ItemSetChangeEvent when an EntityProviderChangeEvent is received. |
boolean |
setParent(Object itemId,
Object newParentId)
This functionality is not supported by this implementation. |
void |
setParentProperty(String parentProperty)
Sets the persistent property (may be nested) that contains the reference to the parent entity. |
void |
setQueryModifierDelegate(QueryModifierDelegate queryModifierDelegate)
Sets the QueryModifierDelegate, which is called in the different
stages that the EntityProvider builds a criteria query. |
void |
setReadOnly(boolean readOnly)
Changes the read only state of the container, if possible. |
void |
setReadThrough(boolean readThrough)
This functionality is not supported by this implementation. |
void |
setSortProperty(String propertyId,
String sortProperty)
Configures a property to be sortable based on another property, normally a sub-property of the main property to sort. |
void |
setWriteThrough(boolean writeThrough)
|
int |
size()
|
void |
sort(Object[] propertyId,
boolean[] ascending)
|
protected void |
updateFilterablePropertyIds()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JPAContainer(Class<T> entityClass)
JPAContainer instance for entities of class
entityClass. An entity provider must be provided using the
setEntityProvider(com.vaadin.addon.jpacontainer.EntityProvider)
before the container can be used.
entityClass - the class of the entities that will reside in this container
(must not be null).| Method Detail |
|---|
public void setAdditionalFilterablePropertyIds(String... propertyIds)
getFilterablePropertyIds() collection. This method
performs no propertyId validation, so it is up to the client to make sure
the propertyIds are valid.
propertyIds - an array of additional propertyIds, may be null.protected void updateFilterablePropertyIds()
protected EntityClassMetadata<T> getEntityClassMetadata()
EntityClassMetadatapublic void addListener(com.vaadin.data.Container.ItemSetChangeListener listener)
addListener in interface com.vaadin.data.Container.ItemSetChangeNotifierpublic void removeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
removeListener in interface com.vaadin.data.Container.ItemSetChangeNotifierprotected void fireContainerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent event)
event to all registered
ItemSetChangeListeners.
event - the event to publish (must not be null).public void setFireContainerItemSetChangeEvents(boolean value)
public boolean isFireContainerItemSetChangeEvents()
public void addNestedContainerProperty(String nestedProperty)
throws UnsupportedOperationException
EntityContainernestedProperty to the set of
properties. An asterisk can be used as a wildcard to indicate all
leaf-properties.
For example, let's say there is a property named address and
that this property's type in turn has the properties street,
postalCode and city.
If we want to be able to access the street property directly, we can add
the nested property address.street using this method.
However, if we want to add all the address properties, we can also use
address.*. This will cause the nested properties
address.street, address.postalCode and
address.city to be added to the set of properties.
Note, that the wildcard cannot be used in the middle of a chain of
property names. E.g. myprop.*.something is illegal.
Nested properties may be transient, but only persistent nested properties (i.e. embedded properties or ManyToOne references) may be used for filtering or sorting.
addNestedContainerProperty in interface EntityContainer<T>nestedProperty - the nested property to add (must not be null).
UnsupportedOperationException - if nested properties are not supported by the container.public Class<T> getEntityClass()
EntityContainer
getEntityClass in interface EntityContainer<T>public EntityProvider<T> getEntityProvider()
EntityContainer
getEntityProvider in interface EntityContainer<T>
protected EntityProvider<T> doGetEntityProvider()
throws IllegalStateException
IllegalStateException - if the entity provider was null.public boolean isReadOnly()
EntityContainer
isReadOnly in interface EntityContainer<T>public void setEntityProvider(EntityProvider<T> entityProvider)
EntityContainer
setEntityProvider in interface EntityContainer<T>entityProvider - the entity provider to use (must not be null).protected void setFireItemSetChangeOnProviderChange(boolean fireItemSetChangeOnProviderChange)
fireItemSetChangeOnProviderChange - true fo fire an ItemSetChangeEvent when the provider changes,
false not to.protected boolean isFireItemSetChangeOnProviderChange()
setFireItemSetChangeOnProviderChange(boolean)public void entityProviderChange(EntityProviderChangeEvent<T> event)
EntityProviderChangeListenerevent has occurred.
entityProviderChange in interface EntityProviderChangeListener<T>event - the occurred event (never null).
public void setReadOnly(boolean readOnly)
throws UnsupportedOperationException
EntityContainer
setReadOnly in interface EntityContainer<T>readOnly - true to make the container read only, false to make it
writable.
UnsupportedOperationException - if the read only state cannot be changed.
public void setSortProperty(String propertyId,
String sortProperty)
throws IllegalArgumentException
For example, let's say there is a property named address and
that this property's type in turn has the property street.
Addresses are not directly sortable as they are not simple properties.
If we want to be able to sort addresses based on the street property, we
can set the sort property for address to be
address.street using this method.
Normally the sort property should be of the form
propertyId + "." + subPropertyId. Sort properties must be
persistent and usable in JPQL, but need not be registered as separate
properties in the container.
Note that the sort property is not checked when this method is called. If it is not a valid sort property, an exception will be thrown when trying to sort a container.
propertyId - property for which sorting should be configuredsortProperty - property or other JPQL string that should be used when sorting
by propertyId is requested, typically a sub-property
propertyId
IllegalArgumentException - if the property propertyId is not in the
containerpublic Collection<String> getSortableContainerPropertyIds()
getSortableContainerPropertyIds in interface com.vaadin.data.Container.Sortable
public void sort(Object[] propertyId,
boolean[] ascending)
sort in interface com.vaadin.data.Container.Sortableprotected List<SortBy> getSortByList()
SortBy
instances (never null).
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException
addItemAfter in interface com.vaadin.data.Container.OrderedUnsupportedOperationException
public com.vaadin.data.Item addItemAfter(Object previousItemId,
Object newItemId)
throws UnsupportedOperationException
addItemAfter in interface com.vaadin.data.Container.OrderedUnsupportedOperationExceptionpublic Object firstItemId()
firstItemId in interface com.vaadin.data.Container.Orderedpublic boolean isFirstId(Object itemId)
isFirstId in interface com.vaadin.data.Container.Orderedpublic boolean isLastId(Object itemId)
isLastId in interface com.vaadin.data.Container.Orderedpublic Object lastItemId()
lastItemId in interface com.vaadin.data.Container.Orderedpublic Object nextItemId(Object itemId)
nextItemId in interface com.vaadin.data.Container.Orderedpublic Object prevItemId(Object itemId)
prevItemId in interface com.vaadin.data.Container.Ordered
public boolean addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
throws UnsupportedOperationException
addContainerProperty in interface com.vaadin.data.ContainerUnsupportedOperationException
public com.vaadin.data.Item addItem(Object itemId)
throws UnsupportedOperationException
addItem in interface com.vaadin.data.ContainerUnsupportedOperationException
public Object addItem()
throws UnsupportedOperationException
addItem in interface com.vaadin.data.ContainerUnsupportedOperationExceptionpublic boolean containsId(Object itemId)
containsId in interface com.vaadin.data.Containerpublic boolean isContainsIdFiresItemSetChangeIfNotFound()
containsId(java.lang.Object) method will
fire an item set change event if it returns false. This may be necessary
when using the container together with a Table and
there are multiple users modifying the same data source.
When a user selects an item in a Table, the table checks with the container if the item exists or not. If it does not exist, nothing happens. Normally, the item should always exist, but if the container has been changed after the initial set of items were fetched and cached by the table, there may be items in the Table that are not present in the container.
By enabling this flag, the Table will repaint itself if it tries to select a nonexistent item, causing the item to dissapear from the table as well.
public void setContainsIdFiresItemSetChangeIfNotFound(boolean value)
isContainsIdFiresItemSetChangeIfNotFound().
value - protected boolean doContainsId(Object itemId)
Container.containsId(java.lang.Object)
public com.vaadin.data.Property getContainerProperty(Object itemId,
Object propertyId)
getContainerProperty in interface com.vaadin.data.Containerpublic Collection<String> getContainerPropertyIds()
getContainerPropertyIds in interface com.vaadin.data.Containerpublic EntityItem<T> getItem(Object itemId)
Please note, that this method will create a new instance of
EntityItem upon every execution. That is, two subsequent calls to
this method with the same itemId will not return the
same EntityItem instance. The actual entity instance may still be
the same though, depending on the implementation of the entity provider.
getItem in interface EntityContainer<T>getItem in interface com.vaadin.data.Containerpublic Collection<Object> getItemIds()
getItemIds in interface com.vaadin.data.Containerpublic EntityItem<T> createEntityItem(T entity)
EntityContainerEntityItem for entity without adding
it to the container. This makes it possible to use the same
Form for editing both new entities and existing
entities.
To add the entity to the container, EntityContainer.addEntity(java.lang.Object)
should be used.
createEntityItem in interface EntityContainer<T>entity - the entity for which an item should be created.
EntityItem.getItemId()public Class<?> getType(Object propertyId)
getType in interface com.vaadin.data.Container
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException
removeContainerProperty in interface com.vaadin.data.ContainerUnsupportedOperationExceptionpublic int size()
size in interface com.vaadin.data.Containerprotected com.vaadin.data.Container.Filter getAppliedFiltersAsConjunction()
getAppliedFilters()public Collection<Object> getFilterablePropertyIds()
AdvancedFilterable
getFilterablePropertyIds in interface AdvancedFilterablepublic boolean isFilterable(Object propertyId)
AdvancedFilterablepropertyId is filterable.
isFilterable in interface AdvancedFilterablepropertyId - the property ID to check (must not be null).
public List<com.vaadin.data.Container.Filter> getFilters()
AdvancedFilterable
getFilters in interface AdvancedFilterablepublic List<com.vaadin.data.Container.Filter> getAppliedFilters()
AdvancedFilterableAdvancedFilterable.isApplyFiltersImmediately() returns true, this list will be the
same as the one returned by AdvancedFilterable.getFilters().
getAppliedFilters in interface AdvancedFilterablepublic void setApplyFiltersImmediately(boolean applyFiltersImmediately)
AdvancedFilterable
setApplyFiltersImmediately in interface AdvancedFilterableapplyFiltersImmediately - true to apply filters immediately, false to apply when
AdvancedFilterable.applyFilters() is called.AdvancedFilterable.isApplyFiltersImmediately()public boolean isApplyFiltersImmediately()
AdvancedFilterableAdvancedFilterable.applyFilters()
has to be called to apply the filters and update the container.
isApplyFiltersImmediately in interface AdvancedFilterableAdvancedFilterable.setApplyFiltersImmediately(boolean)public void applyFilters()
AdvancedFilterable
applyFilters in interface AdvancedFilterableAdvancedFilterable.FiltersAppliedEventpublic boolean hasUnappliedFilters()
AdvancedFilterable#removeAllFilters() or
#removeFilter(com.vaadin.addon.jpacontainer.Filter) .
If AdvancedFilterable.isApplyFiltersImmediately() is true, this method always
returns false.
hasUnappliedFilters in interface AdvancedFilterableAdvancedFilterable.applyFilters()
public void addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix)
EntityContainer
This method creates a new StringComparisonFilter for the
specified parameters and applies the filter immediately, regardless of
the state of AdvancedFilterable.isApplyFiltersImmediately().
addContainerFilter in interface EntityContainer<T>AdvancedFilterable.applyFilters()public void removeAllContainerFilters()
removeAllContainerFilters in interface com.vaadin.data.Container.Filterablepublic void removeContainerFilters(Object propertyId)
EntityContainer
The container is updated immediately regardless of the state of
AdvancedFilterable.isApplyFiltersImmediately().
removeContainerFilters in interface EntityContainer<T>
public void addContainerFilter(com.vaadin.data.Container.Filter filter)
throws com.vaadin.data.util.filter.UnsupportedFilterException
Note that JPAContainer don't support custom
Filters as filtering is done on DB level. Only basic Filter
implementations are supported. If more complex filtering is needed,
developers should tend to QueryModifierDelegate that allows
developers to use JPA Criteria API to modify queries.
addContainerFilter in interface com.vaadin.data.Container.Filterablecom.vaadin.data.util.filter.UnsupportedFilterExceptionContainer.Filterable.addContainerFilter(com.vaadin.data.Container.Filter)public void removeContainerFilter(com.vaadin.data.Container.Filter filter)
removeContainerFilter in interface com.vaadin.data.Container.Filterable
public Object addItemAt(int index)
throws UnsupportedOperationException
addItemAt in interface com.vaadin.data.Container.IndexedUnsupportedOperationException
public com.vaadin.data.Item addItemAt(int index,
Object newItemId)
throws UnsupportedOperationException
addItemAt in interface com.vaadin.data.Container.IndexedUnsupportedOperationExceptionpublic Object getIdByIndex(int index)
getIdByIndex in interface com.vaadin.data.Container.Indexedpublic int indexOfId(Object itemId)
indexOfId in interface com.vaadin.data.Container.Indexed
protected void requireWritableContainer()
throws IllegalStateException,
UnsupportedOperationException
MutableEntityProvider interface and the container
is not marked as read only.
IllegalStateException - if the container is read only.
UnsupportedOperationException - if the entity provider does not support editing.
public Object addEntity(T entity)
throws UnsupportedOperationException,
IllegalStateException
EntityContainerEntityItem
can then be accessed by calling EntityContainer.getItem(java.lang.Object) using
the entity identifier returned by this method.
If EntityContainer.isAutoCommit() is activated, the returned identifier is
always the actual entity ID. Otherwise, the returned identifier may,
depending on the ID generation strategy, be either the actual entity ID
or a temporary ID that is changed to the real ID once the changes have
been committed using Buffered.commit().
addEntity in interface EntityContainer<T>entity - the entity to add (must not be null).
UnsupportedOperationException - if the container does not support adding new entities at all.
IllegalStateException - if the container supports adding entities, but is currently
in read only mode.public boolean removeAllItems()
removeAllItems in interface com.vaadin.data.Container
public boolean removeItem(Object itemId)
throws UnsupportedOperationException
removeItem in interface com.vaadin.data.ContainerremoveItem in interface com.vaadin.data.Container.HierarchicalUnsupportedOperationException
public void commit()
throws com.vaadin.data.Buffered.SourceException,
com.vaadin.data.Validator.InvalidValueException
commit in interface com.vaadin.data.Bufferedcom.vaadin.data.Buffered.SourceException
com.vaadin.data.Validator.InvalidValueException
public void discard()
throws com.vaadin.data.Buffered.SourceException
discard in interface com.vaadin.data.Bufferedcom.vaadin.data.Buffered.SourceExceptionpublic boolean isModified()
isModified in interface com.vaadin.data.Bufferedpublic boolean isReadThrough()
public boolean isWriteThrough()
public void setReadThrough(boolean readThrough)
throws com.vaadin.data.Buffered.SourceException
com.vaadin.data.Buffered.SourceException
public void setWriteThrough(boolean writeThrough)
throws com.vaadin.data.Buffered.SourceException,
com.vaadin.data.Validator.InvalidValueException
Note, that write-through mode can only be turned off if the entity
provider implements the BatchableEntityProvider interface.
com.vaadin.data.Buffered.SourceException
com.vaadin.data.Validator.InvalidValueException
public void setAutoCommit(boolean autoCommit)
throws com.vaadin.data.Buffered.SourceException,
com.vaadin.data.Validator.InvalidValueException
EntityContainerBuffered#setWriteThrough(boolean) .
setAutoCommit in interface EntityContainer<T>com.vaadin.data.Buffered.SourceException
com.vaadin.data.Validator.InvalidValueExceptionpublic boolean isAutoCommit()
EntityContainerBuffered#isWriteThrough() .
isAutoCommit in interface EntityContainer<T>public String getParentProperty()
HierarchicalEntityContainer
getParentProperty in interface HierarchicalEntityContainer<T>public void setParentProperty(String parentProperty)
HierarchicalEntityContainer
setParentProperty in interface HierarchicalEntityContainer<T>parentProperty - the name of the parent property.public boolean areChildrenAllowed(Object itemId)
areChildrenAllowed in interface com.vaadin.data.Container.Hierarchicalpublic Collection<?> getChildren(Object itemId)
getChildren in interface com.vaadin.data.Container.Hierarchicalpublic Object getParent(Object itemId)
getParent in interface com.vaadin.data.Container.Hierarchicalpublic boolean hasChildren(Object itemId)
hasChildren in interface com.vaadin.data.Container.Hierarchicalpublic boolean isRoot(Object itemId)
isRoot in interface com.vaadin.data.Container.Hierarchicalpublic Collection<?> rootItemIds()
rootItemIds in interface com.vaadin.data.Container.Hierarchical
public boolean setChildrenAllowed(Object itemId,
boolean areChildrenAllowed)
throws UnsupportedOperationException
setChildrenAllowed in interface com.vaadin.data.Container.HierarchicalUnsupportedOperationException
public boolean setParent(Object itemId,
Object newParentId)
throws UnsupportedOperationException
setParent in interface com.vaadin.data.Container.HierarchicalUnsupportedOperationExceptionpublic PropertyKind getPropertyKind(Object propertyId)
getPropertyKind in interface EntityContainer<T>public void refreshItem(Object itemId)
EntityContainer
refreshItem in interface EntityContainer<T>EntityItem.refresh()public void refresh()
EntityContainer
refresh in interface EntityContainer<T>public QueryModifierDelegate getQueryModifierDelegate()
EntityContainer
getQueryModifierDelegate in interface EntityContainer<T>public void setQueryModifierDelegate(QueryModifierDelegate queryModifierDelegate)
QueryModifierDelegate, which is called in the different
stages that the EntityProvider builds a criteria query.
queryModifierDelegate - the delegate.public void setBuffered(boolean buffered)
setBuffered in interface com.vaadin.data.Bufferedpublic boolean isBuffered()
isBuffered in interface com.vaadin.data.Bufferedpublic void addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
addItemSetChangeListener in interface com.vaadin.data.Container.ItemSetChangeNotifierpublic void removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
removeItemSetChangeListener in interface com.vaadin.data.Container.ItemSetChangeNotifier
public List<?> getItemIds(int startIndex,
int numberOfItems)
getItemIds in interface com.vaadin.data.Container.Indexedpublic Collection<com.vaadin.data.Container.Filter> getContainerFilters()
getContainerFilters in interface com.vaadin.data.Container.Filterable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||