Class SplitLayoutTester<T extends SplitLayout>
- Type Parameters:
T- component type
- All Implemented Interfaces:
Clickable<T>
Simulates the user dragging the splitter and gives access to the components shown in the primary and secondary splits.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddragSplitterTo(double position) Simulates the user dragging the splitter so that the primary split gets the given percentage of the available space.<R extends Component>
ComponentQuery<R> findInPrimary(Class<R> componentType) Searches the primary split for components of the given type.<R extends Component>
ComponentQuery<R> findInSecondary(Class<R> componentType) Searches the secondary split for components of the given type.@Nullable ComponentGets the component shown in the primary split.@Nullable ComponentGets the component shown in the secondary split.@Nullable DoubleGets the relative position of the splitter, as a percentage between 0 and 100 of the space given to the primary split.Methods inherited from class com.vaadin.browserless.ComponentTester
canSetValueAsUser, clearAsUser, clickClearButtonAsUser, ensureComponentIsUsable, ensureComponentIsUsable, ensureComponentIsUsableOrDetach, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isComponentReadOnly, isUsable, isUsable, notUsableReasons, notUsableReasons, roundTrip, setModal, setPropertyAsUser, setValueAsUser, setValueAsUserMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.browserless.Clickable
click, click, click, middleClick, middleClick, rightClick, rightClick
-
Constructor Details
-
SplitLayoutTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
dragSplitterTo
public 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 positionand notifiessplitter drag end listeners.The component rounds the position it derives from a drag to two decimals, so
getSplitterPosition()reports33.33after dragging to33.333.- Parameters:
position- the new splitter position, as a percentage between 0 and 100- Throws:
IllegalArgumentException- if the position is not between 0 and 100IllegalStateException- if the layout is not usable
-
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
nullif it has neither been set on the server nor been dragged by the user - Throws:
IllegalStateException- if the layout is not visible to the user
-
getPrimaryComponent
Gets the component shown in the primary split.- Returns:
- the primary component, or
nullif the primary split is empty - Throws:
IllegalStateException- if the layout is not visible to the user
-
getSecondaryComponent
Gets the component shown in the secondary split.- Returns:
- the secondary component, or
nullif the secondary split is empty - Throws:
IllegalStateException- if the layout is not visible to the user
-
findInPrimary
Searches the primary split for components of the given type.The primary split holds the components added with
SplitLayout.addToPrimary(Component...). Components nested inside them are found too, so a button inside the layout filling the split is reached as well as a button added to the split directly.- Type Parameters:
R- the type of the components to search for- Parameters:
componentType- the type of the components to search for- Returns:
- a query for components of the given type in the primary split
- Throws:
IllegalStateException- if the layout is not visible to the user
-
findInSecondary
Searches the secondary split for components of the given type.The secondary split holds the components added with
SplitLayout.addToSecondary(Component...). Components nested inside them are found too, so a button inside the layout filling the split is reached as well as a button added to the split directly.- Type Parameters:
R- the type of the components to search for- Parameters:
componentType- the type of the components to search for- Returns:
- a query for components of the given type in the secondary split
- Throws:
IllegalStateException- if the layout is not visible to the user
-