Observable Vaadin events

The add-on publishes many Vaadin events to CDI. You don’t have to register a listener, just use an observer to handle these:

  • ServiceInitEvent See VaadinServiceInitListener for details.

  • PollEvent

  • BeforeEnterEvent

  • BeforeLeaveEvent

  • AfterNavigationEvent See Navigation Lifecycle for details about navigation events.

  • UIInitEvent See UIInitListener for details.

  • SessionInitEvent

  • SessionDestroyEvent

  • ServiceDestroyEvent

    Warning
    During application shutdown it is implementation specific, whether ServiceDestroyEvent works with CDI or not.

An example of a bootstrap page customizer:

Java

  1. public class BootstrapCustomizer {
  2. private void onServiceInit(@Observes ServiceInitEvent serviceInitEvent) {
  3. serviceInitEvent.addBootstrapListener(this::modifyBootstrapPage);
  4. }
  5. private void modifyBootstrapPage(BootstrapPageResponse response) {
  6. response.getDocument().body().append(
  7. "<p>By CDI add-on</p>");
  8. }
  9. }