|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.addon.jpacontainer.JPAContainerItem<T>
public final class JPAContainerItem<T>
EntityItem-implementation that is used by JPAContainer.
Should not be used directly by clients.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.vaadin.data.Item |
|---|
com.vaadin.data.Item.Editor, com.vaadin.data.Item.PropertySetChangeEvent, com.vaadin.data.Item.PropertySetChangeListener, com.vaadin.data.Item.PropertySetChangeNotifier, com.vaadin.data.Item.Viewer |
| Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
|---|
com.vaadin.data.Buffered.SourceException |
| Method Summary | |
|---|---|
boolean |
addItemProperty(Object id,
com.vaadin.data.Property property)
This functionality is not supported. |
void |
addListener(com.vaadin.data.Property.ValueChangeListener listener)
Registers a new value change listener for all the properties of this item. |
void |
addNestedContainerProperty(String nestedProperty)
Originally, all nested properties are inherited from the EntityContainer. |
void |
addValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
|
void |
commit()
|
void |
discard()
|
EntityContainer<T> |
getContainer()
Gets the container that contains this item. |
T |
getEntity()
Gets the underlying entity instance that contains the actual data being accessed by this item. |
Object |
getItemId()
Gets the item ID of the item. |
EntityItemProperty |
getItemProperty(Object id)
|
Collection<String> |
getItemPropertyIds()
|
boolean |
isBuffered()
|
boolean |
isDeleted()
Checks whether this item has been marked for deletion. |
boolean |
isDirty()
Checks whether the underlying entity (returned by EntityItem.getEntity())
has been modified after it was fetched from the entity provider. |
boolean |
isModified()
When using item-level buffering, this method tests whether there are changes made to the EntityItem that have not yet been committed to the underlying Entity ( EntityItem.getEntity()). |
boolean |
isPersistent()
Checks if the underlying entity ( EntityItem.getEntity()) is persistent
(i.e. |
boolean |
isReadThrough()
|
boolean |
isWriteThrough()
|
void |
refresh()
This method refreshes persisted entity from EntityProvider and calls value change listeners for all properties. |
boolean |
removeItemProperty(Object id)
Removes a nested property added with EntityItem.addNestedContainerProperty(java.lang.String). |
void |
removeListener(com.vaadin.data.Property.ValueChangeListener listener)
Removes a previously registered value change listener. |
void |
removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
|
void |
setBuffered(boolean buffered)
|
void |
setReadThrough(boolean readThrough)
|
void |
setWriteThrough(boolean writeThrough)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Object getItemId()
EntityItemIf the item ID is null, the entity item was created by a container, but not yet added to it.
getItemId in interface EntityItem<T>EntityContainer.createEntityItem(java.lang.Object)
public boolean addItemProperty(Object id,
com.vaadin.data.Property property)
throws UnsupportedOperationException
EntityItem
addItemProperty in interface EntityItem<T>addItemProperty in interface com.vaadin.data.ItemUnsupportedOperationException - always thrown.
public void addNestedContainerProperty(String nestedProperty)
throws UnsupportedOperationException
EntityItemEntityContainer. However, if additional properties are needed,
this method can be used to add the nested property
nestedProperty to the set of properties for this particular
item.
Otherwise, this method behaves just like
EntityContainer.addNestedContainerProperty(java.lang.String).
addNestedContainerProperty in interface EntityItem<T>nestedProperty - the nested property to add (must not be null).
UnsupportedOperationException - if nested properties are not supported by the container.public EntityItemProperty getItemProperty(Object id)
EntityItem
getItemProperty in interface EntityItem<T>getItemProperty in interface com.vaadin.data.Itempublic Collection<String> getItemPropertyIds()
EntityItem
In practice, this means all the properties of the underlying entity
class, any nested properties defined in the container and any nested
properties added using
EntityItem.addNestedContainerProperty(java.lang.String). Any non-nested
properties that have been removed from the container will still show up
in this collection.
getItemPropertyIds in interface EntityItem<T>getItemPropertyIds in interface com.vaadin.data.Item
public boolean removeItemProperty(Object id)
throws UnsupportedOperationException
EntityItemEntityItem.addNestedContainerProperty(java.lang.String). This method cannot
be used to remove any other properties.
removeItemProperty in interface EntityItem<T>removeItemProperty in interface com.vaadin.data.Itemid - the ID (name) of the nested property.
UnsupportedOperationException - if the implementation does not support removing nested
properties.public boolean isModified()
EntityItemEntityItem.getEntity()). If item-level buffering is not
used, this method always returns false.
isModified in interface EntityItem<T>isModified in interface com.vaadin.data.Buffered#isWriteThrough() returns false and there are
changes that have not yet been commited to the underlying Entity,
false otherwise.EntityItem.isDirty()public boolean isDirty()
EntityItemEntityItem.getEntity())
has been modified after it was fetched from the entity provider. When the
changes have been persisted, this flag will be reset.
This flag is only of relevance when container buffering is used. If the container is in write-through mode, any changes made to the entity will automatically be propagated back to the entity provider and hence, this method will always return false as there are no dirty entities.
However, if container write-through mode is turned off, any changes made to the entity will not be propagated back until explicitly committed. Modified entities that have not yet been propagated back to the entity provider are considered dirty.
Please note, that this is not the same as the EntityItem.isModified() flag,
which is of relevance when item buffering is used.
If the item is not persistent, this method always returns false.
isDirty in interface EntityItem<T>public boolean isPersistent()
EntityItemEntityItem.getEntity()) is persistent
(i.e. fetched from a persistence storage) or transient (created and
buffered by the container). This method always returns false if
EntityItem.getItemId() is null, even if the underlying entity actually is
persistent.
isPersistent in interface EntityItem<T>public boolean isDeleted()
EntityItemEntityItem.isPersistent() is true and the container is
running in buffered mode.
isDeleted in interface EntityItem<T>public EntityContainer<T> getContainer()
EntityItemEntityItem.getItemId() is
null, the container created the item but does not yet contain it.
getContainer in interface EntityItem<T>public T getEntity()
EntityItem
getEntity in interface EntityItem<T>
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 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
com.vaadin.data.Buffered.SourceException
com.vaadin.data.Validator.InvalidValueExceptionpublic void addListener(com.vaadin.data.Property.ValueChangeListener listener)
EntityItem
addListener in interface EntityItem<T>addListener in interface com.vaadin.data.Property.ValueChangeNotifierlistener - the new listener to be registered.public void removeListener(com.vaadin.data.Property.ValueChangeListener listener)
EntityItem
removeListener in interface EntityItem<T>removeListener in interface com.vaadin.data.Property.ValueChangeNotifierlistener - listener to be removed.public void addValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
addValueChangeListener in interface com.vaadin.data.Property.ValueChangeNotifierpublic void removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener listener)
removeValueChangeListener in interface com.vaadin.data.Property.ValueChangeNotifierpublic String toString()
toString in class Objectpublic void refresh()
EntityItemThe method can be used to update one item if developer know it has been changed either straight to the entity object or to backend.
Note, that in case the write buffering and EntityItem.isDirty() flag is on,
all changes will be lost and property values are overridden from the
backend.
Also note that the entire container might get reloaded when calling this method when e.g. the entity has been deleted from the database.
refresh in interface EntityItem<T>public void setBuffered(boolean buffered)
setBuffered in interface com.vaadin.data.Bufferedpublic boolean isBuffered()
isBuffered in interface com.vaadin.data.Buffered
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||