Interface Property

Property is a simple data object that contains one typed value. This interface contains methods to inspect and modify the stored value and its type, and the object's read-only state. Property also defines the events ReadOnlyStatusChangeEvent and ValueChangeEvent, and the associated listener and notifier interfaces. The Property.Viewer interface should be used to attach the Property to an external data source. This way the value in the data source can be inspected using the Property interface. The Property.editor interface should be implemented if the value needs to be changed through the implementing class.

Synopsis

Since

3.0

Inheritance Path.  com.itmill.toolkit.data.Property

getType()

Parameters

return

type of the 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 .

getValue()

Parameters

return

the value stored in the Property

Gets the value stored in the Property.

isReadOnly()

Parameters

return

true if the Property is in read-only mode, false if it's not

Tests if the Property is in read-only mode. In read-only mode calls to the method setValue will throw ReadOnlyException s and will not modify the value of the Property.

setReadOnly(boolean)

Parameters

newStatus

new read-only status of the 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.

setValue(Object)

Parameters

newValue

New value of the Property. This should be assignable to the type returned by getType , but also String type should be supported

Exceptions

Property.ReadOnlyException

if the object is in read-only mode

Property.ConversionException

if newValue can't be converted into the Property's native type directly or through String

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. It is not required, but highly recommended to support setting the value also as a String in addition to the native type of the Property (as given by the getType method). If the String conversion fails or is unsupported, the method should throw Property.ConversionException. The string conversion should at least understand the format returned by the toString() method of the Property.

toString()

Parameters

return

String representation of the value stored in the Property

Returns the value of the Property in human readable textual format. The return value should be assignable to the setValue method if the Property is not in read-only mode.