Class JmixTabSheet

java.lang.Object
com.vaadin.flow.component.Component
io.jmix.flowui.component.tabsheet.JmixTabSheet
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.tabs.TabSheetVariant>, ComponentContainer, HasSubParts, Serializable

@Tag("jmix-tabsheet") @JsModule("./src/tabsheet/jmix-tabsheet.js") public class JmixTabSheet extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.tabs.TabSheetVariant>, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, ComponentContainer, HasSubParts
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An event to mark that the selected tab has changed.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected com.vaadin.flow.component.tabs.Tabs
     
    protected Map<com.vaadin.flow.component.tabs.Tab,com.vaadin.flow.component.Component>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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<JmixTabSheet.SelectedChangeEvent> listener)
    Optional<com.vaadin.flow.component.Component>
     
    protected String
     
    Stream<com.vaadin.flow.component.Component>
    Gets the child components of tab sheet in Element tree.
    com.vaadin.flow.component.Component
    getComponent(com.vaadin.flow.component.tabs.Tab tab)
    Returns the Component instance associated with the given tab.
    com.vaadin.flow.component.Component
    getContentByTab(com.vaadin.flow.component.tabs.Tab tab)
     
    int
    getIndexOf(com.vaadin.flow.component.tabs.Tab tab)
    Returns the index of the given tab.
    Collection<com.vaadin.flow.component.Component>
     
    int
    Gets the zero-based index of the currently selected tab.
    com.vaadin.flow.component.tabs.Tab
    Gets the currently selected tab.
     
    com.vaadin.flow.component.tabs.Tab
    getTab(com.vaadin.flow.component.Component content)
    Returns the Tab associated with the given component.
    com.vaadin.flow.component.tabs.Tab
    getTabAt(int position)
    Returns the tab at the given position.
    protected void
     
    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.
    protected void
    Marks the content related to the selected tab as enabled and adds it to the component if it is not already added.

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, 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, toString, wait, wait, wait

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

    addAttachListener

    Methods inherited from interface io.jmix.flowui.component.ComponentContainer

    findComponent, getComponent, getComponents, getOwnComponent

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

    addDetachListener

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

    getElement

    Methods inherited from interface com.vaadin.flow.component.shared.HasPrefix

    getPrefixComponent, setPrefixComponent

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

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    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.shared.HasSuffix

    getSuffixComponent, setSuffixComponent

    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
  • Field Details

    • GENERATED_TAB_ID_PREFIX

      protected static final String GENERATED_TAB_ID_PREFIX
      See Also:
    • tabs

      protected com.vaadin.flow.component.tabs.Tabs tabs
    • tabToContent

      protected Map<com.vaadin.flow.component.tabs.Tab,com.vaadin.flow.component.Component> tabToContent
  • Constructor Details

    • JmixTabSheet

      public JmixTabSheet()
  • Method Details

    • initComponent

      protected void initComponent()
    • add

      public 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

      public 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

      public 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

      public 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

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

      public 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

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

      public com.vaadin.flow.component.Component getContentByTab(com.vaadin.flow.component.tabs.Tab tab)
    • findOwnComponent

      public Optional<com.vaadin.flow.component.Component> findOwnComponent(String id)
      Specified by:
      findOwnComponent in interface ComponentContainer
    • getOwnComponents

      public Collection<com.vaadin.flow.component.Component> getOwnComponents()
      Specified by:
      getOwnComponents in interface ComponentContainer
    • getChildren

      public Stream<com.vaadin.flow.component.Component> getChildren()
      Gets the child components of tab sheet in Element tree.
      Overrides:
      getChildren in class com.vaadin.flow.component.Component
      Returns:
      the stream of tab sheet tab
    • getSelectedIndex

      public 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

      public 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

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

      public void setSelectedTab(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
    • getTabAt

      public 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

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

      @Nullable public 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, can not be null
      Returns:
      The tab instance associated with the given component, or null if the TabSheet does not contain the component.
    • getComponent

      @Nullable public 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 look up, can not be null
      Returns:
      The component instance associated with the given tab, or null if the TabSheet does not contain the tab.
    • addSelectedChangeListener

      public com.vaadin.flow.shared.Registration addSelectedChangeListener(com.vaadin.flow.component.ComponentEventListener<JmixTabSheet.SelectedChangeEvent> listener)
      Parameters:
      listener - the listener to add, not null
      Returns:
      a handle that can be used for removing the listener
    • updateContent

      protected void updateContent()
      Marks the content related to the selected tab as enabled and adds it to the component if it is not already added. All the other content panels are disabled so they can't be interacted with.
    • generateTabId

      protected String generateTabId()
    • getSubPart

      @Nullable public Object getSubPart(String name)
      Specified by:
      getSubPart in interface HasSubParts