Class ObjectProperty

A simple data object containing one typed value. This class is a straightforward implementation of the the com.itmill.toolkit.data.Property interface.

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.data.util.ObjectProperty

ObjectProperty(Object)

Parameters

value

Initial value of the Property

Creates a new instance of ObjectProperty with the given value. The type of the property is automatically initialized to be the type of the given value.

ObjectProperty(Object, Class)

Parameters

value

Initial value of the Property

type

The type of the value. The value must be assignable to given type

Creates a new instance of ObjectProperty with the given value and type.

ObjectProperty(Object, Class, boolean)

Parameters

value

Initial value of the property.

type

The type of the value. value must be assignable to this type.

readOnly

Sets the read-only mode.

Creates a new instance of ObjectProperty with the given value, type and read-only mode status.

addListener(Property.ReadOnlyStatusChangeListener)

Parameters

listener

the new Listener to be registered

Registers a new read-only status change listener for this Property.

addListener(Property.ValueChangeListener)

Parameters

listener

the new Listener to be registered

Registers a new value change listener for this ObjectProperty.

getType()

Parameters

return

type of the Property

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

removeListener(Property.ReadOnlyStatusChangeListener)

Parameters

listener

listener to be removed

Remove a previously registered read-only status change listener.

removeListener(Property.ValueChangeListener)

Parameters

listener

listener to be removed

Remove a previously registered value change listener.

setReadOnly(boolean)

Parameters

newStatus

new read-only status of the Property

Sets the Property's read-only mode to the specified status.

setValue(Object)

Parameters

newValue

New value of the property.

Exceptions

if the object is in read-only mode

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

Set the value of the property. This method supports setting from String s if either String is directly assignable to property type, or the type class contains a string constructor.

toString()

Parameters

return

String representation of the value stored in the ObjectProperty

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