Package com.storedobject.ui.util
Class HtmlTemplate
java.lang.Object
com.vaadin.flow.component.Component
com.storedobject.ui.util.HtmlTemplate
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
- Direct Known Subclasses:
TemplateLayout
@Tag("div")
public abstract class HtmlTemplate
extends com.vaadin.flow.component.Component
Abstract base class for a component that is initialized based on the contents
of an HTML template. The HTML content is read to create a
server-side Element tree. For instance fields marked with @
Id, an
element with the corresponding id attribute value is identified, upgraded to
a component of the type defined by the field and the component instance is
set as the field value. However, it is possible to custom-create the component instance by
overriding the createComponentForId(String) or createComponentForId(String, String) method.- Author:
- Leif Åstrand (Vaadin Ltd.). Enhanced by Syam.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceCallback for creating an input stream on demand.static interface -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new HTML template based on the content of theTextContentthat has the same name of this class.protectedCreates a new HTML template based on the content of theTextContentprovided.protectedHtmlTemplate(String textContentName) Creates a new HTML template based on the content of theTextContentprovided.protectedHtmlTemplate(String cacheKey, HtmlTemplate.StreamSupplier streamSupplier) Creates a new HTML template based on HTML read from an input stream.protectedHtmlTemplate(String cacheKey, HtmlTemplate.StreamSupplier streamSupplier, HtmlTemplate.StyleSupplier styleSupplier) Creates a new HTML template based on HTML read from an input stream.protectedHtmlTemplate(Supplier<String> contentSupplier) Creates a new HTML template based on the content provided by a supplier. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild()static voidprotected com.vaadin.flow.component.Componentprotected com.vaadin.flow.component.ComponentcreateComponentForId(String id, String tag) booleanprotected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidsetComponentCreator(HtmlTemplate.ComponentCreator componentCreator) voidMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
HtmlTemplate
protected HtmlTemplate()Creates a new HTML template based on the content of theTextContentthat has the same name of this class. -
HtmlTemplate
Creates a new HTML template based on the content of theTextContentprovided.- Parameters:
tc- Text content.
-
HtmlTemplate
Creates a new HTML template based on the content of theTextContentprovided.- Parameters:
textContentName- Text content name.
-
HtmlTemplate
-
HtmlTemplate
Creates a new HTML template based on HTML read from an input stream.- Parameters:
cacheKey- the key to use for potentially caching the result of reading and parsing the template, ornullnever cache the resultstreamSupplier- an input stream supplier that will be used if caching isn't used or if there is a cache miss, notnull
-
HtmlTemplate
protected HtmlTemplate(String cacheKey, HtmlTemplate.StreamSupplier streamSupplier, HtmlTemplate.StyleSupplier styleSupplier) Creates a new HTML template based on HTML read from an input stream.- Parameters:
cacheKey- the key to use for potentially caching the result of reading and parsing the template, ornullnever cache the resultstreamSupplier- an input stream supplier that will be used if caching isn't used or if there is a cache miss, notnull
-
-
Method Details
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
build
public void build() -
isCreated
public boolean isCreated() -
setView
-
setComponentCreator
-
createComponentForId
-
createComponentForId
-
clearCache
public static void clearCache()
-