Class Composite<T extends Component>

    • Constructor Detail

      • Composite

        protected Composite()
        Creates a new composite.

        To define your own composite, extend this class and implement initContent().

    • Method Detail

      • initContent

        protected T initContent()
        Called when the content of this composite is requested for the first time.

        This method should initialize the component structure for the composite and return the root component.

        By default, this method uses reflection to instantiate the component based on the generic type of the sub class.

        Returns:
        the root component which this composite wraps, never null
      • getContent

        public T getContent()
        Gets the content of the composite, i.e. the component the composite is wrapping.
        Returns:
        the content for the composite, never null
      • getElement

        public Element getElement()
        Gets the root element of this composite.

        For a composite, the root element is the same as the root element of the content of the composite.

        Specified by:
        getElement in interface HasElement
        Overrides:
        getElement in class Component
        Returns:
        the root element of this component
      • getChildren

        public Stream<Component> getChildren()
        Gets the child components of this composite.

        A composite always has one child component, returned by initContent().

        Overrides:
        getChildren in class Component
        Returns:
        the child component of this composite
        See Also:
        Id