templates.ui.ftlh Maven / Gradle / Ivy
The newest version!
<#if initRootElement>
@jsinterop.annotations.JsFunction
private interface HTMLElementAccessor {
elemental2.dom.HTMLElement getElement();
}
#if>
private final EventHandlerRegistration eventHandlerRegistration = new EventHandlerRegistration();
private static boolean isInjected = false;
private void setAndInitTemplate(${bean} instance, Interceptor interceptor) {
<#if css??>
if (!isInjected) {
StyleInjector.fromString("${css?no_esc}").inject();
isInjected = true;
}
#if>
<#if initRootElement>
elemental2.core.Reflect.set(instance, "__root_element__", elemental2.dom.DomGlobal.document.createElement("div"));
interceptor.addGetMethodInterceptor(Reflect.objectProperty("${rootElementPropertyName}", instance), new java.util.function.BiFunction