]> source.dussan.org Git - vaadin-framework.git/commitdiff
Rename TransactionalProperty to Property.Transactional based on review
authorHenri Sara <hesara@vaadin.com>
Thu, 22 Dec 2011 08:43:14 +0000 (10:43 +0200)
committerHenri Sara <hesara@vaadin.com>
Thu, 22 Dec 2011 09:08:56 +0000 (11:08 +0200)
(#8094).

src/com/vaadin/data/Property.java
src/com/vaadin/data/fieldbinder/FieldGroup.java
src/com/vaadin/data/util/TransactionalPropertyWrapper.java

index 052a174408645b0d6fcd20c4cb04e513855b9b2b..f25030f996b3ec3aa67fbef6e1e75df6213a5fc1 100644 (file)
@@ -101,6 +101,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.
index d54fe117babcd27ae5e58a37eb1455bacf5ff822..d65da43d2b63ebedea81c0be3c10ea9d83608abe 100644 (file)
@@ -240,7 +240,7 @@ public class FieldGroup implements Serializable {
         configureField(field);\r
     }\r
 \r
-    private <T> TransactionalProperty<T> wrapInTransactionalProperty(\r
+    private <T> Property.Transactional<T> wrapInTransactionalProperty(\r
             Property<T> itemProperty) {\r
         return new TransactionalPropertyWrapper<T>(itemProperty);\r
     }\r
@@ -730,4 +730,4 @@ public class FieldGroup implements Serializable {
         }\r
 \r
     }\r
-}
\ No newline at end of file
+}
index b593387d71d5cbaf793057c744c566960f852b52..8e475758bf559a55b7904b3183bcb4a429e5708f 100644 (file)
@@ -6,10 +6,9 @@ package com.vaadin.data.util;
 import com.vaadin.data.Property;\r
 import com.vaadin.data.Property.ValueChangeEvent;\r
 import com.vaadin.data.Property.ValueChangeNotifier;\r
-import com.vaadin.data.TransactionalProperty;\r
 \r
 public class TransactionalPropertyWrapper<T> extends AbstractProperty<T>\r
-        implements ValueChangeNotifier, TransactionalProperty<T> {\r
+        implements ValueChangeNotifier, Property.Transactional<T> {\r
 \r
     private Property<T> wrappedProperty;\r
     private boolean inTransaction = false;\r