Class TransactionalPropertyWrapper<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    Property<T>, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeNotifier, Serializable

    @Deprecated
    public class TransactionalPropertyWrapper<T>
    extends AbstractProperty<T>
    implements Property.Transactional<T>
    Deprecated.
    As of 8.0, no replacement available.
    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.
    Since:
    7.0
    Author:
    Vaadin Ltd
    See Also:
    Property.Transactional, Serialized Form
    • Constructor Detail

      • TransactionalPropertyWrapper

        public TransactionalPropertyWrapper​(Property<T> wrappedProperty)
        Deprecated.
    • Method Detail

      • detachFromProperty

        public void detachFromProperty()
        Deprecated.
        Removes the ValueChangeListener from wrapped Property that was added by TransactionalPropertyWrapper.
        Since:
        7.1.15
      • getType

        public Class getType()
        Deprecated.
        Description copied from interface: Property
        Returns the type of the Property. The methods 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.
        Specified by:
        getType in interface Property<T>
        Returns:
        type of the Property
      • getValue

        public T getValue()
        Deprecated.
        Description copied from interface: Property
        Gets the value stored in the Property. The returned object is compatible with the class returned by getType().
        Specified by:
        getValue in interface Property<T>
        Returns:
        the value stored in the Property
      • setValue

        public void setValue​(T newValue)
                      throws Property.ReadOnlyException
        Deprecated.
        Description copied from interface: Property
        Sets the value of the 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.

        Note : Since Vaadin 7.0, setting the value of a non-String property as a String is no longer supported.
        Specified by:
        setValue in interface Property<T>
        Parameters:
        newValue - New value of the Property. This should be assignable to the type returned by getType
        Throws:
        Property.ReadOnlyException - if the object is in read-only mode
      • commit

        public void commit()
        Deprecated.
        Description copied from interface: Property.Transactional
        Commits and ends the transaction that is in progress.

        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.

        Specified by:
        commit in interface Property.Transactional<T>
      • rollback

        public void rollback()
        Deprecated.
        Description copied from interface: Property.Transactional
        Aborts and rolls back the transaction that is in progress.

        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.

        Specified by:
        rollback in interface Property.Transactional<T>
      • endTransaction

        protected void endTransaction()
        Deprecated.
      • getWrappedProperty

        public Property<T> getWrappedProperty()
        Deprecated.
      • isReadOnly

        public boolean isReadOnly()
        Deprecated.
        Description copied from class: AbstractProperty
        Tests if the Property is in read-only mode. In read-only mode calls to the method setValue will throw ReadOnlyException and will not modify the value of the Property. Override for additional restrictions on what is considered a read-only property.
        Specified by:
        isReadOnly in interface Property<T>
        Overrides:
        isReadOnly in class AbstractProperty<T>
        Returns:
        true if the Property is in read-only mode, false if it's not
      • setReadOnly

        public void setReadOnly​(boolean newStatus)
        Deprecated.
        Description copied from interface: Property
        Sets the Property's read-only mode to the specified status. This functionality is optional, but all properties must implement the isReadOnly mode query correctly.
        Specified by:
        setReadOnly in interface Property<T>
        Overrides:
        setReadOnly in class AbstractProperty<T>
        Parameters:
        newStatus - new read-only status of the Property