Class PropertyFormatter<T>

    • Constructor Detail

      • PropertyFormatter

        protected PropertyFormatter()
        Deprecated.
        Construct a new PropertyFormatter that is not connected to any data source. Call setPropertyDataSource(Property) later on to attach it to a property.
      • PropertyFormatter

        public PropertyFormatter​(Property<T> propertyDataSource)
        Deprecated.
        Construct a new formatter that is connected to given data source. Calls format(Object) which can be a problem if the formatter has not yet been initialized.
        Parameters:
        propertyDataSource - to connect this property to.
    • Method Detail

      • getPropertyDataSource

        public Property<T> getPropertyDataSource()
        Deprecated.
        Gets the current data source of the formatter, if any.
        Specified by:
        getPropertyDataSource in interface Property.Viewer
        Returns:
        the current data source as a Property, or null if none defined.
      • setPropertyDataSource

        public void setPropertyDataSource​(Property newDataSource)
        Deprecated.
        Sets the specified Property as the data source for the formatter.

        Remember that new data sources getValue() must return objects that are compatible with parse() and format() methods.

        Specified by:
        setPropertyDataSource in interface Property.Viewer
        Parameters:
        newDataSource - the new data source Property.
      • getType

        public Class<String> 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 String getValue()
        Deprecated.
        Get the formatted value.
        Specified by:
        getValue in interface Property<T>
        Returns:
        If the datasource returns null, this is null. Otherwise this is String given by format().
      • isReadOnly

        public boolean isReadOnly()
        Deprecated.
        Reflects the read-only status of the datasource.
        Specified by:
        isReadOnly in interface Property<T>
        Overrides:
        isReadOnly in class AbstractProperty<String>
        Returns:
        true if the Property is in read-only mode, false if it's not
      • format

        public abstract String format​(T value)
        Deprecated.
        This method must be implemented to format the values received from DataSource.
        Parameters:
        value - Value object got from the datasource. This is guaranteed to be non-null and of the type compatible with getType() of the datasource.
        Returns:
      • parse

        public abstract T parse​(String formattedValue)
                         throws Exception
        Deprecated.
        Parse string and convert it to format compatible with datasource. The method is required to assure that parse(format(x)) equals x.
        Parameters:
        formattedValue - This is guaranteed to be non-null string.
        Returns:
        Non-null value compatible with datasource.
        Throws:
        Exception - Any type of exception can be thrown to indicate that the conversion was not succesful.
      • setReadOnly

        public void setReadOnly​(boolean newStatus)
        Deprecated.
        Sets the Property's read-only mode to the specified status.
        Specified by:
        setReadOnly in interface Property<T>
        Overrides:
        setReadOnly in class AbstractProperty<String>
        Parameters:
        newStatus - the new read-only status of the Property.
      • setValue

        public void setValue​(String 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