|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.util.AbstractProperty<T>
com.vaadin.data.util.TransactionalPropertyWrapper<T>
T
- public class TransactionalPropertyWrapper<T>
Wrapper class that helps implement two-phase commit for a non-transactional
property.
When accessing the property through the wrapper, getting and setting the
property value take place immediately. However, the wrapper keeps track of
the old value of the property so that it can be set for the property in case
of a roll-back. This can result in the underlying property value changing
multiple times (first based on modifications made by the application, then
back upon roll-back).
Value change events on the TransactionalPropertyWrapper
are only
fired at the end of a successful transaction, whereas listeners attached to
the underlying property may receive multiple value change events.
Property.Transactional
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractProperty |
---|
AbstractProperty.ReadOnlyStatusChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
---|
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeEvent, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeEvent, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
Constructor Summary | |
---|---|
TransactionalPropertyWrapper(Property<T> wrappedProperty)
|
Method Summary | |
---|---|
void |
commit()
Commits and ends the transaction that is in progress. |
protected void |
endTransaction()
|
protected void |
fireValueChange()
Sends a value change event to all registered listeners. |
java.lang.Class |
getType()
Returns the type of the Property. |
T |
getValue()
Gets the value stored in the Property. |
Property<T> |
getWrappedProperty()
|
void |
rollback()
Aborts and rolls back the transaction that is in progress. |
void |
setValue(java.lang.Object newValue)
Sets the value of the Property. |
void |
startTransaction()
Starts a transaction. |
Methods inherited from class com.vaadin.data.util.AbstractProperty |
---|
addListener, addListener, addReadOnlyStatusChangeListener, addValueChangeListener, fireReadOnlyStatusChange, getListeners, isReadOnly, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValueChangeListener, setReadOnly, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Property.ValueChangeNotifier |
---|
addListener, addValueChangeListener, removeListener, removeValueChangeListener |
Methods inherited from interface com.vaadin.data.Property |
---|
isReadOnly, setReadOnly |
Constructor Detail |
---|
public TransactionalPropertyWrapper(Property<T> wrappedProperty)
Method Detail |
---|
public java.lang.Class getType()
Property
getValue
and
setValue
must be compatible with this type: one must be able
to safely cast the value returned from getValue
to the given
type and pass any variable assignable to this type as an argument to
setValue
.
getType
in interface Property<T>
public T getValue()
Property
getValue
in interface Property<T>
public void setValue(java.lang.Object newValue) throws Property.ReadOnlyException
Property
Implementing this functionality is optional. If the functionality is
missing, one should declare the Property to be in read-only mode and
throw Property.ReadOnlyException
in this function.
setValue
in interface Property<T>
newValue
- New value of the Property. This should be assignable to the
type returned by getType
Property.ReadOnlyException
- if the object is in read-only modepublic void startTransaction()
Property.Transactional
If the value is set during a transaction the value must not replace
the original value until Property.Transactional.commit()
is called. Still,
Property.getValue()
must return the current value set in the
transaction. Calling Property.Transactional.rollback()
while in a transaction must
rollback the value to what it was before the transaction started.
Property.ValueChangeEvent
s must not be emitted for internal value
changes during a transaction. If the value changes as a result of
Property.Transactional.commit()
, a Property.ValueChangeEvent
should be emitted.
startTransaction
in interface Property.Transactional<T>
public void commit()
Property.Transactional
If the value is changed as a result of this operation, a
Property.ValueChangeEvent
is emitted if such are supported.
This method has no effect if there is no transaction is in progress.
This method must never throw an exception.
commit
in interface Property.Transactional<T>
public void rollback()
Property.Transactional
The value is reset to the value before the transaction started. No
Property.ValueChangeEvent
is emitted as a result of this.
This method has no effect if there is no transaction is in progress.
This method must never throw an exception.
rollback
in interface Property.Transactional<T>
protected void endTransaction()
protected void fireValueChange()
AbstractProperty
fireValueChange
in class AbstractProperty<T>
public Property<T> getWrappedProperty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |