vaadin8: unique label as statuslabel

I had been trying to use a single label instance as StatusLabel of many fields, the label never show up if it is used in more than one"
I tried on ever field ::withStatusLabel() and directly to the binder ::withStatusLabel
What am I doing wrong?

Binder binder = new Binder();
        final Setter emptySetter = VaadinUtils.getEmptySetter();
        binder.forField(tf)
                .withValidator(new StringLengthValidator("3  -  20 -> {0}", 3, 20))
                .withStatusLabel(statusLabel)
                .bind(evt -> tf.getValue(), emptySetter);
        Validator<LocalDate> xx = new Validator<LocalDate>() {
            @Override
            public ValidationResult apply(LocalDate value, ValueContext context) {
                return (value == null || value.isAfter(LocalDate.now())) ? ValidationResult.error("fecha mala") : ValidationResult.ok();
            }
        };
        df.setResolution(DateResolution.MONTH);
//        df.setDateFormat("dd/MM/yyyy");
        binder.forField(df).asRequired("vacio!!!")
                .withValidator(xx)
                .withStatusLabel(statusLabel)
                .bind(evt -> df.getValue(), emptySetter);
		binder.setStatusLabel(statusLabel);

Are you actually adding the statusLabel component to some Layout somewhere?

yes, in the same Vertical.

Field
Field
Date
StatusLabel (!)

I am trying to create a template for most UI/Views/Crud’s

Then the code looks more or less like it should to me. Only thing that comes to mind is that maybe you won’t need the setStatusLabel on the Binder itself (last line) if you’re already using it in the bindings.

seems that when binder.setStatusLabel(statusLabel) is set, the label show up! but the message/text/caption is always empty (I know that now because I set an icon too and I am just seeing the icon).

if the validation is used through asRequired or withValidator, the behaviour is different (not just the ‘*’)

Another problem is when binder.validate() is called, the statusLabel disappear (like no error exists)

I guess the .withStatusLabel is either buggy (I didn’t find a ticket matching what you’re describing, but then don’t see the feature used very often) or just working in a not-very-helpful way. I’d recommend using .withValidationStatusHandler instead; that’ll give you the power to do exactly as you please with the validation status information.