AbstractCompositeField populate error message


I’m trying to find how to populate error message to AbstractCompositeField using BeanValidationBinder.validate().

Should I use CustomField to do that because I cannot find any posible way using AbstractCompositeField…

We see the same problem.
We have a AbstractCompositeField which has a TextField and a drop down to select the unit.

The getValue() and protected void setPresentationValue(Integer ttl) { do the unit conversion as needed and always work with the base unit amount, as an Integer value.

When the user now enters text in the TextField instead of a number, the getValue() fails in the Integer.parseInt() method and the user sees no error message.

This post does not really helps, but is similar


Any ideas?

public class TTLField extends AbstractCompositeField<HorizontalLayout, TTLField, Integer> {

    protected Integer _ttl= 0;
    private static final String[] UNITS = new String[]
 { "Seconds", "Minutes", "Hours", "Days"}; 
    protected final TextField _amountField= new TextField();
    protected final Select<String>    _unitSelect= new Select<>();
	public Integer getValue() {
        String sValue= _amountField.getValue();
        int intValue= Integer.parseInt(sValue);

Is there anything we can do about it ?