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.ApplicationContext
protected com.vaadin.flow.component.orderedlayout.VerticalLayout
protected com.vaadin.flow.component.ShortcutRegistration
protected com.vaadin.flow.component.ShortcutRegistration
protected RouteSupport
protected WorkArea.State
protected TabbedViewsContainer<?>
protected ViewRegistry
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.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.Optional<com.vaadin.flow.component.Component>
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 ofView
stack of currently active tab in descending order, the first element is an active view.Returns the currentViewContainer
instance associated with the selected tab in theTabbedViewsContainer
.com.vaadin.flow.component.orderedlayout.VerticalLayout
Returns the initial layout of thisWorkArea
.int
Returns 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>
getState()
Returns theTabbedViewsContainer
instance associated with the work area.protected boolean
protected void
initTabbedViewsContainer
(TabbedViewsContainer<?> tabbedContainer) protected void
initTabbedViewsContainerShortcuts
(TabbedViewsContainer<?> tabbedContainer) protected void
protected void
requestFocus
(View<?> view) protected RouteSupport
void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setInitialLayout
(com.vaadin.flow.component.orderedlayout.VerticalLayout initialLayout) Sets the initial layout for thisWorkArea
.void
setTabbedViewsContainer
(TabbedViewsContainer<?> tabbedContainer) Sets theTabbedViewsContainer
for this work area.protected void
switchTab
(IntBinaryOperator newIndexCalculator) void
switchTo
(WorkArea.State state) Switches theWorkArea
to the specified state and updates its content layout accordingly.protected void
protected void
protected void
updatePageTitle
(View<?> view) protected void
updateUrl
(com.vaadin.flow.router.Location resolvedLocation) protected ViewRegistry
Methods 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, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface io.jmix.flowui.component.ComponentContainer
findComponent, getComponent, getComponents, getOwnComponent
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods 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, setWidthFull
Methods 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:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
getState
- Returns:
- the current state
-
switchTo
Switches theWorkArea
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
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
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
Returns a collection ofView
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
Returns theTabbedViewsContainer
instance associated with the work area. If the container is not initialized, anIllegalStateException
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
Sets theTabbedViewsContainer
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
- theTabbedViewsContainer
to associate with this work area- Throws:
IllegalStateException
- if the tabbed views container has already been initializedNullPointerException
- iftabbedContainer
isnull
-
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
- ifinitialLayout
is null
-
getCurrentViewContainer
Returns the currentViewContainer
instance 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
ViewContainer
associated with the selected tab, ornull
if 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
- Specified by:
findOwnComponent
in interfaceComponentContainer
-
getOwnComponents
- Specified by:
getOwnComponents
in interfaceComponentContainer
-
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
-