diff options
author | Henri Sara <hesara@vaadin.com> | 2011-12-22 10:43:14 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2011-12-22 11:08:56 +0200 |
commit | 3bf02a9086d7a65d1aa1df8938d6779ac4e29e0c (patch) | |
tree | 87fcf4579333fb8e495000471feb043a119b887c /src/com/vaadin/data | |
parent | 709fec546551b7b7c4efde4d64143df33f9ab798 (diff) | |
download | vaadin-framework-3bf02a9086d7a65d1aa1df8938d6779ac4e29e0c.tar.gz vaadin-framework-3bf02a9086d7a65d1aa1df8938d6779ac4e29e0c.zip |
Rename TransactionalProperty to Property.Transactional based on review
(#8094).
Diffstat (limited to 'src/com/vaadin/data')
-rw-r--r-- | src/com/vaadin/data/Property.java | 55 | ||||
-rw-r--r-- | src/com/vaadin/data/fieldbinder/FieldGroup.java | 4 | ||||
-rw-r--r-- | src/com/vaadin/data/util/TransactionalPropertyWrapper.java | 3 |
3 files changed, 58 insertions, 4 deletions
diff --git a/src/com/vaadin/data/Property.java b/src/com/vaadin/data/Property.java index 052a174408..f25030f996 100644 --- a/src/com/vaadin/data/Property.java +++ b/src/com/vaadin/data/Property.java @@ -102,6 +102,61 @@ public interface Property<T> extends Serializable { public void setReadOnly(boolean newStatus); /** + * A Property that is capable of handle a transaction that can end in commit + * or rollback. + * + * @param <T> + * The type of the property + * @author Vaadin Ltd + * @version @version@ + * @since 7.0 + */ + public interface Transactional<T> extends Property<T> { + + /** + * Starts a transaction. + * + * <p> + * If the value is set during a transaction the value must not replace + * the original value until {@link #commit()} is called. Still, + * {@link #getValue()} must return the current value set in the + * transaction. Calling {@link #rollback()} while in a transaction must + * rollback the value to what it was before the transaction started. + * </p> + * <p> + * {@link ValueChangeEvent}s must not be emitted for internal value + * changes during a transaction. If the value changes as a result of + * {@link #commit()}, a {@link ValueChangeEvent} should be emitted. + * </p> + */ + public void startTransaction(); + + /** + * Commits and ends the transaction that is in progress. + * <p> + * If the value is changed as a result of this operation, a + * {@link ValueChangeEvent} is emitted if such are supported. + * <p> + * This method has no effect if there is no transaction is in progress. + * <p> + * This method must never throw an exception. + */ + public void commit(); + + /** + * Aborts and rolls back the transaction that is in progress. + * <p> + * The value is reset to the value before the transaction started. No + * {@link ValueChangeEvent} is emitted as a result of this. + * <p> + * This method has no effect if there is no transaction is in progress. + * <p> + * This method must never throw an exception. + */ + public void rollback(); + } + + /** * <code>Exception</code> object that signals that a requested Property * modification failed because it's in read-only mode. * diff --git a/src/com/vaadin/data/fieldbinder/FieldGroup.java b/src/com/vaadin/data/fieldbinder/FieldGroup.java index d54fe117ba..d65da43d2b 100644 --- a/src/com/vaadin/data/fieldbinder/FieldGroup.java +++ b/src/com/vaadin/data/fieldbinder/FieldGroup.java @@ -240,7 +240,7 @@ public class FieldGroup implements Serializable { configureField(field);
}
- private <T> TransactionalProperty<T> wrapInTransactionalProperty(
+ private <T> Property.Transactional<T> wrapInTransactionalProperty(
Property<T> itemProperty) {
return new TransactionalPropertyWrapper<T>(itemProperty);
}
@@ -730,4 +730,4 @@ public class FieldGroup implements Serializable { }
}
-}
\ No newline at end of file +} diff --git a/src/com/vaadin/data/util/TransactionalPropertyWrapper.java b/src/com/vaadin/data/util/TransactionalPropertyWrapper.java index b593387d71..8e475758bf 100644 --- a/src/com/vaadin/data/util/TransactionalPropertyWrapper.java +++ b/src/com/vaadin/data/util/TransactionalPropertyWrapper.java @@ -6,10 +6,9 @@ package com.vaadin.data.util; import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeNotifier;
-import com.vaadin.data.TransactionalProperty;
public class TransactionalPropertyWrapper<T> extends AbstractProperty<T>
- implements ValueChangeNotifier, TransactionalProperty<T> {
+ implements ValueChangeNotifier, Property.Transactional<T> {
private Property<T> wrappedProperty;
private boolean inTransaction = false;
|