Class SplitLayoutTester

  • All Implemented Interfaces:
    com.vaadin.browserless.Clickable

    
    public class SplitLayoutTester<T extends SplitLayout>
    extends ComponentTester<T>
                        

    Tester for SplitLayout components.

    Simulates the user dragging the splitter and gives access to the components shown in the primary and secondary splits.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final T component
    • Constructor Summary

      Constructors 
      Constructor Description
      SplitLayoutTester(T component) Wrap given component for testing.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void dragSplitterTo(double position) Simulates the user dragging the splitter so that the primary split gets the given percentage of the available space.
      Double getSplitterPosition() Gets the relative position of the splitter, as a percentage between 0 and 100 of the space given to the primary split.
      Component getPrimaryComponent() Gets the component shown in the primary split.
      Component getSecondaryComponent() Gets the component shown in the secondary split.
      • Methods inherited from class com.vaadin.browserless.ComponentTester

        ensureComponentIsUsable, find, getComponent, isUsable, setModal
      • Methods inherited from class com.vaadin.browserless.Clickable

        click, click, click, middleClick, middleClick, rightClick, rightClick
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SplitLayoutTester

        SplitLayoutTester(T component)

        Wrap given component for testing.

        Parameters:
        component - target component
    • Method Detail

      • dragSplitterTo

         void dragSplitterTo(double position)

        Simulates the user dragging the splitter so that the primary split gets the given percentage of the available space.

        The drag is delivered the same way the browser delivers it, so the component updates its splitter position and notifies splitter drag end listeners.

        The component rounds the position it derives from a drag to two decimals, so getSplitterPosition reports 33.33 after dragging to 33.333.

        Parameters:
        position - the new splitter position, as a percentage between 0 and 100
      • getSplitterPosition

        @Nullable() Double getSplitterPosition()

        Gets the relative position of the splitter, as a percentage between 0 and 100 of the space given to the primary split. A position that comes from a drag is rounded to two decimals by the component.

        Returns:

        the splitter position, or null if it has neither been set on the server nor been dragged by the user

      • getPrimaryComponent

        @Nullable() Component getPrimaryComponent()

        Gets the component shown in the primary split.

        Returns:

        the primary component, or null if the primary split is empty

      • getSecondaryComponent

        @Nullable() Component getSecondaryComponent()

        Gets the component shown in the secondary split.

        Returns:

        the secondary component, or null if the secondary split is empty