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 recordViewTab.CloseContext<C extends ViewTab>Represents the context passed to a close delegate when aViewTabis closed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected booleanprotected com.vaadin.flow.component.Componentprotected Consumer<ViewTab.CloseContext<ViewTab>>protected com.vaadin.flow.component.HasText -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected com.vaadin.flow.component.Componentprotected com.vaadin.flow.component.HasTextgetText()Returns the label of this tab.protected voidbooleanReturns whether this tab is closable or not.protected voidonCloseButtonClicked(com.vaadin.flow.dom.DomEvent event) voidsetClosable(boolean closable) Sets whether the tab can be closed or not.voidsetCloseDelegate(Consumer<ViewTab.CloseContext<ViewTab>> delegate) Sets the delegate to handle the close event for this tab.voidSets the label of this tab.toString()Methods inherited from class com.vaadin.flow.component.tabs.Tab
getFlexGrow, getLabel, isSelected, setFlexGrow, setLabel, setSelectedMethods 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, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.dnd.DragSource
addDragEndListener, addDragStartListener, getDragData, getDraggableElement, getDragImage, getDragSourceComponent, getEffectAllowed, getElement, isDraggable, setDragData, setDraggable, setDragImage, setDragImage, setEffectAllowedMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariantsMethods 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
nullif 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:
trueif the tab is closable,falseotherwise
-
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, ornullto remove
-
toString
- Overrides:
toStringin classcom.vaadin.flow.component.tabs.Tab
-