Class Tab

  • All Implemented Interfaces:
    com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, 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, HasTooltip, Serializable

    public class Tab
    extends GeneratedVaadinTab<Tab>
    implements com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasLabel, HasTooltip
    This component provides an accessible and customizable tab to be used inside Tabs component.
    Author:
    Vaadin Ltd.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Tab()
      Constructs a new object in its default state.
      Tab​(com.vaadin.flow.component.Component... components)
      Constructs a new object with child components.
      Tab​(String label)
      Constructs a new object with the given label.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addThemeVariants​(TabVariant... variants)
      Adds theme variants to the component.
      double getFlexGrow()
      Gets the flex grow property of this tab.
      String getLabel()
      Gets the label of this tab.
      boolean isSelected()
      If true, the item is in selected state.
      void removeThemeVariants​(TabVariant... variants)
      Removes theme variants from the component.
      void setFlexGrow​(double flexGrow)
      Sets the flex grow property of this tab.
      void setLabel​(String label)
      Sets the label of this tab.
      void setSelected​(boolean selected)
      Description copied from corresponding location in WebComponent:
      String toString()  
      • 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, scrollIntoView, set, setElement, setId, setVisible
      • 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.HasComponents

        add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll
      • Methods inherited from interface com.vaadin.flow.component.HasElement

        getElement
      • 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
    • Constructor Detail

      • Tab

        public Tab()
        Constructs a new object in its default state.
      • Tab

        public Tab​(String label)
        Constructs a new object with the given label.
        Parameters:
        label - the label to display
      • Tab

        public Tab​(com.vaadin.flow.component.Component... components)
        Constructs a new object with child components.
        Parameters:
        components - the child components
    • Method Detail

      • getLabel

        public final String getLabel()
        Gets the label of this tab.
        Specified by:
        getLabel in interface com.vaadin.flow.component.HasLabel
        Returns:
        the label
      • setLabel

        public final void setLabel​(String label)
        Sets the label of this tab.
        Specified by:
        setLabel in interface com.vaadin.flow.component.HasLabel
        Parameters:
        label - the label to display
      • setFlexGrow

        public void setFlexGrow​(double flexGrow)
        Sets the flex grow property of this tab. The flex grow property specifies what amount of the available space inside the layout the component should take up, proportionally to the other components.

        For example, if all components have a flex grow property value set to 1, the remaining space in the layout will be distributed equally to all components inside the layout. If you set a flex grow property of one component to 2, that component will take twice the available space as the other components, and so on.

        Setting to flex grow property value 0 disables the expansion of the component. Negative values are not allowed.

        Parameters:
        flexGrow - the proportion of the available space the tab should take up
      • getFlexGrow

        public double getFlexGrow()
        Gets the flex grow property of this tab.
        Returns:
        the flex grow property, or 0 if none was set
      • setSelected

        public void setSelected​(boolean selected)
        Description copied from class: GeneratedVaadinTab

        Description copied from corresponding location in WebComponent:

        If true, the item is in selected state.

        Overrides:
        setSelected in class GeneratedVaadinTab<Tab>
        Parameters:
        selected - the boolean value to set
      • isSelected

        public boolean isSelected()
        If true, the item is in selected state.

        This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

        If a Tab instance is used inside Tabs component then selected state is updated based on currently selected tab. So the value is the same as Tabs.getSelectedTab().
        Returns:
        the selected property from the webcomponent
        See Also:
        Tabs.getSelectedTab()