Interface HasOrderedComponents

All Superinterfaces:
HasComponents, HasElement, HasEnabled, Serializable
All Known Subinterfaces:
FlexComponent
All Known Implementing Classes:
Article, Aside, Board, ConfirmDialog, Div, FlexLayout, Footer, Header, HorizontalLayout, HtmlObject, Main, Nav, Row, Section, 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 Details

    • 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 be null, which will make the newComponent to be added to the layout without replacing any other
      newComponent - the new component to be replaced. Can be null, 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 be null
      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 components
      Returns:
      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 components
      See Also:
    • getChildren

      Stream<Component> getChildren()
      Gets the children components of this component.
      Returns:
      the children components of this component
      See Also: