M
- a model class that will be used for template data propagationpublic abstract class PolymerTemplate<M extends TemplateModel> extends AbstractTemplate<M>
@HtmlImport
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.
HtmlImport
,
Tag
,
Id
,
Serialized FormModifier | Constructor and Description |
---|---|
|
PolymerTemplate()
Creates the component that is responsible for Polymer template
functionality.
|
|
PolymerTemplate(TemplateParser parser)
Creates the component that is responsible for Polymer template
functionality using the provided
parser . |
protected |
PolymerTemplate(TemplateParser parser,
VaadinService service)
Creates the component that is responsible for Polymer template
functionality using the provided
parser . |
Modifier and Type | Method and Description |
---|---|
Stream<Component> |
getChildren()
Gets the child components of this component.
|
protected M |
getModel()
Returns the model of this template.
|
ModelType |
getModelType(Type type)
Get the
ModelType for given class. |
boolean |
isSupportedClass(Class<?> type)
Check if the given Class
type is found in the Model. |
getModelType, getStateNode
addListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttachListener
addDetachListener
public PolymerTemplate(TemplateParser parser)
parser
.parser
- a template parserprotected PolymerTemplate(TemplateParser parser, VaadinService service)
parser
.parser
- a template parserservice
- the related service instancepublic PolymerTemplate()
public boolean isSupportedClass(Class<?> type)
type
is found in the Model.type
- Class to check support forpublic ModelType getModelType(Type type)
ModelType
for given class.type
- Type to get the ModelType forprotected M getModel()
AbstractTemplate
The type of the model will be the type that this method returns in the instance it is invoked on - meaning that you should override this method and return your own model type.
getModel
in class AbstractTemplate<M extends TemplateModel>
public Stream<Component> getChildren()
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.
getChildren
in class Component
Id
Copyright © 2019. All rights reserved.