Class View.BeforeShowEvent

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

public static class View.BeforeShowEvent extends com.vaadin.flow.component.ComponentEvent<View<?>>
The second (after View.InitEvent) event in the view opening process. All components have completed their internal initialization procedures. Data loaders have been triggered by the automatically configured DataLoadCoordinator facet.

In this event listener, you can load data, check permissions and modify UI components. For example:

     @Subscribe
     protected void onBeforeShow(BeforeShowEvent event) {
         customersDl.load();
     }
 

You can abort the process of opening the view by throwing an exception.

Note consequent navigation to the same View, which currently opened, leads to triggering View.BeforeShowEvent once more for the same View instance. For example, the user navigates to the View first time: View instance is created, View.BeforeShowEvent is triggered. Then the user navigates to the same View, which currently opened: we have the same View instance, but View.BeforeShowEvent is triggered again.

If View.BeforeShowEvent method listener contains logic of adding components or loading data, it will be performed again, which can lead to adding duplicated components or reloading data.

See Also:
  • Constructor Details

    • BeforeShowEvent

      public BeforeShowEvent(View<?> source)