|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.data.util.AbstractProperty
com.vaadin.addon.jpacontainer.fieldfactory.PropertyTranslator
public abstract class PropertyTranslator
PropertyTranslator is bit like the PropertyFormatter, but works also
for other than string fields.
Typical use case is where you have a select whose value is an Entity, but the container datasource used in the select uses a different identifier (most commonly entity id in database).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractProperty |
|---|
com.vaadin.data.util.AbstractProperty.ReadOnlyStatusChangeEvent |
| Nested classes/interfaces inherited from interface com.vaadin.data.Property |
|---|
com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyException, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<T>, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer |
| Constructor Summary | |
|---|---|
protected |
PropertyTranslator()
Construct a new PropertyTranslator that is not connected to any
data source. |
|
PropertyTranslator(com.vaadin.data.Property propertyDataSource)
Construct a new translator that is connected to given data source. |
| Method Summary | |
|---|---|
com.vaadin.data.Property |
getPropertyDataSource()
Gets the current data source of the translator, if any. |
Class |
getType()
|
Object |
getValue()
Get the translated value. |
boolean |
isReadOnly()
Reflects the read-only status of the datasource. |
void |
readOnlyStatusChange(com.vaadin.data.Property.ReadOnlyStatusChangeEvent event)
Listens for changes in the datasource. |
void |
setPropertyDataSource(com.vaadin.data.Property newDataSource)
Sets the specified Property as the data source for the translator. |
void |
setReadOnly(boolean newStatus)
Sets the Property's read-only mode to the specified status. |
void |
setValue(Object newValue)
|
String |
toString()
Get the translated value as string. |
abstract Object |
translateFromDatasource(Object value)
This method must be implemented to translate the value received from DataSource. |
abstract Object |
translateToDatasource(Object formattedValue)
This method is used by setValue() method to translate given value to be suitable for the datasource. |
void |
valueChange(com.vaadin.data.Property.ValueChangeEvent event)
Listens for changes in the datasource. |
| Methods inherited from class com.vaadin.data.util.AbstractProperty |
|---|
addListener, addListener, addReadOnlyStatusChangeListener, addValueChangeListener, fireReadOnlyStatusChange, fireValueChange, getListeners, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValueChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected PropertyTranslator()
PropertyTranslator that is not connected to any
data source. Call setPropertyDataSource(Property) later on to
attach it to a property.
public PropertyTranslator(com.vaadin.data.Property propertyDataSource)
translateFromDatasource(Object) which can be a problem if the
formatter has not yet been initialized.
propertyDataSource - to connect this property to.| Method Detail |
|---|
public com.vaadin.data.Property getPropertyDataSource()
getPropertyDataSource in interface com.vaadin.data.Property.Viewernull if
none defined.public void setPropertyDataSource(com.vaadin.data.Property newDataSource)
setPropertyDataSource in interface com.vaadin.data.Property.ViewernewDataSource - the new data source Property.public Class getType()
getType in interface com.vaadin.data.Propertypublic Object getValue()
getValue in interface com.vaadin.data.Propertypublic String toString()
toString in class com.vaadin.data.util.AbstractPropertypublic boolean isReadOnly()
isReadOnly in interface com.vaadin.data.PropertyisReadOnly in class com.vaadin.data.util.AbstractPropertypublic abstract Object translateFromDatasource(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.
public abstract Object translateToDatasource(Object formattedValue)
throws Exception
translatedValue - this is the value set by user of the formatter (typically
field).
Exception - Any type of exception can be thrown to indicate that the
conversion was not succesful.public void setReadOnly(boolean newStatus)
setReadOnly in interface com.vaadin.data.PropertysetReadOnly in class com.vaadin.data.util.AbstractPropertynewStatus - the new read-only status of the Property.
public void setValue(Object newValue)
throws com.vaadin.data.Property.ReadOnlyException,
com.vaadin.data.util.converter.Converter.ConversionException
setValue in interface com.vaadin.data.Propertycom.vaadin.data.Property.ReadOnlyException
com.vaadin.data.util.converter.Converter.ConversionExceptionpublic void valueChange(com.vaadin.data.Property.ValueChangeEvent event)
valueChange in interface com.vaadin.data.Property.ValueChangeListenerpublic void readOnlyStatusChange(com.vaadin.data.Property.ReadOnlyStatusChangeEvent event)
readOnlyStatusChange in interface com.vaadin.data.Property.ReadOnlyStatusChangeListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||