/** * Sets the value of the field using a value of the data source type. The * value given is converted to the field type and then assigned to the * field. This will update the property data source in the same way as when * {@link #setValue(Object)} is called. * * @param value * The value to set. Must be the same type as the data source. */ public void setConvertedValue(Object value) { setValue(convertFromModel(value)); }
/** * Convert the given value from the data source type to the UI type. * * @param newValue * The data source value to convert. * @return The converted value that is compatible with the UI type or the * original value if its type is compatible and no converter is set. * @throws Converter.ConversionException * if there is no converter and the type is not compatible with * the data source type. */ private T convertFromModel(Object newValue) { return convertFromModel(newValue, getLocale()); }
private void readValueFromProperty(Property.ValueChangeEvent event) { setInternalValue(convertFromModel(event.getProperty().getValue())); }
/** * Returns the field value. This is always identical to {@link #getValue()} * and only here because of clarity in the code that handles both the data * model value and the field value. * * @return The value of the field */ private T getFieldValue() { // Give the value from abstract buffers if the field if possible if (dataSource == null || isBuffered() || isModified()) { return getInternalValue(); } // There is no buffered value so use whatever the data model provides return convertFromModel(getDataSourceValue()); }
T newInternalValue = convertFromModel( getPropertyDataSource().getValue()); if (!SharedUtil.equals(newInternalValue, getInternalValue())) { T newinternalValue = convertFromModel(convertedValue); if (!SharedUtil.equals(getInternalValue(), newinternalValue)) { setInternalValue(newinternalValue);
newFieldValue = convertFromModel(getDataSourceValue());
T fieldValue = convertFromModel(getDataSourceValue()); setInternalValue(fieldValue);
T doubleConvertedFieldValue = convertFromModel( convertToModel(newFieldValue)); if (!SharedUtil.equals(newFieldValue,