use of com.vaadin.data.Converter in project cia by Hack23.
the class FormFactoryImpl method createDisplayPropertyConverters.
/**
* Creates the display property converters.
*
* @param <T> the generic type
* @param displayProperties the display properties
* @param formContent the form content
* @param binder the binder
* @param propertyDescriptors the property descriptors
*/
private static <T extends Serializable> void createDisplayPropertyConverters(final List<String> displayProperties, final ComponentContainer formContent, final Binder<T> binder, final PropertyDescriptor[] propertyDescriptors) {
for (final String property : displayProperties) {
final Class<?> typeOfProperty = getTypeOfProperty(propertyDescriptors, property);
if (typeOfProperty != null) {
final AbstractField<?> field = new TextField();
field.setReadOnly(true);
field.setCaption(property);
field.setWidth(ContentSize.FULL_SIZE);
formContent.addComponent(field);
final Converter converter = getConverterForType(typeOfProperty);
if (converter != null) {
binder.forField(field).withConverter(converter).bind(property);
} else {
binder.forField(field).bind(property);
}
}
}
}
use of com.vaadin.data.Converter in project cia by Hack23.
the class FormFactoryImpl method createDisplayPropertyConverters.
/**
* Creates the display property converters.
*
* @param <T>
* the generic type
* @param displayProperties
* the display properties
* @param formContent
* the form content
* @param binder
* the binder
* @param propertyDescriptors
* the property descriptors
*/
private static <T extends Serializable> void createDisplayPropertyConverters(final List<String> displayProperties, final FormLayout formContent, final Binder<T> binder, final PropertyDescriptor[] propertyDescriptors) {
for (final String property : displayProperties) {
final Class<?> typeOfProperty = getTypeOfProperty(propertyDescriptors, property);
if (typeOfProperty != null) {
final AbstractField<?> field = new TextField();
field.setReadOnly(true);
field.setCaption(property);
field.setWidth(ContentSize.FULL_SIZE);
formContent.addComponent(field);
final Converter converter = getConverterForType(typeOfProperty);
if (converter != null) {
binder.forField(field).withConverter(converter).bind(property);
} else if (String.class.equals(typeOfProperty)) {
binder.forField(field).bind(property);
} else {
LOGGER.warn("No fieldtype for property: {}, type: {}", property, typeOfProperty);
}
}
}
}
Aggregations