use of com.extjs.gxt.ui.client.binding.Converter in project activityinfo by bedatadriven.
the class LocalDateBinding method create.
public static FieldBinding create(DateField dateField, String datePropertyName) {
FieldBinding binding = new FieldBinding(dateField, datePropertyName);
binding.setConverter(new Converter() {
@Override
public Object convertModelValue(Object value) {
if (value == null) {
return null;
} else {
return ((LocalDate) value).atMidnightInMyTimezone();
}
}
@Override
public Object convertFieldValue(Object value) {
if (value == null) {
return null;
} else {
Date dateValue = (Date) value;
return new LocalDate(dateValue);
}
}
});
return binding;
}
Aggregations