T - public class TransactionalPropertyWrapper<T> extends AbstractProperty<T> implements Property.ValueChangeNotifier, Property.Transactional<T>
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 FormAbstractProperty.ReadOnlyStatusChangeEventProperty.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeEvent, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeEvent, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer| Constructor and Description |
|---|
TransactionalPropertyWrapper(Property<T> wrappedProperty) |
| Modifier and Type | Method and Description |
|---|---|
void |
commit()
Commits and ends the transaction that is in progress.
|
void |
detachFromProperty()
Removes the ValueChangeListener from wrapped Property that was added by
TransactionalPropertyWrapper.
|
protected void |
endTransaction() |
protected void |
fireValueChange()
Sends a value change event to all registered listeners.
|
Class |
getType()
Returns the type of the Property.
|
T |
getValue()
Gets the value stored in the Property.
|
Property<T> |
getWrappedProperty() |
boolean |
isReadOnly()
Tests if the Property is in read-only mode.
|
void |
rollback()
Aborts and rolls back the transaction that is in progress.
|
void |
setReadOnly(boolean newStatus)
Sets the Property's read-only mode to the specified status.
|
void |
setValue(T newValue)
Sets the value of the Property.
|
void |
startTransaction()
Starts a transaction.
|
addListener, addListener, addReadOnlyStatusChangeListener, addValueChangeListener, fireReadOnlyStatusChange, getListeners, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValueChangeListener, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListener, addValueChangeListener, removeListener, removeValueChangeListenerpublic void detachFromProperty()
public Class getType()
PropertygetValue 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.public T getValue()
Propertypublic void setValue(T 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 getTypeProperty.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.ValueChangeEvents 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()
AbstractPropertyfireValueChange in class AbstractProperty<T>public boolean isReadOnly()
AbstractPropertysetValue will throw
ReadOnlyException and will not modify the value of the
Property.
Override for additional restrictions on what is considered a read-only
property.isReadOnly in interface Property<T>isReadOnly in class AbstractProperty<T>true if the Property is in read-only mode,
false if it's notpublic void setReadOnly(boolean newStatus)
PropertyisReadOnly mode query correctly.setReadOnly in interface Property<T>setReadOnly in class AbstractProperty<T>newStatus - new read-only status of the PropertyCopyright © 2017 Vaadin Ltd. All rights reserved.