Displaying Validation Messages

By default linkki marks UI elements bound to invalid ObjectProperties. The input field bound to the referenced ObjectProperty shows a colored border and background as well as a tooltip displaying the validation messages for that field.

However, linkki does not provide a UI element to display all validation messages returned by a ValidationService. In order to display these messages a custom UI component has to be created along with a BindingManager. The BindingManager must override its updateMessages method that gets called after validation. A common pattern here is to use a Consumer<MessageList> as an argument to the BindingManager to decouple it from the actual custom UI component (which implements Consumer<MessageList>).

public class RegistrationBindingManager extends DefaultBindingManager {

    private final Consumer<MessageList> displayMessagesConsumer;

    public RegistrationBindingManager(RegistrationValidationService registrationValidationService,
            Consumer<MessageList> displayMessagesConsumer) {
        this.displayMessagesConsumer = displayMessagesConsumer;

    protected void updateMessages(MessageList messages) {


        validationService = new RegistrationValidationService(registrationPmo);
        bindingManager = new RegistrationBindingManager(validationService, ml -> messagesPanel.updateMessages(ml));