Class AbstractVelocityJsComponent
java.lang.Object
com.vaadin.flow.component.Component
org.vaadin.addons.velocitycomponent.AbstractVelocityJsComponent
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
public abstract class AbstractVelocityJsComponent
extends com.vaadin.flow.component.Component
This is a base class for components that use Velocity to
generate JavaScript for their front-end integration.
The component can use the velocityJs(String, VelocityContext, List) method
or its overloads to execute JavaScript in the context of the
components base element. The passed JavaScript is first processed
using Velocity templating engine, so you can use named parameters
from the context. The context by default contains the component
itself (referred as $this) and the Json helper class
(referred as $Json).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.velocity.VelocityContextGet the VelocityContext for this component.protected com.vaadin.flow.component.page.PendingJavaScriptResultvelocityJs(String jsVelocityTemplate) protected com.vaadin.flow.component.page.PendingJavaScriptResultvelocityJs(String jsVelocityTemplate, Map<String, Object> additionalContext) protected com.vaadin.flow.component.page.PendingJavaScriptResultvelocityJs(String jsVelocityTemplate, org.apache.velocity.VelocityContext ctx, List<com.vaadin.flow.dom.Element> specialParameters) Methods 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, onAttach, 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
-
AbstractVelocityJsComponent
public AbstractVelocityJsComponent()
-
-
Method Details
-
getVelocityContext
protected org.apache.velocity.VelocityContext getVelocityContext()Get the VelocityContext for this component.The component can override to add more context or to cache the context.
- Returns:
- the VelocityContext used to execute JS with special methods.
-
velocityJs
protected com.vaadin.flow.component.page.PendingJavaScriptResult velocityJs(String jsVelocityTemplate) -
velocityJs
-
velocityJs
-