com.vaadin.flow.component.polymertemplate.

Class PolymerTemplate<M extends TemplateModel>

  • Type Parameters:

    M - a model class that will be used for template data propagation

    All Implemented Interfaces:

    AttachNotifier, DetachNotifier, HasElement, Serializable


    public abstract class PolymerTemplate<M extends TemplateModel>
    extends AbstractTemplate<M>

    Component for an HTML element declared as a polymer component. The HTML markup should be loaded using the JsModule annotation and the components should be associated with the web component element using the @Tag annotation.

    You may use Id annotation inside your template class for a field to reference an element inside your template via id attribute value. Note that the injected element will have functional limitations on the server side. Recommend using LitTemplate instead of PolymerTemplate as Polymer will be deprecated in the next LTS version.

    Since:

    1.0

    Author:

    Vaadin Ltd

    See Also:

    JsModule, Tag, Id, Serialized Form

    • Constructor Detail

      • PolymerTemplate

        public PolymerTemplate(TemplateParser parser)

        Creates the component that is responsible for Polymer template functionality using the provided parser.

        Parameters:

        parser - a template parser

      • PolymerTemplate

        protected PolymerTemplate(TemplateParser parser,
                                  VaadinService service)

        Creates the component that is responsible for Polymer template functionality using the provided parser.

        Parameters:

        parser - a template parser

        service - the related service instance

      • PolymerTemplate

        public PolymerTemplate()

        Creates the component that is responsible for Polymer template functionality.

    • Method Detail

      • getChildren

        public Stream<Component> getChildren()

        Gets the child components of this component.

        The default implementation finds child components by traversing each child Element tree.

        If the component is injected to a PolymerTemplate using the @Id annotation the getChildren method will only return children added from the server side and will not return any children declared in the template file.

        Please note that components defined using @Id are not child components since they are attached inside the Shadow DOM. Only components explicitly added through methods such as HasComponents.add(com.vaadin.flow.component.Component...) or Node.appendChild(Element...) are returned by this method.

        Overrides:

        getChildren in class Component

        Returns:

        the child components of this component

        See Also:

        Id