Class JmixUI

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.UI
io.jmix.tabbedmode.JmixUI
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.PollNotifier, com.vaadin.flow.router.RouterLayout, Serializable

@Component("tabmod_JmixUI") @Scope("prototype") public class JmixUI extends com.vaadin.flow.component.UI
See Also:
  • Field Details

    • STORAGE_KEY

      public static final String STORAGE_KEY
      See Also:
    • uiId

      protected int uiId
    • internalsHandler

      protected com.vaadin.flow.component.internal.UIInternalUpdater internalsHandler
    • jmixUiId

      protected String jmixUiId
    • applicationContext

      protected final org.springframework.context.ApplicationContext applicationContext
    • views

      protected final Views views
    • redirectHandler

      protected RedirectHandler redirectHandler
    • uiEventPublisher

      protected UiEventPublisher uiEventPublisher
    • viewNavigationSupport

      protected ViewNavigationSupport viewNavigationSupport
    • eventListenerDependencyInjector

      protected EventListenerDependencyInjector eventListenerDependencyInjector
    • topLevelView

      protected View<?> topLevelView
    • clientViewNavigationState

      protected com.vaadin.flow.router.NavigationState clientViewNavigationState
    • forwardToClientUrl

      protected String forwardToClientUrl
    • firstNavigation

      protected boolean firstNavigation
  • Constructor Details

    • JmixUI

      @Autowired public JmixUI(org.springframework.context.ApplicationContext context, Views views)
    • JmixUI

      protected JmixUI(org.springframework.context.ApplicationContext context, Views views, com.vaadin.flow.component.internal.UIInternalUpdater internalsHandler)
  • Method Details

    • createRedirectHandler

      protected RedirectHandler createRedirectHandler(Views views)
    • getRedirectHandler

      public RedirectHandler getRedirectHandler()
      Returns the RedirectHandler associated with this instance.
      Returns:
      the RedirectHandler responsible for handling navigation redirects
    • getJmixUiId

      @Nullable public String getJmixUiId()
      Returns the jmix id of this UI, used to link this UI with a browser tab. When this UI is initialized and a browser tab already has another UI with the same jmix id associated, the content of the previous UI is moved to this.
      Returns:
      the jmix id of this UI
    • getUIId

      public int getUIId()
      Overrides:
      getUIId in class com.vaadin.flow.component.UI
    • getCurrent

      @Nullable public static JmixUI getCurrent()
      Gets the currently used UI. The current UI is automatically defined when processing requests to the server. In other cases, (e.g. from background threads), the current UI is not automatically defined.

      The UI is stored using a weak reference to avoid leaking memory in case it is not explicitly cleared.

      Returns:
      the current UI instance if available, otherwise null
      See Also:
      • UI.setCurrent(UI)
    • getSession

      @Nullable public com.vaadin.flow.server.VaadinSession getSession()
      Overrides:
      getSession in class com.vaadin.flow.component.UI
    • getSessionNN

      protected com.vaadin.flow.server.VaadinSession getSessionNN()
    • getForwardToClientUrl

      @Nullable public String getForwardToClientUrl()
      Overrides:
      getForwardToClientUrl in class com.vaadin.flow.component.UI
    • doInit

      public void doInit(com.vaadin.flow.server.VaadinRequest request, int uiId, String appId)
      Overrides:
      doInit in class com.vaadin.flow.component.UI
    • connectClient

      @Deprecated public void connectClient(String flowRoutePath, String flowRouteQuery, String appShellTitle, elemental.json.JsonValue historyState, String trigger)
      Deprecated.
      Overrides:
      connectClient in class com.vaadin.flow.component.UI
    • browserNavigate

      public void browserNavigate(JmixUI.JmixBrowserNavigateEvent event)
      Connect a client with the server side UI. This method is invoked each time client router navigates to a server route.
      Parameters:
      event - the event from the browser
    • replaceStateIfDiffersAndNoReplacePending

      protected void replaceStateIfDiffersAndNoReplacePending(String route, com.vaadin.flow.router.Location location)
      Do a history replaceState if the trimmed route differs from the event route and there is no pending replaceState command.
      Parameters:
      route - the event.route
      location - the location with the trimmed route
    • leaveNavigation

      @Deprecated public void leaveNavigation(String route, String query)
      Deprecated.
      Overrides:
      leaveNavigation in class com.vaadin.flow.component.UI
    • leaveNavigation

      public void leaveNavigation(JmixUI.JmixBrowserLeaveNavigationEvent event)
      Check that the view can be leave. This method is invoked when the client router tries to navigate to a client route while the current route is a server route.

      This is only called when client route navigates from a server to a client view.

      Parameters:
      event - the event from the browser
    • acknowledgeClient

      protected void acknowledgeClient()
    • cancelClient

      protected void cancelClient()
    • serverPaused

      protected void serverPaused()
    • serverConnected

      protected void serverConnected(boolean cancel)
    • renderViewForRoute

      protected void renderViewForRoute(com.vaadin.flow.router.Location location, com.vaadin.flow.router.NavigationTrigger trigger)
    • shouldHandleNavigation

      protected boolean shouldHandleNavigation(com.vaadin.flow.router.Location location)
    • sameLocation

      protected boolean sameLocation(com.vaadin.flow.router.Location oldLocation, com.vaadin.flow.router.Location newLocation)
    • isPostponed

      protected boolean isPostponed()
    • handleErrorNavigation

      protected void handleErrorNavigation(com.vaadin.flow.router.Location location)
    • getDefaultNavigationError

      protected com.vaadin.flow.router.NavigationState getDefaultNavigationError()
    • handleNavigation

      protected void handleNavigation(com.vaadin.flow.router.Location location, com.vaadin.flow.router.NavigationState navigationState, com.vaadin.flow.router.NavigationTrigger trigger)
    • shouldSkipNavigation

      protected boolean shouldSkipNavigation(com.vaadin.flow.router.NavigationTrigger trigger)
    • skipNavigation

      protected void skipNavigation(com.vaadin.flow.router.Location location, com.vaadin.flow.router.NavigationTrigger trigger)
    • handlePageLoad

      protected void handlePageLoad(com.vaadin.flow.router.Location location, com.vaadin.flow.router.NavigationState navigationState, com.vaadin.flow.router.NavigationTrigger trigger)
    • movePreservedViewCache

      protected void movePreservedViewCache(com.vaadin.flow.router.Location location, com.vaadin.flow.router.NavigationState navigationState, com.vaadin.flow.router.NavigationTrigger trigger, View<?> preservedView)
    • handleNavigationInternal

      protected void handleNavigationInternal(com.vaadin.flow.router.Location location, com.vaadin.flow.router.NavigationState navigationState, com.vaadin.flow.router.NavigationTrigger trigger)
    • handleException

      protected void handleException(com.vaadin.flow.router.Location location, Exception exception)
    • obtainJmixUiId

      protected void obtainJmixUiId(Consumer<String> resultHandler)
    • uiWithSameJmixUiIdExists

      protected boolean uiWithSameJmixUiIdExists(String jmixUiId)
    • findCurrentViewLocationString

      @Nullable protected String findCurrentViewLocationString(JmixUI ui)
    • inferOpenMode

      protected ViewOpenMode inferOpenMode(Class<? extends View<?>> viewClass)
    • getTopLevelView

      public View<?> getTopLevelView()
      Returns the root view of the UI.
      Returns:
      the root view of the UI
      Throws:
      IllegalStateException - in case there is no root view in UI
    • getTopLevelViewOptional

      public Optional<View<?>> getTopLevelViewOptional()
      Returns the root view of the UI if present.
      Returns:
      the root view of the UI if present
    • setTopLevelView

      public void setTopLevelView(@Nullable View<?> topLevelView)
    • getCurrentView

      public View<?> getCurrentView()
      Returns the current active View within this UI context. This method searches for the current view using a prioritized approach:
      1. Dialog windows
      2. Views of the currently opened tab of a WorkArea
      3. The root view
      Overrides:
      getCurrentView in class com.vaadin.flow.component.UI
      Returns:
      the current active View
      Throws:
      IllegalStateException - if the current View is not found
      See Also:
    • findCurrentView

      public Optional<View<?>> findCurrentView()
      Finds the current active view within this UI context. This method searches for the current view using a prioritized approach:
      1. Dialog windows
      2. Views of the currently opened tab of a WorkArea
      3. The root view
      Returns:
      an Optional containing the current view if found; otherwise, an empty Optional
      See Also:
    • showRouterLayoutContent

      public void showRouterLayoutContent(com.vaadin.flow.component.HasElement content)
    • removeRouterLayoutContent

      public void removeRouterLayoutContent(com.vaadin.flow.component.HasElement oldContent)
    • renderTopLevelView

      protected void renderTopLevelView()
    • getPreservedViewCache

      protected Optional<View<?>> getPreservedViewCache(String jmixUiId)
    • setPreservedViewCache

      protected void setPreservedViewCache(String jmixUiId, @Nullable View<?> topLevelView)
    • removePreservedViewCache

      protected void removePreservedViewCache(String jmixUiId)
    • uiEventPublisher

      protected UiEventPublisher uiEventPublisher()
    • viewNavigationSupport

      protected ViewNavigationSupport viewNavigationSupport()
    • eventListenerDependencyInjector

      protected EventListenerDependencyInjector eventListenerDependencyInjector()