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:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected com.vaadin.flow.component.orderedlayout.VerticalLayoutprotected com.vaadin.flow.component.ShortcutRegistrationprotected com.vaadin.flow.component.ShortcutRegistrationprotected RouteSupportprotected WorkArea.Stateprotected TabbedViewsContainer<?>protected ViewRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddStateChangeListener(com.vaadin.flow.component.ComponentEventListener<WorkArea.StateChangeEvent> listener) Adds a listener that will be notified when a work area state is changed.Optional<com.vaadin.flow.component.Component>Finds a component within immediate children of the container by its unique identifier.protected Optional<ViewBreadcrumbs.ViewInfo>findViewInfo(com.vaadin.flow.component.tabs.Tab tab) Collection<View<?>>Returns a collection of active views currently displayed in the work area's tabbed view container.Collection<View<?>>Returns a collection ofViewstack of currently active tab in descending order, the first element is an active view.Returns the currentViewContainerinstance associated with the selected tab in theTabbedViewsContainer.com.vaadin.flow.component.orderedlayout.VerticalLayoutReturns the initial layout of thisWorkArea.intReturns the count of opened tabs within theTabbedViewsContainer.Collection<View<?>>Returns a collection of all views currently opened in the work area's tabbed view container.Collection<com.vaadin.flow.component.Component>Returns a collection of components that are direct children (immediate descendants) of the container.getState()Returns theTabbedViewsContainerinstance associated with the work area.protected booleanprotected voidinitTabbedViewsContainer(TabbedViewsContainer<?> tabbedContainer) protected voidinitTabbedViewsContainerShortcuts(TabbedViewsContainer<?> tabbedContainer) protected voidprotected voidrequestFocus(View<?> view) protected RouteSupportvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetInitialLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout initialLayout) Sets the initial layout for thisWorkArea.voidsetTabbedViewsContainer(TabbedViewsContainer<?> tabbedContainer) Sets theTabbedViewsContainerfor this work area.protected voidswitchTab(IntBinaryOperator newIndexCalculator) voidswitchTo(WorkArea.State state) Switches theWorkAreato the specified state and updates its content layout accordingly.protected voidprotected voidprotected voidupdatePageTitle(View<?> view) protected voidupdateUrl(com.vaadin.flow.router.Location resolvedLocation) protected ViewRegistryMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface io.jmix.flowui.component.ComponentContainer
findComponent, getComponent, getComponents, getOwnComponentMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
routeSupport
-
viewRegistry
-
state
-
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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getState
- Returns:
- the current state
-
switchTo
Switches theWorkAreato 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
Returns a collection of all views currently opened in the work area's tabbed view container.- Returns:
- a collection of
Viewobjects representing the views currently opened in the tabbed view container.
-
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
Viewobjects representing the active views in the tabbed view container
-
getCurrentBreadcrumbs
Returns a collection ofViewstack of currently active tab in descending order, the first element is an active view.- Returns:
- a collection of
Viewstack representing the current breadcrumbs, or an empty collection if no breadcrumbs are available.
-
getTabbedViewsContainer
Returns theTabbedViewsContainerinstance associated with the work area. If the container is not initialized, anIllegalStateExceptionis thrown.- Returns:
- the
TabbedViewsContainerinstance representing the tabbed view container of the work area - Throws:
IllegalStateException- if the tabbed view container is not initialized
-
setTabbedViewsContainer
Sets theTabbedViewsContainerfor 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- theTabbedViewsContainerto associate with this work area- Throws:
IllegalStateException- if the tabbed views container has already been initializedNullPointerException- iftabbedContainerisnull
-
initTabbedViewsContainer
-
initTabbedViewsContainerShortcuts
-
switchToNextTab
protected void switchToNextTab() -
switchToPreviousTab
protected void switchToPreviousTab() -
switchTab
-
hasModalWindows
protected boolean hasModalWindows() -
requestFocus
-
onSelectedTabChanged
-
findViewInfo
-
updateUrl
protected void updateUrl(com.vaadin.flow.router.Location resolvedLocation) -
updatePageTitle
-
getInitialLayout
public com.vaadin.flow.component.orderedlayout.VerticalLayout getInitialLayout()Returns the initial layout of thisWorkArea. The initial layout is displayed when no tabs are opened in theTabbedViewsContainer.- 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 thisWorkArea. Initial layout is displayed when no tabs are opened in theTabbedViewsContainer.- Parameters:
initialLayout- the new initial layout to be set- Throws:
IllegalArgumentException- ifinitialLayoutis null
-
getCurrentViewContainer
Returns the currentViewContainerinstance associated with the selected tab in theTabbedViewsContainer. If no tab is selected, returnsnull. If the content of the selected tab is not a validViewContainer, an exception is thrown.- Returns:
- the current
ViewContainerassociated with the selected tab, ornullif no tab is selected - Throws:
IllegalStateException- if the content of the selected tab is not an instance ofViewContainer
-
getOpenedTabCount
public int getOpenedTabCount()Returns the count of opened tabs within theTabbedViewsContainer.- Returns:
- the total number of opened tabs
-
findOwnComponent
Description copied from interface:ComponentContainerFinds a component within immediate children of the container by its unique identifier.- Specified by:
findOwnComponentin interfaceComponentContainer- Parameters:
id- the unique identifier of the component to find- Returns:
- an
Optionalcontaining the found component if it exists within the immediate children of the container, or an emptyOptionalif no component with the given identifier is found
-
getOwnComponents
Description copied from interface:ComponentContainerReturns a collection of components that are direct children (immediate descendants) of the container.- Specified by:
getOwnComponentsin interfaceComponentContainer- Returns:
- a collection of
Componentinstances representing the immediate children of the container, or an empty collection if no such components exist
-
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
-
viewRegistry
-