Interface HasComponents

All Superinterfaces:
HasComponentsOfType<Component>, HasElement, HasEnabled, Serializable
All Known Subinterfaces:
HasOrderedComponents
All Known Implementing Classes:
HtmlContainer, RouterLink, UI, WebComponentUI

public interface HasComponents extends HasComponentsOfType<Component>
A component to which the user can add and remove child components. Component in itself provides basic support for child components that are manually added as children of an element belonging to the component. This interface provides an explicit API for components that explicitly support adding and removing arbitrary child components.

HasComponents is generally implemented by layouts or components whose primary function is to host child components. It isn't, for example, implemented by non-layout components such as fields.

This interface is equivalent to HasComponentsOfType<Component>; if the container should only accept a restricted set of child component types, implement HasComponentsOfType directly with that type instead.

The default implementations assume that children are attached to HasElement.getElement(). Override all methods in this interface if the components should be added to some other element.

Since:
1.0
Author:
Vaadin Ltd
  • Method Details

    • add

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