Interface HasComponents

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default void add​(Component... components)
      Adds the given components as children of this component.
      default void add​(String text)
      Add the given text as a child of this component.
      default void add​(Collection<Component> components)
      Adds the given components as children of this component.
      default void addComponentAsFirst​(Component component)
      Adds the given component as the first child of this component.
      default void addComponentAtIndex​(int index, Component component)
      Adds the given component as child of this component at the specific index.
      default void remove​(Component... components)
      Removes the given child components from this component.
      default void remove​(Collection<Component> components)
      Removes the given child components from this component.
      default void removeAll()
      Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using the Element API.
    • Method Detail

      • add

        default void add​(Component... components)
        Adds the given components as children of this component.

        In case any of the specified components has already been added to another parent, it will be removed from there and added to this one.

        Parameters:
        components - the components to add
      • add

        default void add​(Collection<Component> components)
        Adds the given components as children of this component.

        In case any of the specified components has already been added to another parent, it will be removed from there and added to this one.

        Parameters:
        components - the components to add
      • add

        default void add​(String text)
        Add the given text as a child of this component.
        Parameters:
        text - the text to add, not null
      • remove

        default void remove​(Component... components)
        Removes the given child components from this component.
        Parameters:
        components - the components to remove
        Throws:
        IllegalArgumentException - if there is a component whose non null parent is not this component
      • remove

        default void remove​(Collection<Component> components)
        Removes the given child components from this component.
        Parameters:
        components - the components to remove
        Throws:
        IllegalArgumentException - if there is a component whose non null parent is not this component
      • removeAll

        default void removeAll()
        Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using the Element API. it also removes the children that were added only at the client-side.
      • addComponentAtIndex

        default void addComponentAtIndex​(int index,
                                         Component component)
        Adds the given component as child of this component at the specific index.

        In case the specified component has already been added to another parent, it will be removed from there and added to this one.

        Parameters:
        index - the index, where the component will be added. The index must be non-negative and may not exceed the children count
        component - the component to add, value should not be null
      • addComponentAsFirst

        default void addComponentAsFirst​(Component component)
        Adds the given component as the first child of this component.

        In case the specified component has already been added to another parent, it will be removed from there and added to this one.

        Parameters:
        component - the component to add, value should not be null