Package com.storedobject.vaadin
Class Tabs
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
com.storedobject.vaadin.Tabs
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
- Direct Known Subclasses:
ObjectLinkField.Tabs
public class Tabs
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
This class wraps Vaadin's
Tabs with a Div. Components can be added under each
Tab and will go in the Div when the respective Tab is selected.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe event class that will be fired when tab selection changes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(com.vaadin.flow.component.tabs.Tab tab, com.vaadin.flow.component.Component... components) Add a tab with its components.com.vaadin.flow.shared.RegistrationaddSelectedChangeListener(com.vaadin.flow.component.ComponentEventListener<Tabs.SelectedChangeEvent> listener) Add a tab selection listener.com.vaadin.flow.component.tabs.TabCreate and add a tab with specified components.protected Stream<com.vaadin.flow.component.Component> getChildren(com.vaadin.flow.component.tabs.Tab tab) Get components under a given tab.protected com.vaadin.flow.component.html.DivGet the containerDiv.com.vaadin.flow.component.tabs.Tabs.OrientationGet the current orientation of the tabs.intGet the index of the selected tab.com.vaadin.flow.component.tabs.TabGet the currently selected tab.com.vaadin.flow.component.tabs.TabgetTab(com.vaadin.flow.component.Component component) Get the tab that contains the given component.com.vaadin.flow.component.tabs.TabsgetTabs()Get the embeddedTabs.protected final com.vaadin.flow.component.html.DivInitialize the wrapper.voidremove(com.vaadin.flow.component.tabs.Tab... tabs) Remove tabs.voidRemove all tabs.voidreplace(com.vaadin.flow.component.tabs.Tab oldTab, com.vaadin.flow.component.tabs.Tab newTab) Replace an old tab with a new one.voidsetOrientation(com.vaadin.flow.component.tabs.Tabs.Orientation orientation) Set the orientation of the tabs.voidsetSelectedIndex(int index) Set a tab with a given index as the selected one.voidsetSelectedTab(com.vaadin.flow.component.Component component) Set a tab that contains a particular component as the selected one.voidsetSelectedTab(com.vaadin.flow.component.tabs.Tab tab) Set a tab as the selected one.protected voidtabSelected(com.vaadin.flow.component.tabs.Tab selected) This method will be invoked whenever a tab is selected.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, 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, toString, 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.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
Tabs
public Tabs()Constructor.
-
-
Method Details
-
initContent
protected final com.vaadin.flow.component.html.Div initContent()Initialize the wrapper.- Overrides:
initContentin classcom.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>- Returns:
- The Div that is created.
-
getContainer
protected com.vaadin.flow.component.html.Div getContainer()Get the containerDiv.- Returns:
- The container.
-
getTabs
public com.vaadin.flow.component.tabs.Tabs getTabs()Get the embeddedTabs.- Returns:
- The embedded tabs component.
-
tabSelected
protected void tabSelected(com.vaadin.flow.component.tabs.Tab selected) This method will be invoked whenever a tab is selected. By default, the container will be cleared and then, all components under the selected tab are added to the container. However, this method may be overridden to change that behaviour.- Parameters:
selected- The selected tab
-
getChildren
protected Stream<com.vaadin.flow.component.Component> getChildren(com.vaadin.flow.component.tabs.Tab tab) Get components under a given tab.- Parameters:
tab- Tab- Returns:
- Components as a Stream.
-
createTab
public com.vaadin.flow.component.tabs.Tab createTab(String tabLabel, com.vaadin.flow.component.Component... components) Create and add a tab with specified components.- Parameters:
tabLabel- Label for the tab to be created and addedcomponents- Components to be added to the tab- Returns:
- Newly created tab.
-
add
public void add(com.vaadin.flow.component.tabs.Tab tab, com.vaadin.flow.component.Component... components) Add a tab with its components.- Parameters:
tab- Tab to be added (it could be a tab that was already added)components- Components to be added under it
-
remove
public void remove(com.vaadin.flow.component.tabs.Tab... tabs) Remove tabs.- Parameters:
tabs- Tabs to be removed.
-
removeAll
public void removeAll()Remove all tabs. -
replace
public void replace(com.vaadin.flow.component.tabs.Tab oldTab, com.vaadin.flow.component.tabs.Tab newTab) Replace an old tab with a new one.- Parameters:
oldTab- Old tab to be replacednewTab- New to tab to be set
-
getSelectedTab
public com.vaadin.flow.component.tabs.Tab getSelectedTab()Get the currently selected tab.- Returns:
- Currently selected tab.
-
setSelectedTab
public void setSelectedTab(com.vaadin.flow.component.tabs.Tab tab) Set a tab as the selected one.- Parameters:
tab- Tab to be selected.
-
setSelectedTab
public void setSelectedTab(com.vaadin.flow.component.Component component) Set a tab that contains a particular component as the selected one.- Parameters:
component- Component
-
getSelectedIndex
public int getSelectedIndex()Get the index of the selected tab.- Returns:
- Index of the selected tab.
-
setSelectedIndex
public void setSelectedIndex(int index) Set a tab with a given index as the selected one.- Parameters:
index- Index of the tab to be selected
-
getTab
public com.vaadin.flow.component.tabs.Tab getTab(com.vaadin.flow.component.Component component) Get the tab that contains the given component.- Parameters:
component- Component- Returns:
- Tab that contains the component.
-
addSelectedChangeListener
public com.vaadin.flow.shared.Registration addSelectedChangeListener(com.vaadin.flow.component.ComponentEventListener<Tabs.SelectedChangeEvent> listener) Add a tab selection listener.- Parameters:
listener- Listener to be added- Returns:
- Registration for the listener that is added.
-
setOrientation
public void setOrientation(com.vaadin.flow.component.tabs.Tabs.Orientation orientation) Set the orientation of the tabs.- Parameters:
orientation- Orientation
-
getOrientation
public com.vaadin.flow.component.tabs.Tabs.Orientation getOrientation()Get the current orientation of the tabs.- Returns:
- The current orientation.
-