Class View.InitEvent

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<View<?>>
io.jmix.flowui.view.View.InitEvent
All Implemented Interfaces:
Serializable
Enclosing class:
View<T extends com.vaadin.flow.component.Component>

public static class View.InitEvent extends com.vaadin.flow.component.ComponentEvent<View<?>>
The first event in the view opening process.

The view and all its declaratively defined components are created, and dependency injection is completed. Some visual components are not fully initialized, for example buttons are not yet linked with actions.

In this event listener, you can create visual and data components, for example:

     @Subscribe
     protected void onInit(InitEvent event) {
         Label label = uiComponents.create(Label.class);
         label.setText("Hello World");
         getContent().add(label);
     }
 
Note that the event is triggered only once after View creation. It means if the navigation to View performed at first time, event triggered. Then if navigation performed to the same View, which currently opened, second and more times event is not triggered because the View instance has been already created.
See Also:
  • Constructor Details

    • InitEvent

      public InitEvent(View<?> source)