Package io.jmix.flowui
Class UiEventPublisher
java.lang.Object
io.jmix.flowui.UiEventPublisher
Sends application events that should be handled in the components (e.g. views). To enable handling
application events in the
View, annotate a method with EventListener. For instance:
@EventListener
public void customUiEventHandler(CustomUiEvent event) {
// handle event
}
To correctly update the UI, class that implements AppShellConfigurator should contain the Push
annotation. It can be the main Spring Boot application class:
@Push
@SpringBootApplication
public class MyDemoProjectApplication implements AppShellConfigurator {
// configuration
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent that should be processed on UI of specific users (or all users if usernames collection is null) -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClusterApplicationEventPublisherprotected CurrentAuthenticationprotected SessionHolderprotected SystemAuthenticator -
Constructor Summary
ConstructorsConstructorDescriptionUiEventPublisher(SystemAuthenticator systemAuthenticator, ClusterApplicationEventPublisher clusterApplicationEventPublisher, SessionHolder sessionHolder, CurrentAuthentication currentAuthentication) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonSessionAccess(com.vaadin.flow.server.VaadinSession session, org.springframework.context.ApplicationEvent event) voidprotected voidpublish(Collection<com.vaadin.flow.component.UI> uis, org.springframework.context.ApplicationEvent event) voidpublishEvent(org.springframework.context.ApplicationEvent event) Publishes event for all UIs (tabs and browsers) in the current user session.voidpublishEventForCurrentUI(org.springframework.context.ApplicationEvent event) Publishes event only for the current UI.voidpublishEventForUsers(org.springframework.context.ApplicationEvent event, Collection<String> usernames) Publishes the event for all UIs in all sessions of users specified in usernames collection.protected voidpublishEventForUsersInternal(org.springframework.context.ApplicationEvent event, Collection<String> usernames) protected voidsendEventToUserSessions(org.springframework.context.ApplicationEvent event, Map<String, List<com.vaadin.flow.server.VaadinSession>> userSessions)
-
Field Details
-
currentAuthentication
-
systemAuthenticator
-
clusterApplicationEventPublisher
-
sessionHolder
-
-
Constructor Details
-
UiEventPublisher
public UiEventPublisher(SystemAuthenticator systemAuthenticator, ClusterApplicationEventPublisher clusterApplicationEventPublisher, SessionHolder sessionHolder, CurrentAuthentication currentAuthentication)
-
-
Method Details
-
onUiUserEvent
-
publishEventForUsersInternal
protected void publishEventForUsersInternal(org.springframework.context.ApplicationEvent event, @Nullable Collection<String> usernames) -
sendEventToUserSessions
-
onSessionAccess
protected void onSessionAccess(com.vaadin.flow.server.VaadinSession session, org.springframework.context.ApplicationEvent event) -
publishEventForCurrentUI
public void publishEventForCurrentUI(org.springframework.context.ApplicationEvent event) Publishes event only for the current UI.- Parameters:
event- application event
-
publishEvent
public void publishEvent(org.springframework.context.ApplicationEvent event) Publishes event for all UIs (tabs and browsers) in the current user session.- Parameters:
event- application event
-
publish
protected void publish(Collection<com.vaadin.flow.component.UI> uis, org.springframework.context.ApplicationEvent event) -
publishEventForUsers
public void publishEventForUsers(org.springframework.context.ApplicationEvent event, @Nullable Collection<String> usernames) Publishes the event for all UIs in all sessions of users specified in usernames collection. If usernames collection is null the event will be published for all users.- Parameters:
event- event to publishusernames- usernames of target users or null if broadcast to all users is needed
-