Common Handlers

AttachEvent

com.vaadin.flow.component.AttachEvent is sent after the component is attached to the UI.

BlurEvent

com.vaadin.flow.component.BlurNotifier.BlurEvent corresponds to the blur DOM event.

ClientValidatedEvent

com.vaadin.flow.component.shared.HasClientValidation.ClientValidatedEvent fired by the web component whenever it is validated on the client-side. This event corresponds to the validated DOM event.

ComponentValueChangeEvent

com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent is sent when the component’s value changes.

CompositionEndEvent

com.vaadin.flow.component.CompositionEndEvent is sent when a composition is ended. Corresponds to the compositionend DOM event.

CompositionStartEvent

com.vaadin.flow.component.CompositionStartEvent is sent when a composition is started. Corresponds to the compositionstart DOM event.

CompositionUpdateEvent

com.vaadin.flow.component.CompositionUpdateEvent is sent when a composition is updated. Corresponds to the compositionupdate DOM event.

DetachEvent

com.vaadin.flow.component.DetachEvent is sent before the component is detached from the UI.

FocusEvent

com.vaadin.flow.component.FocusNotifier.FocusEvent corresponds to the focus DOM event.

InputEvent

com.vaadin.flow.component.InputEvent fired when the component has received any type of input (for example, click, key press).

This event is specifically intended to the used for the input event in the DOM API.

KeyDownEvent

com.vaadin.flow.component.KeyDownEvent is sent when a key is pressed. Corresponds to the keydown DOM event.

KeyPressEvent

com.vaadin.flow.component.KeyPressEvent is sent when a key is pressed. Corresponds to the keypress DOM event.

KeyUpEvent

com.vaadin.flow.component.KeyUpEvent is sent when a key is released. Corresponds to the keyup DOM event.

statusChangeHandler

io.jmix.flowui.component.SupportsStatusChangeHandler is used to handle component status changes, for example, validation messages set by HasValidation.setErrorMessage(String).

As an example, instead of displaying validation messages below the component, consider using a separate component, such as Label:

<textField id="negativeField" datatype="int">
    <validators>
        <negative/>
    </validators>
</textField>
<label id="infoLabel" visible="false"/>

Define the handler as follows:

@ViewComponent
private Label infoLabel;

@Install(to = "negativeField", subject = "statusChangeHandler")
private void negativeFieldStatusChangeHandler(
        SupportsStatusChangeHandler.StatusContext<TypedTextField<String>>
                                                          statusContext) {
    infoLabel.setVisible(true); (1)
    infoLabel.setText(statusContext.getDescription()); (2)
}
1 Set the visibility of infoLabel.
2 Get the error message from a description of the StatusContext object and set it to the content of infoLabel.

TypedValueChangeEvent

io.jmix.flowui.component.SupportsTypedValue.TypedValueChangeEvent is sent when the user finished the manipulations with the component. For example, after the Enter press or when the component loses focus.

An event has the following methods:

  • getOldValue() returns the typed component’s value before the change.

  • getValue() returns the current typed component’s value.

@Autowired
protected Notifications notifications;

@Subscribe("nameField")
protected void onNameFieldTypedValueChange(
        SupportsTypedValue.TypedValueChangeEvent<TypedTextField<String>, String> event) {
    notifications
            .show("Before: " + event.getOldValue() +
                    ". After: " + event.getValue());
}