Class ViewTab
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.tabs.Tab
io.jmix.tabbedmode.component.tabsheet.ViewTab
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.dnd.DragSource<ViewTab>
,com.vaadin.flow.component.HasAriaLabel
,com.vaadin.flow.component.HasComponents
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasLabel
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasTheme
,com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.tabs.TabVariant>
,com.vaadin.flow.component.shared.HasTooltip
,Serializable
@Tag("jmix-view-tab")
@JsModule("./src/tabsheet/jmix-view-tab.js")
@CssImport("./src/tabsheet/jmix-view-tab.css")
public class ViewTab
extends com.vaadin.flow.component.tabs.Tab
implements com.vaadin.flow.component.dnd.DragSource<ViewTab>
A tab component designed for use in a
MainTabSheet
. Provides additional functionality,
such as support for tab closing and dragging.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
ViewTab.CloseContext<C extends ViewTab>
Represents the context passed to a close delegate when aViewTab
is closed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected boolean
protected com.vaadin.flow.component.Component
protected Consumer<ViewTab.CloseContext<ViewTab>>
protected com.vaadin.flow.component.HasText
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected com.vaadin.flow.component.Component
protected com.vaadin.flow.component.HasText
getText()
Returns the label of this tab.protected void
boolean
Returns whether this tab is closable or not.protected void
onCloseButtonClicked
(com.vaadin.flow.dom.DomEvent event) void
setClosable
(boolean closable) Sets whether the tab can be closed or not.void
setCloseDelegate
(Consumer<ViewTab.CloseContext<ViewTab>> delegate) Sets the delegate to handle the close event for this tab.void
Sets the label of this tab.toString()
Methods inherited from class com.vaadin.flow.component.tabs.Tab
getFlexGrow, getLabel, isSelected, setFlexGrow, setLabel, setSelected
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, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.dnd.DragSource
addDragEndListener, addDragStartListener, getDragData, getDraggableElement, getDragImage, getDragSourceComponent, getEffectAllowed, getElement, isDraggable, setDragData, setDraggable, setDragImage, setDragImage, setEffectAllowed
Methods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledBy
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariants
Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
-
Field Details
-
BASE_CLASS_NAME
- See Also:
-
textElement
protected com.vaadin.flow.component.HasText textElement -
closeButton
protected com.vaadin.flow.component.Component closeButton -
closable
protected boolean closable -
closeDelegate
-
-
Constructor Details
-
ViewTab
public ViewTab() -
ViewTab
-
ViewTab
public ViewTab(com.vaadin.flow.component.Component... components)
-
-
Method Details
-
initComponent
protected void initComponent() -
getText
Returns the label of this tab.- Returns:
- the label of this tab, or
null
if not is set
-
setText
Sets the label of this tab.- Parameters:
text
- the label to display
-
createTextElement
protected com.vaadin.flow.component.HasText createTextElement() -
isClosable
public boolean isClosable()Returns whether this tab is closable or not.- Returns:
true
if the tab is closable,false
otherwise
-
setClosable
public void setClosable(boolean closable) Sets whether the tab can be closed or not. If set totrue
, a close button will be added to the tab. If set tofalse
, the close button will be removed.- Parameters:
closable
- whether the tab should be closable
-
createCloseButton
protected com.vaadin.flow.component.Component createCloseButton() -
onCloseButtonClicked
protected void onCloseButtonClicked(com.vaadin.flow.dom.DomEvent event) -
closeInternal
protected void closeInternal() -
setCloseDelegate
Sets the delegate to handle the close event for this tab.- Parameters:
delegate
- a close delegate to set, ornull
to remove
-
toString
- Overrides:
toString
in classcom.vaadin.flow.component.tabs.Tab
-