Interface TabbedViewsContainer<C extends com.vaadin.flow.component.Component & TabbedViewsContainer<C>>

Type Parameters:
C - the component type that extends both Component and TabbedViewsContainer
All Superinterfaces:
com.vaadin.flow.component.HasElement, Serializable
All Known Implementing Classes:
MainTabSheet

public interface TabbedViewsContainer<C extends com.vaadin.flow.component.Component & TabbedViewsContainer<C>> extends com.vaadin.flow.component.HasElement
Interface representing a container for tabbed views, allowing management of tabs and their associated content.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    TabbedViewsContainer.SelectedChangeEvent<C extends com.vaadin.flow.component.Component & TabbedViewsContainer<C>>
    An event to mark that the selected tab has changed.
    static class 
    TabbedViewsContainer.TabsCollectionChangeEvent<C extends com.vaadin.flow.component.Component & TabbedViewsContainer<C>>
    An event that is fired every time tabs collection is changed.
    static enum 
    Defines the type of tab change.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.component.tabs.Tab
    add(com.vaadin.flow.component.Component tabContent, com.vaadin.flow.component.Component content)
    Adds a tab created from the given tab content and content.
    com.vaadin.flow.component.tabs.Tab
    add(com.vaadin.flow.component.tabs.Tab tab, com.vaadin.flow.component.Component content)
    Adds a tab with the given content.
    com.vaadin.flow.component.tabs.Tab
    add(com.vaadin.flow.component.tabs.Tab tab, com.vaadin.flow.component.Component content, int position)
    Adds a tab with the given content to the given position.
    com.vaadin.flow.component.tabs.Tab
    add(String tabText, com.vaadin.flow.component.Component content)
    Adds a tab created from the given text and content.
    com.vaadin.flow.shared.Registration
    addSelectedChangeListener(com.vaadin.flow.component.ComponentEventListener<TabbedViewsContainer.SelectedChangeEvent<C>> listener)
    com.vaadin.flow.shared.Registration
    addTabsCollectionChangeListener(com.vaadin.flow.component.ComponentEventListener<TabbedViewsContainer.TabsCollectionChangeEvent<C>> listener)
    Optional<com.vaadin.flow.component.Component>
    findComponent(com.vaadin.flow.component.tabs.Tab tab)
    Returns the Component instance associated with the given tab.
    Optional<com.vaadin.flow.component.tabs.Tab>
    findTab(com.vaadin.flow.component.Component content)
    Returns the Tab associated with the given component.
    Optional<com.vaadin.flow.component.tabs.Tab>
    Returns the Tab associated with the given ID.
    com.vaadin.flow.component.Component
    getComponent(com.vaadin.flow.component.tabs.Tab tab)
    Returns the Component instance associated with the given tab.
    int
    getIndexOf(com.vaadin.flow.component.tabs.Tab tab)
    Returns the index of the given tab.
    int
    Gets the zero-based index of the currently selected tab.
    com.vaadin.flow.component.tabs.Tab
    Gets the currently selected tab.
    default com.vaadin.flow.component.tabs.Tab
    getTab(com.vaadin.flow.component.Component content)
    Returns the Tab associated with the given component.
    default com.vaadin.flow.component.tabs.Tab
    Returns the Tab associated with the given ID.
    com.vaadin.flow.component.tabs.Tab
    getTabAt(int position)
    Returns the tab at the given position.
    Stream<com.vaadin.flow.component.Component>
    Returns a stream of Component instances representing the tab content.
    int
    Gets the number of tabs.
    Stream<com.vaadin.flow.component.tabs.Tab>
    Returns a stream of all the tabs in this container.
    void
    remove(int position)
    Removes the tab at the given position.
    void
    remove(com.vaadin.flow.component.Component content)
    Removes a tab based on the content
    void
    remove(com.vaadin.flow.component.tabs.Tab tab)
    Removes a tab.
    void
    setSelectedIndex(int selectedIndex)
    Selects a tab based on its zero-based index.
    void
    setSelectedTab(com.vaadin.flow.component.tabs.Tab selectedTab)
    Selects the given tab.

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement
  • Method Details

    • add

      com.vaadin.flow.component.tabs.Tab add(String tabText, com.vaadin.flow.component.Component content)
      Adds a tab created from the given text and content.
      Parameters:
      tabText - the text of the tab
      content - the content related to the tab
      Returns:
      the created tab
    • add

      com.vaadin.flow.component.tabs.Tab add(com.vaadin.flow.component.Component tabContent, com.vaadin.flow.component.Component content)
      Adds a tab created from the given tab content and content.
      Parameters:
      tabContent - the content of the tab
      content - the content related to the tab
      Returns:
      the created tab
    • add

      com.vaadin.flow.component.tabs.Tab add(com.vaadin.flow.component.tabs.Tab tab, com.vaadin.flow.component.Component content)
      Adds a tab with the given content.
      Parameters:
      tab - the tab
      content - the content related to the tab
      Returns:
      the added tab
    • add

      com.vaadin.flow.component.tabs.Tab add(com.vaadin.flow.component.tabs.Tab tab, com.vaadin.flow.component.Component content, int position)
      Adds a tab with the given content to the given position.
      Parameters:
      tab - the tab
      content - the content related to the tab
      position - the position where the tab should be added. If negative, the tab is added at the end.
      Returns:
      the added tab
    • remove

      void remove(com.vaadin.flow.component.tabs.Tab tab)
      Removes a tab.
      Parameters:
      tab - the non-null tab to be removed
    • remove

      void remove(com.vaadin.flow.component.Component content)
      Removes a tab based on the content
      Parameters:
      content - the non-null content related to the tab to be removed
    • remove

      void remove(int position)
      Removes the tab at the given position.
      Parameters:
      position - the position of the tab to be removed
    • getSelectedIndex

      int getSelectedIndex()
      Gets the zero-based index of the currently selected tab.
      Returns:
      the zero-based index of the selected tab, or -1 if none of the tabs is selected
    • setSelectedIndex

      void setSelectedIndex(int selectedIndex)
      Selects a tab based on its zero-based index.
      Parameters:
      selectedIndex - the zero-based index of the selected tab, -1 to unselect all
    • getSelectedTab

      @Nullable com.vaadin.flow.component.tabs.Tab getSelectedTab()
      Gets the currently selected tab.
      Returns:
      the selected tab, or null if none is selected
    • setSelectedTab

      void setSelectedTab(@Nullable com.vaadin.flow.component.tabs.Tab selectedTab)
      Selects the given tab.
      Parameters:
      selectedTab - the tab to select, null to unselect all
      Throws:
      IllegalArgumentException - if selectedTab is not a child of this component
    • getTabCount

      int getTabCount()
      Gets the number of tabs.
      Returns:
      the number of tabs
    • getTabsStream

      Stream<com.vaadin.flow.component.tabs.Tab> getTabsStream()
      Returns a stream of all the tabs in this container.
      Returns:
      a stream of Tab instances in the container
    • getTabAt

      com.vaadin.flow.component.tabs.Tab getTabAt(int position)
      Returns the tab at the given position.
      Parameters:
      position - the position of the tab must be greater than or equals to 0 and less than the number of tabs
      Returns:
      The tab at the given index
      Throws:
      IllegalArgumentException - if the index is less than 0 or greater than or equals to the number of tabs
    • getIndexOf

      int getIndexOf(com.vaadin.flow.component.tabs.Tab tab)
      Returns the index of the given tab.
      Parameters:
      tab - the tab to look up
      Returns:
      the index of the tab or -1 if the tab is not added
    • getTab

      default com.vaadin.flow.component.tabs.Tab getTab(com.vaadin.flow.component.Component content)
      Returns the Tab associated with the given component.
      Parameters:
      content - the component to look up
      Returns:
      The tab instance associated with the given component
      Throws:
      IllegalArgumentException - if tab not found
    • findTab

      Optional<com.vaadin.flow.component.tabs.Tab> findTab(com.vaadin.flow.component.Component content)
      Returns the Tab associated with the given component.
      Parameters:
      content - the component to look up
      Returns:
      The tab instance associated with the given component, or an empty Optional if the TabSheet does not contain the Tab associated with the given component
    • getTab

      default com.vaadin.flow.component.tabs.Tab getTab(String id)
      Returns the Tab associated with the given ID.
      Parameters:
      id - the ID of the tab to retrieve
      Returns:
      the Tab associated with the specified ID
      Throws:
      IllegalArgumentException - if no tab is found with the given ID
    • findTab

      Optional<com.vaadin.flow.component.tabs.Tab> findTab(String id)
      Returns the Tab associated with the given ID.
      Parameters:
      id - the ID of the tab to retrieve
      Returns:
      the Tab associated with the specified ID, or an empty Optional if no tab is found with the given ID
    • getComponent

      com.vaadin.flow.component.Component getComponent(com.vaadin.flow.component.tabs.Tab tab)
      Returns the Component instance associated with the given tab.
      Parameters:
      tab - the tab to get component
      Returns:
      the component instance associated with the given tab
      Throws:
      IllegalArgumentException - if component not found
    • findComponent

      Optional<com.vaadin.flow.component.Component> findComponent(com.vaadin.flow.component.tabs.Tab tab)
      Returns the Component instance associated with the given tab.
      Parameters:
      tab - the tab to get component
      Returns:
      the component instance associated with the given tab, or an empty optional if not found
    • getTabComponentsStream

      Stream<com.vaadin.flow.component.Component> getTabComponentsStream()
      Returns a stream of Component instances representing the tab content.
      Returns:
      a stream of Component instances representing the tab content
    • addSelectedChangeListener

      com.vaadin.flow.shared.Registration addSelectedChangeListener(com.vaadin.flow.component.ComponentEventListener<TabbedViewsContainer.SelectedChangeEvent<C>> listener)
      Parameters:
      listener - the listener to add
      Returns:
      a handle that can be used for removing the listener
    • addTabsCollectionChangeListener

      com.vaadin.flow.shared.Registration addTabsCollectionChangeListener(com.vaadin.flow.component.ComponentEventListener<TabbedViewsContainer.TabsCollectionChangeEvent<C>> listener)
      Parameters:
      listener - the listener to add
      Returns:
      a handle that can be used for removing the listener