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
,ItemFilter
,Main
,Nav
,Row
,Section
,Tabs
,VerticalLayout
public interface HasOrderedComponents extends HasComponents
A component which the children components are ordered, so the index of each child matters for the layout.
Since:
1.0
-
-
Method Summary
All Methods Modifier and Type Method Description Stream<Component>
getChildren()
Gets the children components of this component.
default Component
getComponentAt(int index)
Returns the component at the given position.
default int
getComponentCount()
Gets the number of children components.
default int
indexOf(Component component)
Returns the index of the given component.
default void
replace(Component oldComponent, Component newComponent)
Replaces the component in the container with another one without changing position.
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
-
-
-
Method Detail
-
replace
default void replace(Component oldComponent, Component newComponent)
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
default int indexOf(Component component)
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
default Component getComponentAt(int index)
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:
-
-