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 Classes
    Modifier and Type
    Class
    Description
    static final record 
    Represents the context passed to a close delegate when a ViewTab is closed.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected boolean
     
    protected com.vaadin.flow.component.Component
     
     
    protected com.vaadin.flow.component.HasText
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ViewTab(com.vaadin.flow.component.Component... components)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected com.vaadin.flow.component.Component
     
    protected com.vaadin.flow.component.HasText
     
    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
    Sets the delegate to handle the close event for this tab.
    void
    Sets the label of this tab.
     

    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

      protected static final String 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

      protected Consumer<ViewTab.CloseContext<ViewTab>> closeDelegate
  • Constructor Details

    • ViewTab

      public ViewTab()
    • ViewTab

      public ViewTab(String text)
    • ViewTab

      public ViewTab(com.vaadin.flow.component.Component... components)
  • Method Details

    • initComponent

      protected void initComponent()
    • getText

      @Nullable public String getText()
      Returns the label of this tab.
      Returns:
      the label of this tab, or null if not is set
    • setText

      public void setText(@Nullable String text)
      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 to true, a close button will be added to the tab. If set to false, 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

      public void setCloseDelegate(@Nullable Consumer<ViewTab.CloseContext<ViewTab>> delegate)
      Sets the delegate to handle the close event for this tab.
      Parameters:
      delegate - a close delegate to set, or null to remove
    • toString

      public String toString()
      Overrides:
      toString in class com.vaadin.flow.component.tabs.Tab