Closed adexerivera closed 5 years ago
@adexerivera: Sorry for the delayed response. The feature is now available on version 4.0.0 which requires Vaadin 14.0.2 or later. Here's a usage example:
formFactory.setConverter("salary", new Converter<String, BigDecimal>() {
@Override
public Result<BigDecimal> convertToModel(String value, ValueContext valueContext) {
return Result.ok(new BigDecimal(value)); // error handling omitted
}
@Override
public String convertToPresentation(BigDecimal value, ValueContext valueContext) {
return value.toPlainString();
}
});
@alejandro-du great, and thank you very much, now I just need to migrate my applications to Vaadin 14
I think it'd be a good idea to add a method to set a
Converter
for a specific field. This would allow converting price fields using a "currency converter", for example.