From 3bf02a9086d7a65d1aa1df8938d6779ac4e29e0c Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 22 Dec 2011 10:43:14 +0200 Subject: [PATCH] Rename TransactionalProperty to Property.Transactional based on review (#8094). --- src/com/vaadin/data/Property.java | 55 +++++++++++++++++++ .../vaadin/data/fieldbinder/FieldGroup.java | 4 +- .../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 @@ -101,6 +101,61 @@ public interface Property extends Serializable { */ public void setReadOnly(boolean newStatus); + /** + * A Property that is capable of handle a transaction that can end in commit + * or rollback. + * + * @param + * The type of the property + * @author Vaadin Ltd + * @version @version@ + * @since 7.0 + */ + public interface Transactional extends Property { + + /** + * Starts a transaction. + * + *

+ * 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. + *

+ *

+ * {@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. + *

+ */ + public void startTransaction(); + + /** + * Commits and ends the transaction that is in progress. + *

+ * If the value is changed as a result of this operation, a + * {@link 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. + */ + public void commit(); + + /** + * Aborts and rolls back the transaction that is in progress. + *

+ * The value is reset to the value before the transaction started. No + * {@link 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. + */ + public void rollback(); + } + /** * Exception 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 TransactionalProperty wrapInTransactionalProperty( + private Property.Transactional wrapInTransactionalProperty( Property itemProperty) { return new TransactionalPropertyWrapper(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 extends AbstractProperty - implements ValueChangeNotifier, TransactionalProperty { + implements ValueChangeNotifier, Property.Transactional { private Property wrappedProperty; private boolean inTransaction = false; -- 2.39.5