Class UiEventPublisher

java.lang.Object
io.jmix.flowui.UiEventPublisher

@Component("flowui_UiEventPublisher") public class UiEventPublisher extends Object
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
     }
 
  • Field Details

  • Constructor Details

  • Method Details

    • onUiUserEvent

      @EventListener public void onUiUserEvent(UiEventPublisher.UiUserEvent event)
    • publishEventForUsersInternal

      protected void publishEventForUsersInternal(org.springframework.context.ApplicationEvent event, @Nullable Collection<String> usernames)
    • sendEventToUserSessions

      protected void sendEventToUserSessions(org.springframework.context.ApplicationEvent event, Map<String,List<com.vaadin.flow.server.VaadinSession>> userSessions)
    • 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 in the current 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 publish
      usernames - usernames of target users or null if broadcast to all users is needed