|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itmill.toolkit.data.util.ObjectProperty
public class ObjectProperty
A simple data object containing one typed value. This class is a
straightforward implementation of the the
Property interface.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.itmill.toolkit.data.Property |
|---|
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
| Constructor Summary | |
|---|---|
ObjectProperty(Object value)
Creates a new instance of ObjectProperty with the given value. |
|
ObjectProperty(Object value,
Class type)
Creates a new instance of ObjectProperty with the given value and type. |
|
ObjectProperty(Object value,
Class type,
boolean readOnly)
Creates a new instance of ObjectProperty with the given value, type and read-only mode status. |
|
| Method Summary | |
|---|---|
void |
addListener(Property.ReadOnlyStatusChangeListener listener)
Registers a new read-only status change listener for this Property. |
void |
addListener(Property.ValueChangeListener listener)
Registers a new value change listener for this ObjectProperty. |
Class |
getType()
Returns the type of the ObjectProperty. |
Object |
getValue()
Gets the value stored in the Property. |
boolean |
isReadOnly()
Tests if the Property is in read-only mode. |
void |
removeListener(Property.ReadOnlyStatusChangeListener listener)
Removes a previously registered read-only status change listener. |
void |
removeListener(Property.ValueChangeListener listener)
Removes a previously registered value change listener. |
void |
setReadOnly(boolean newStatus)
Sets the Property's read-only mode to the specified status. |
void |
setValue(Object newValue)
Sets the value of the property. |
String |
toString()
Returns the value of the ObjectProperty in human readable textual format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectProperty(Object value)
value - the Initial value of the Property.
public ObjectProperty(Object value,
Class type)
value - the Initial value of the Property.type - the type of the value. The value must be assignable to given
type.
public ObjectProperty(Object value,
Class type,
boolean readOnly)
value - the Initial value of the property.type - the type of the value. value must be assignable
to this type.readOnly - Sets the read-only mode.| Method Detail |
|---|
public final Class getType()
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.
getType in interface Propertypublic Object getValue()
getValue in interface Propertypublic String toString()
setValue
method if the Property is not in read-only mode.
toString in interface PropertytoString in class ObjectString representation of the value stored in the
ObjectPropertypublic boolean isReadOnly()
setValue will throw
ReadOnlyExceptions and will not modify the value of the
Property.
isReadOnly in interface Propertytrue if the Property is in read-only mode,
false if it's notpublic void setReadOnly(boolean newStatus)
setReadOnly in interface PropertynewStatus - the new read-only status of the Property.
public void setValue(Object newValue)
throws Property.ReadOnlyException,
Property.ConversionException
String if either String is directly
assignable to property type, or the type class contains a string
constructor.
setValue in interface PropertynewValue - the New value of the property.
Property.ReadOnlyException - if the object is in
read-only mode
Property.ConversionException - if the newValue can't be
converted into the Property's native type directly or through
String
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 Stringpublic void removeListener(Property.ValueChangeListener listener)
removeListener in interface Property.ValueChangeNotifierlistener - the listener to be removed.public void addListener(Property.ValueChangeListener listener)
addListener in interface Property.ValueChangeNotifierlistener - the new Listener to be registeredpublic void addListener(Property.ReadOnlyStatusChangeListener listener)
addListener in interface Property.ReadOnlyStatusChangeNotifierlistener - the new Listener to be registeredpublic void removeListener(Property.ReadOnlyStatusChangeListener listener)
removeListener in interface Property.ReadOnlyStatusChangeNotifierlistener - the listener to be removed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||