Class WorkArea

java.lang.Object
com.vaadin.flow.component.Component
io.jmix.tabbedmode.component.workarea.WorkArea
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, ComponentContainer, Serializable, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Tag("jmix-work-area") @JsModule("./src/workarea/jmix-work-area.js") public class WorkArea extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasSize, ComponentContainer, org.springframework.context.ApplicationContextAware
See Also:
  • Field Details

    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • routeSupport

      protected RouteSupport routeSupport
    • viewRegistry

      protected ViewRegistry viewRegistry
    • state

      protected WorkArea.State state
    • tabbedContainer

      protected TabbedViewsContainer<?> tabbedContainer
    • initialLayout

      protected com.vaadin.flow.component.orderedlayout.VerticalLayout initialLayout
    • nextTabShortcutRegistration

      protected com.vaadin.flow.component.ShortcutRegistration nextTabShortcutRegistration
    • previousTabShortcutRegistration

      protected com.vaadin.flow.component.ShortcutRegistration previousTabShortcutRegistration
  • Constructor Details

    • WorkArea

      public WorkArea()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • getState

      public WorkArea.State getState()
      Returns:
      the current state
    • switchTo

      public void switchTo(WorkArea.State state)
      Switches the WorkArea to the specified state and updates its content layout accordingly.
      Parameters:
      state - the new state to switch to
      Throws:
      IllegalStateException - if an unsupported state is passed.
    • getOpenedWorkAreaViews

      public Collection<View<?>> getOpenedWorkAreaViews()
      Returns a collection of all views currently opened in the work area's tabbed view container.
      Returns:
      a collection of View objects representing the views currently opened in the tabbed view container.
    • getActiveWorkAreaViews

      public Collection<View<?>> getActiveWorkAreaViews()
      Returns a collection of active views currently displayed in the work area's tabbed view container. An active view corresponds to the views associated with the current components within the tabs.
      Returns:
      a collection of View objects representing the active views in the tabbed view container
    • getCurrentBreadcrumbs

      public Collection<View<?>> getCurrentBreadcrumbs()
      Returns a collection of View stack of currently active tab in descending order, the first element is an active view.
      Returns:
      a collection of View stack representing the current breadcrumbs, or an empty collection if no breadcrumbs are available.
    • getTabbedViewsContainer

      public TabbedViewsContainer<?> getTabbedViewsContainer()
      Returns the TabbedViewsContainer instance associated with the work area. If the container is not initialized, an IllegalStateException is thrown.
      Returns:
      the TabbedViewsContainer instance representing the tabbed view container of the work area
      Throws:
      IllegalStateException - if the tabbed view container is not initialized
    • setTabbedViewsContainer

      public void setTabbedViewsContainer(TabbedViewsContainer<?> tabbedContainer)
      Sets the TabbedViewsContainer for this work area. The tabbed views container is responsible for managing tabbed views within the work area. This method ensures that the container is initialized only once and will throw an exception if a container has already been set.
      Parameters:
      tabbedContainer - the TabbedViewsContainer to associate with this work area
      Throws:
      IllegalStateException - if the tabbed views container has already been initialized
      NullPointerException - if tabbedContainer is null
    • initTabbedViewsContainer

      protected void initTabbedViewsContainer(TabbedViewsContainer<?> tabbedContainer)
    • initTabbedViewsContainerShortcuts

      protected void initTabbedViewsContainerShortcuts(TabbedViewsContainer<?> tabbedContainer)
    • switchToNextTab

      protected void switchToNextTab()
    • switchToPreviousTab

      protected void switchToPreviousTab()
    • switchTab

      protected void switchTab(IntBinaryOperator newIndexCalculator)
    • hasModalWindows

      protected boolean hasModalWindows()
    • requestFocus

      protected void requestFocus(View<?> view)
    • onSelectedTabChanged

      protected void onSelectedTabChanged(TabbedViewsContainer.SelectedChangeEvent<?> event)
    • findViewInfo

      protected Optional<ViewBreadcrumbs.ViewInfo> findViewInfo(com.vaadin.flow.component.tabs.Tab tab)
    • updateUrl

      protected void updateUrl(com.vaadin.flow.router.Location resolvedLocation)
    • updatePageTitle

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

      public com.vaadin.flow.component.orderedlayout.VerticalLayout getInitialLayout()
      Returns the initial layout of this WorkArea. The initial layout is displayed when no tabs are opened in the TabbedViewsContainer.
      Returns:
      the initial layout instance
      Throws:
      IllegalStateException - if the initial layout is not initialized
    • setInitialLayout

      public void setInitialLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout initialLayout)
      Sets the initial layout for this WorkArea. Initial layout is displayed when no tabs are opened in the TabbedViewsContainer.
      Parameters:
      initialLayout - the new initial layout to be set
      Throws:
      IllegalArgumentException - if initialLayout is null
    • getCurrentViewContainer

      @Nullable public ViewContainer getCurrentViewContainer()
      Returns the current ViewContainer instance associated with the selected tab in the TabbedViewsContainer. If no tab is selected, returns null. If the content of the selected tab is not a valid ViewContainer, an exception is thrown.
      Returns:
      the current ViewContainer associated with the selected tab, or null if no tab is selected
      Throws:
      IllegalStateException - if the content of the selected tab is not an instance of ViewContainer
    • getOpenedTabCount

      public int getOpenedTabCount()
      Returns the count of opened tabs within the TabbedViewsContainer.
      Returns:
      the total number of opened tabs
    • findOwnComponent

      public Optional<com.vaadin.flow.component.Component> findOwnComponent(String id)
      Specified by:
      findOwnComponent in interface ComponentContainer
    • getOwnComponents

      public Collection<com.vaadin.flow.component.Component> getOwnComponents()
      Specified by:
      getOwnComponents in interface ComponentContainer
    • addStateChangeListener

      public com.vaadin.flow.shared.Registration addStateChangeListener(com.vaadin.flow.component.ComponentEventListener<WorkArea.StateChangeEvent> listener)
      Adds a listener that will be notified when a work area state is changed.
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • routeSupport

      protected RouteSupport routeSupport()
    • viewRegistry

      protected ViewRegistry viewRegistry()