Class Views

java.lang.Object
io.jmix.tabbedmode.Views

@Component("tabmod_Views") public class Views extends Object
API to create and open views.
  • Field Details

    • CLOSE_SAME_VIEW_ACTION

      public static final CloseAction CLOSE_SAME_VIEW_ACTION
    • applicationContext

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

      protected final ViewRegistry viewRegistry
    • uiComponents

      protected final UiComponents uiComponents
    • notifications

      protected final Notifications notifications
    • messages

      protected final Messages messages
    • routeSupport

      protected final RouteSupport routeSupport
    • entityStates

      protected final EntityStates entityStates
    • uiProperties

      protected final UiProperties uiProperties
    • meterRegistry

      protected final io.micrometer.core.instrument.MeterRegistry meterRegistry
    • uiAccessChecker

      protected final UiAccessChecker uiAccessChecker
    • tabbedModeProperties

      protected final TabbedModeProperties tabbedModeProperties
  • Constructor Details

  • Method Details

    • create

      public View<?> create(String viewId)
      Creates a new View instance by the passed view id.
      Parameters:
      viewId - view id to create a new View instance
      Returns:
      a new View instance
    • create

      public <T extends View<?>> T create(Class<T> viewClass)
      Creates a new View instance by the passed view class.
      Type Parameters:
      T - the type of the view to create, which extends View
      Parameters:
      viewClass - the class of the view to create
      Returns:
      a new View instance
    • createInternal

      protected View<?> createInternal(ViewInfo viewInfo)
    • initProperties

      protected void initProperties(View<?> view)
    • checkPermissions

      protected void checkPermissions(ViewInfo viewInfo)
    • open

      public OperationResult open(View<?> view, ViewOpenMode openMode)
      Opens the passed View in the current UI with the passed ViewOpenMode.
      Parameters:
      view - a view to open
      openMode - in which open mode to open a view
      Returns:
      OperationResult with the result of the opening operation
    • open

      public OperationResult open(JmixUI ui, View<?> view, ViewOpenMode openMode)
      Opens the passed View in the given UI with the passed ViewOpenMode.
      Parameters:
      ui - UI in which to open a view
      view - a view to open
      openMode - in which open mode to open a view
      Returns:
      OperationResult with the result of the opening operation
    • open

      public OperationResult open(ViewOpeningContext context)
    • open

      public OperationResult open(JmixUI ui, ViewOpeningContext context)
      Opens a View in the given UI using parameters obtained from passed ViewOpeningContext.
      Parameters:
      ui - UI in which to open a view
      context - context with the view to open and other parameters
      Returns:
      OperationResult with the result of the opening operation
    • closeSameView

      @Nullable protected OperationResult closeSameView(JmixUI ui, ViewOpeningContext context)
    • isMultipleOpen

      protected boolean isMultipleOpen(View<?> view)
    • getActualOpenMode

      protected ViewOpenMode getActualOpenMode(JmixUI ui, ViewOpeningContext context)
    • hasModalDialogWindow

      protected boolean hasModalDialogWindow(JmixUI ui)
    • sendNavigationEvent

      protected void sendNavigationEvent(JmixUI ui, ViewOpeningContext context)
    • checkNotYetOpened

      protected void checkNotYetOpened(View<?> view)
    • updatePageTitle

      protected void updatePageTitle(View<?> view)
    • updatePageTitle

      protected void updatePageTitle(View<?> view, String title)
    • updateUrl

      protected void updateUrl(JmixUI ui, com.vaadin.flow.router.Location newLocation)
    • resolveLocation

      protected com.vaadin.flow.router.Location resolveLocation(View<?> view)
    • resolveLocation

      protected com.vaadin.flow.router.Location resolveLocation(View<?> view, @Nullable ViewOpeningContext context)
    • resolveLocationString

      protected String resolveLocationString(View<?> view, @Nullable ViewOpeningContext context)
    • isRootView

      protected boolean isRootView(com.vaadin.flow.component.Component component)
    • resolveLocationBaseString

      protected String resolveLocationBaseString(View<?> view)
    • getEmptyLocationString

      protected String getEmptyLocationString(View<?> view, @Nullable ViewOpeningContext context)
    • getRouteParamName

      protected String getRouteParamName(StandardDetailView<?> detailView)
    • getRouteConfiguration

      protected com.vaadin.flow.router.RouteConfiguration getRouteConfiguration()
    • getParamValue

      protected Object getParamValue(DetailView<?> detailView)
    • openRootView

      protected void openRootView(JmixUI ui, ViewOpeningContext context)
    • openDialogWindow

      protected void openDialogWindow(JmixUI ui, ViewOpeningContext context)
    • createDialog

      protected <V extends View<?>> DialogWindow<V> createDialog(V view)
    • openThisTab

      protected void openThisTab(JmixUI ui, ViewOpeningContext context)
    • removeThisTabView

      protected void removeThisTabView(WorkArea workArea, View<?> viewToRemove)
    • openNewTab

      protected void openNewTab(JmixUI ui, ViewOpeningContext context)
    • removeNewTabView

      protected void removeNewTabView(WorkArea workArea, View<?> view)
    • createNewTabLayout

      protected void createNewTabLayout(WorkArea workArea, ViewOpeningContext context)
    • updateTabTitle

      protected void updateTabTitle(com.vaadin.flow.component.tabs.Tab tab, String title)
    • onBreadcrumbsNavigate

      protected void onBreadcrumbsNavigate(ViewBreadcrumbs.BreadcrumbsNavigationContext context)
    • handleViewTabClose

      protected void handleViewTabClose(ViewTab.CloseContext<ViewTab> context)
    • createTabCloseTask

      protected Views.TabCloseTask createTabCloseTask(TabbedViewsContainer<?> tabbedContainer, com.vaadin.flow.component.tabs.Tab tab)
    • getLoginViewId

      public String getLoginViewId()
      Returns id of the View that will be used as Login view
      Returns:
      id of the View that will be used as Login view
      See Also:
    • getMainViewId

      public String getMainViewId()
      Returns id of the View that will be used as Main view
      Returns:
      id of the View that will be used as Main view
      See Also:
    • createViewBreadCrumbs

      protected ViewBreadcrumbs createViewBreadCrumbs()
    • findConfiguredWorkArea

      public Optional<WorkArea> findConfiguredWorkArea(JmixUI ui)
      Finds the WorkArea instance for the given JmixUI instance, if available.
      Parameters:
      ui - the JmixUI instance for which the work area is being searched
      Returns:
      an Optional containing the configured WorkArea if found; otherwise, an empty Optional
    • getConfiguredWorkArea

      public WorkArea getConfiguredWorkArea(JmixUI ui)
      Returns the WorkArea instance for the given JmixUI instance.
      Parameters:
      ui - the JmixUI instance for which the work area is being searched
      Returns:
      the WorkArea instance for the given JmixUI instance
      Throws:
      IllegalStateException - if a root view does not have any configured work area
    • getTabbedViewsStacks

      protected Stream<Views.ViewStack> getTabbedViewsStacks(WorkArea workArea)
    • getOpenedViews

      public Views.OpenedViews getOpenedViews()
      Returns an instance of Views.OpenedViews for the current JmixUI instance.
      Returns:
      an instance of Views.OpenedViews for the current JmixUI instance
    • getOpenedViews

      public Views.OpenedViews getOpenedViews(JmixUI ui)
      Returns an instance of Views.OpenedViews for the given JmixUI instance.
      Parameters:
      ui - the JmixUI instance for which to get the Views.OpenedViews
      Returns:
      an instance of Views.OpenedViews for the given JmixUI instance
    • getCurrentView

      public View<?> getCurrentView()
      Returns the current active View for the current JmixUI instance. 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:
      the current active View
      Throws:
      IllegalStateException - if the current View is not found
    • getCurrentView

      public View<?> getCurrentView(JmixUI ui)
      Returns the current active View within a specific 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
      Parameters:
      ui - the JmixUI instance representing the UI context in which to find the current view.
      Returns:
      the current active View
      Throws:
      IllegalStateException - if the current View is not found
    • findCurrentView

      public Optional<View<?>> findCurrentView(JmixUI ui)
      Finds the current active view within a specific 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
      Parameters:
      ui - the JmixUI instance representing the UI context in which to find the current view
      Returns:
      an Optional containing the current view if found; otherwise, an empty Optional
    • fireQueryParametersChangeEvent

      protected void fireQueryParametersChangeEvent(View<?> view, com.vaadin.flow.router.QueryParameters queryParameters)
    • fireViewBeforeShowEvent

      protected void fireViewBeforeShowEvent(View<?> view)
    • fireViewReadyEvent

      protected void fireViewReadyEvent(View<?> view)
    • fireViewOpenedEvent

      protected void fireViewOpenedEvent(View<?> view)
    • isMaxTabCountExceeded

      protected boolean isMaxTabCountExceeded(JmixUI ui, ViewOpenMode openMode)
    • showTooManyOpenTabsMessage

      protected void showTooManyOpenTabsMessage()
    • getCurrentUI

      protected JmixUI getCurrentUI()
    • getUI

      protected JmixUI getUI(com.vaadin.flow.component.Component component)
    • getViewBreadcrumbs

      protected static ViewBreadcrumbs getViewBreadcrumbs(TabbedViewsContainer<?> tabbedContainer, com.vaadin.flow.component.tabs.Tab tab)