Class TabSheetLocator

java.lang.Object
com.vaadin.browserless.locator.Locator<TabSheet,TabSheetLocator>
com.vaadin.flow.component.tabs.TabSheetLocator
All Implemented Interfaces:
Clickable<TabSheet>, HasThemeFilter<TabSheet,TabSheetLocator>

@Generated("com.vaadin.browserless.locator.processor.LocatorProcessor") public class TabSheetLocator extends Locator<TabSheet,TabSheetLocator> implements Clickable<TabSheet>, HasThemeFilter<TabSheet,TabSheetLocator>
Generated locator for TabSheet, derived from TabSheetTester. Filter steps are inherited from Locator; action methods delegate to a fresh tester around the resolved component, so behavioral changes belong on the tester, not here.
  • Constructor Details

    • TabSheetLocator

      public TabSheetLocator()
      Creates a locator that searches for a TabSheet.
    • TabSheetLocator

      public TabSheetLocator(TabSheet component)
      Creates a locator already bound to the given component, so that the action methods run against it instead of against a lookup.
      Parameters:
      component - the component the locator resolves to
  • Method Details

    • getComponent

      public TabSheet getComponent()
      Description copied from interface: Clickable
      Gets the component being tested.
      Specified by:
      getComponent in interface Clickable<TabSheet>
      Returns:
      the component under test
    • ensureComponentIsUsable

      public void ensureComponentIsUsable()
      Description copied from interface: Clickable
      Ensures the component is in a usable state before interaction.
      Specified by:
      ensureComponentIsUsable in interface Clickable<TabSheet>
    • select

      public void select(String label)
      Selects the tab with the given label. Javadoc copied from TabSheetTester.select(java.lang.String).
      Parameters:
      label - the tab label
      Throws:
      IllegalArgumentException - if the tab with given label is not visible.
      IllegalStateException - if tab is not usable in the browser
    • select

      public void select(int index)
      Selects a visible tab based on its zero-based index.

      The index refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to select tab 'C' the call must be select(1) and not select(2). Javadoc copied from TabSheetTester.select(int).

      Parameters:
      index - the zero-based index of the selected tab, negative value to unselect
      Throws:
      IllegalStateException - if tab at give index is not usable in the browser
    • isSelected

      public boolean isSelected(String label)
      Checks if the tab with the given label is currently selected. Javadoc copied from TabSheetTester.isSelected(java.lang.String).
      Parameters:
      label - the tab label
      Returns:
      true if the tab is selected, false otherwise.
      Throws:
      IllegalArgumentException - if the tab with given label is not visible.
    • isSelected

      public boolean isSelected(int index)
      Checks if the visible tab at the given index is currently selected.

      The index refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to check if tab 'C' is selected the call must be isSelected(1) and not isSelected(2). Javadoc copied from TabSheetTester.isSelected(int).

      Parameters:
      index - the zero-based index of the tab
      Returns:
      true if the tab is selected, false otherwise.
      Throws:
      IllegalStateException - if tab at given index is not visible in the browser
    • getTab

      public Tab getTab(String label)
      Gets the visible tab with the given label. Javadoc copied from TabSheetTester.getTab(java.lang.String).
      Parameters:
      label - the tab label
      Returns:
      the visible tab with the given label
      Throws:
      IllegalStateException - if tab is not visible
    • getTab

      public Tab getTab(int index)
      Gets the visible tab at given index.

      The index refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to get tab 'C', the call must be getTab(1) and not getTab(2). Javadoc copied from TabSheetTester.getTab(int).

      Parameters:
      index - the zero-based index of the selected tab, negative value to unselect
      Returns:
      the tab at the given index
      Throws:
      IllegalStateException - if tab at given index is not visible in the browser
      IllegalArgumentException - if the index is less than zero or greater than the number of visible tabs.
    • getTabContent

      public <E extends Component> E getTabContent(String label)
      Gets the content of the visible tab with the given label. Javadoc copied from TabSheetTester.getTabContent(java.lang.String).
      Type Parameters:
      E - the event type
      Parameters:
      label - the tab label
      Returns:
      the content of the tab with the given label
      Throws:
      IllegalStateException - if tab is not visible
    • getTabContent

      public <E extends Component> E getTabContent(int index)
      Gets the content of the visible tab at given index.

      The index refers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to get the content of tab 'C', the call must be getTabContent(1) and not getTabContent(2). Javadoc copied from TabSheetTester.getTabContent(int).

      Type Parameters:
      E - the event type
      Parameters:
      index - the zero-based index of the selected tab, negative value to unselect
      Returns:
      the content of the tab at the given index
      Throws:
      IllegalStateException - if tab is not visible
      IllegalArgumentException - if the index is less than zero or greater than the number of visible tabs.
    • getTabLabels

      public List<String> getTabLabels()
      Gets the labels of the visible tabs, in the order the user sees them.

      Hidden tabs are left out, so the position of a label in the returned list is the index that TabSheetTester.select(int) and TabSheetTester.getTab(int) accept.

      Each entry is the tab's label, the same text that TabSheetTester.select(java.lang.String) and TabSheetTester.getTab(java.lang.String) match. A tab whose caption is made of components, such as an icon and a Span, has no label of its own and is listed as an empty string.

      This only reads the tabs, so it also works when the component is disabled. Javadoc copied from TabSheetTester.getTabLabels().

      Returns:
      the labels of the visible tabs, never null
      Throws:
      IllegalStateException - if the component is not visible
    • getSelectedTabLabel

      public String getSelectedTabLabel()
      Gets the label of the selected tab.

      This only reads the selection, so it also works when the component is disabled. A selected tab that is hidden is still reported, the same way TabSheetTester.isSelected(java.lang.String) reports it. Javadoc copied from TabSheetTester.getSelectedTabLabel().

      Returns:
      the label of the selected tab, or null if no tab is selected
      Throws:
      IllegalStateException - if the component is not visible