Interface ComponentContainer

All Superinterfaces:
HasComponents, com.vaadin.flow.component.HasComponents, HasComponents.ComponentAttachDetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, Iterable<com.vaadin.flow.component.Component>, Serializable
All Known Subinterfaces:
Layout
All Known Implementing Classes:
AbsoluteLayout, AbstractComponentContainer, AbstractLayout, AbstractOrderedLayout, FormLayout, GridLayout, HorizontalLayout, VerticalLayout

public interface ComponentContainer extends HasComponents, com.vaadin.flow.component.HasComponents, HasComponents.ComponentAttachDetachNotifier
Legacy version of ComponentContainer, a special type of parent which allows the user to add and remove components to it. Typically, does not have any restrictions on the number of children it can contain.
Author:
Vaadin Ltd.
  • Method Details

    • addComponent

      void addComponent(com.vaadin.flow.component.Component c)
      Adds the component into this container.
      Parameters:
      c - the component to be added.
    • addComponents

      void addComponents(com.vaadin.flow.component.Component... components)
      Adds the components in the given order to this component container.
      Parameters:
      components - The components to add.
    • removeComponent

      void removeComponent(com.vaadin.flow.component.Component c)
      Removes the component from this container.
      Parameters:
      c - the component to be removed.
    • removeAllComponents

      void removeAllComponents()
      Removes all components from this container.
    • replaceComponent

      void replaceComponent(com.vaadin.flow.component.Component oldComponent, com.vaadin.flow.component.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.
      newComponent - the new component to be replaced.
    • getComponentCount

      int getComponentCount()
      Gets the number of children this ComponentContainer has
      Returns:
      The number of child components this container has.
    • moveComponentsFrom

      void moveComponentsFrom(ComponentContainer source)
      Moves all components from another container into this container. The components are removed from source.
      Parameters:
      source - the container which contains the components that are to be moved to this container.