Observable Vaadin Events
L’add-on Vaadin CDI pubblica molti eventi Vaadin su contexts and dependency injection (CDI).
Non è necessario registrare un listener. È sufficiente gestire questi eventi usando solo un observer.
Gli eventi pubblicati su CDI includono:
-
ServiceInitEventVedere VaadinServiceInitListener per maggiori informazioni. -
PollEvent. -
BeforeEnterEvent. Vedere Navigation Lifecycle per maggiori informazioni. -
BeforeLeaveEvent. Vedere Navigation Lifecycle per maggiori informazioni. -
AfterNavigationEvent. Vedere Navigation Lifecycle per maggiori informazioni. -
UIInitEvent. Vedere Session and UI InitListener per maggiori informazioni. -
SessionInitEvent. Vedere Handling Session Initialization and Destruction per maggiori informazioni. -
SessionDestroyEvent. Vedere Handling Session Initialization and Destruction per maggiori informazioni. -
ServiceDestroyEvent.
|
Warning
|
Il supporto di ServiceDestroyEvent durante lo shutdown dell’applicazione dipende da ciascuna implementazione specifica.
|
L’esempio qui usa l’annotazione @Observes per ascoltare ServiceInitEvent:
Source code
Java
public class BootstrapCustomizer {
private void onServiceInit(@Observes
ServiceInitEvent serviceInitEvent) {
serviceInitEvent.addIndexHtmlRequestListener(
this::modifyBootstrapPage);
}
private void modifyBootstrapPage(
IndexHtmlResponse response) {
response.getDocument().body().append(
"<p>By CDI add-on</p>");
}
}DD8861A6-C281-4A3D-977D-FA750E3BAB5E