|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.util.AbstractProperty
org.grails.plugin.vaadin.utils.PropertyConverter
@SuppressWarnings("serial") abstract class PropertyConverter extends AbstractProperty
Copy of PropertyFormatter
However, while PropertyFormatter requires the type to be String, this class is more general-purpose, allowing any type to be converted to any type.
In fact, PropertyFormatter could easily be rewritten to subclass this class.
Also, this class allows chaining of property converters, whereas PropertyFormatter does not.
Property Summary | |
---|---|
Property |
dataSource
Datasource that stores the actual value. |
Constructor Summary | |
protected PropertyConverter()
Construct a new PropertyConverter that is not connected to any data source. |
|
PropertyConverter(Property propertyDataSource)
Construct a new converter that is connected to given data source. |
Method Summary | |
---|---|
CONVERTED
|
convert(Object value)
This method must be implemented to convert the values received from DataSource. |
Property
|
getPropertyDataSource()
Gets the current data source of the converter, if any. |
Class
|
getType()
|
Object
|
getValue()
Get the converted value. |
boolean
|
isReadOnly()
Reflects the read-only status of the datasource. |
void
|
readOnlyStatusChange(Property.ReadOnlyStatusChangeEvent event)
Listens for changes in the datasource. |
ORIGINAL
|
restore(Object value)
Parse object and convert it to type compatible with datasource. |
void
|
setPropertyDataSource(Property newDataSource)
Sets the specified Property as the data source for the converter. |
void
|
setReadOnly(boolean newStatus)
Sets the Property's read-only mode to the specified status. |
void
|
setValue(Object newValue)
|
String
|
toString()
Get the string representation of the converted value. |
void
|
valueChange(Property.ValueChangeEvent event)
Listens for changes in the datasource. |
Methods inherited from class AbstractProperty | |
---|---|
toString, setReadOnly, isReadOnly, getListeners, addListener, addListener, removeListener, removeListener, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll, getValue, getType, setValue |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Property Detail |
---|
Property dataSource
Constructor Detail |
---|
protected PropertyConverter()
PropertyConverter(Property propertyDataSource)
propertyDataSource
- to connect this property to.
Method Detail |
---|
CONVERTED convert(Object value)
value
- Value object got from the datasource. This is guaranteed to be
non-null and of the type compatible with getType() of the
datasource.
Property getPropertyDataSource()
null
if
none defined.
@SuppressWarnings("unchecked") Class getType()
Object getValue()
@Override boolean isReadOnly()
void readOnlyStatusChange(Property.ReadOnlyStatusChangeEvent event)
ORIGINAL restore(Object value)
value
- This is guaranteed to be non-null object.
void setPropertyDataSource(Property newDataSource)
Remember that new data sources getValue() must return objects that are compatible with convert() and restore() methods.
newDataSource
- the new data source Property.
@Override void setReadOnly(boolean newStatus)
newStatus
- the new read-only status of the Property.
void setValue(Object newValue)
@Override String toString()
void valueChange(Property.ValueChangeEvent event)
Groovy Documentation