com.vaadin.flow.component.
Interface HasOrderedComponents
All Superinterfaces:
All Known Subinterfaces:
All Known Implementing Classes:
Article
, Aside
, Board
, ConfirmDialog
, Div
, FlexLayout
, Footer
, Header
, HorizontalLayout
, HtmlObject
, Main
, NativeTableBody
, NativeTableFooter
, NativeTableHeader
, NativeTableRow
, Nav
, Row
, Section
, VerticalLayout
A component which the children components are ordered, so the index of each child matters for the layout.
Since:
1.0
-
Method Summary
Modifier and TypeMethodDescriptionGets the children components of this component.
default Component
getComponentAt
(int index) Returns the component at the given position.
default int
Gets the number of children components.
default int
Returns the index of the given component.
default void
Replaces the component in the container with another one without changing position.
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
Method Details
-
replace
Replaces the component in the container with another one without changing position. This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.
Parameters:
oldComponent
- the old component that will be replaced. Can benull
, which will make the newComponent to be added to the layout without replacing any othernewComponent
- the new component to be replaced. Can benull
, which will make the oldComponent to be removed from the layout without adding any other -
indexOf
Returns the index of the given component.
Parameters:
component
- the component to look up, can not benull
Returns:
the index of the component or -1 if the component is not a child
-
getComponentCount
default int getComponentCount()Gets the number of children components.
Returns:
the number of components
-
getComponentAt
Returns the component at the given position.
Parameters:
index
- the position of the component, must be greater than or equals to 0 and less than the number of children componentsReturns:
The component at the given index
Throws:
IllegalArgumentException
- if the index is less than 0 or greater than or equals to the number of children componentsSee Also:
-
getChildren
Gets the children components of this component.
Returns:
the children components of this component
See Also:
-