@Deprecated public Element getViewElement() { return TemplateUtil.asErraiElement(view.getElement()); }
public static HTMLElement asErraiElement(final Object element) { try { return nativeCast(element); } catch (final Throwable t) { throw new RuntimeException("Error casting @DataField of type " + element.getClass().getName() + " to org.jboss.errai.common.client.dom.HTMLElement", t); } }
public static void compositeComponentReplace(final String componentType, final String templateFile, final Supplier<Widget> field, final Map<String, Element> dataFieldElements, final Map<String, DataFieldMeta> dataFieldMetas, final String fieldName) { try { compositeComponentReplace(componentType, templateFile, field.get(), dataFieldElements, dataFieldMetas, fieldName); } catch (final Throwable t) { throw new RuntimeException("There was an error initializing the @DataField " + fieldName + " in the @Templated " + componentType + ": " + t.getMessage(), t); } }
public static void setupBrowserEventListener(final Object component, final Object element, final org.jboss.errai.common.client.dom.EventListener<?> listener, final String browserEventType) { setupBrowserEventListener(component, TemplateUtil.asErraiElement(element), listener, browserEventType); }
public static void initWidget(final Composite component, final Element wrapped, final Collection<Widget> dataFields) { // All template fragments are contained in a single element, during initialization. wrapped.removeFromParent(); if (!(component instanceof ListWidget)) { initWidgetNative(component, new TemplateWidget(wrapped, dataFields)); } if (!component.isAttached()) { onAttachNative(component); RootPanel.detachOnWindowClose(component); } StyleBindingsRegistry.get().updateStyles(component); TemplateInitializedEvent.fire(component); }
/** * Called to perform i18n translation on the given template. Add i18n-prefix attribute to root of * template to allow translation after bean creation. * * @param templateRoot */ public static void translateTemplate(final String templateFile, final Element templateRoot) { if (!getTranslationService().isEnabled()) return; logger.finer("Translating template: " + templateFile); final String i18nKeyPrefix = getI18nPrefix(templateFile); // Add i18n prefix attribute for post-creation translation templateRoot.setAttribute("data-i18n-prefix", i18nKeyPrefix); DomVisit.visit(new ElementWrapper(templateRoot), new TemplateTranslationVisitor(i18nKeyPrefix)); }
public static Element getRootTemplateParentElement(final String templateContents, final String templateFileName, final String rootField) { final String key = templateFileName + "#" + rootField; if (templateRoots.containsKey(key)) { return cloneIntoNewParent(templateRoots.get(key)); final Element templateRoot = firstNonMetaElement(parserDiv); if (templateRoot == null) { throw new IllegalStateException("Could not find template root for this template: " + templateContents); return cloneIntoNewParent(templateRoot);
final JsArray<Node> templateAttributes = getAttributes(element); for (int i = 0; i < templateAttributes.length(); i++) { final Node node = templateAttributes.get(i); continue; mergeAttribute(meta, field.getElement().cast(), element.cast(), name, value);
private String getI18nValue(String translationKey) { return TemplateUtil.getTranslationService().getTranslation(translationKey); } }
public static Element getRootTemplateElement(final Element rootParent) { return firstNonMetaElement(rootParent); }
final String i18nPrefix = TemplateUtil.getI18nPrefix(templateFileName); final URL resource = TranslationServiceGenerator.class.getClassLoader().getResource(templateFileName); if (resource == null) {
public static void setupBrowserEventListener(final Object component, final Object element, final org.jboss.errai.common.client.dom.EventListener<?> listener, final String browserEventType) { setupBrowserEventListener(component, TemplateUtil.asErraiElement(element), listener, browserEventType); }
public static void initWidget(final Composite component, final Element wrapped, final Collection<Widget> dataFields) { // All template fragments are contained in a single element, during initialization. wrapped.removeFromParent(); if (!(component instanceof ListWidget)) { initWidgetNative(component, new TemplateWidget(wrapped, dataFields)); } if (!component.isAttached()) { onAttachNative(component); RootPanel.detachOnWindowClose(component); } StyleBindingsRegistry.get().updateStyles(component); TemplateInitializedEvent.fire(component); }
/** * Called to perform i18n translation on the given template. Add i18n-prefix attribute to root of * template to allow translation after bean creation. * * @param templateRoot */ public static void translateTemplate(final String templateFile, final Element templateRoot) { if (!getTranslationService().isEnabled()) return; logger.finer("Translating template: " + templateFile); final String i18nKeyPrefix = getI18nPrefix(templateFile); // Add i18n prefix attribute for post-creation translation templateRoot.setAttribute("data-i18n-prefix", i18nKeyPrefix); DomVisit.visit(new ElementWrapper(templateRoot), new TemplateTranslationVisitor(i18nKeyPrefix)); }
public static Element getRootTemplateParentElement(final String templateContents, final String templateFileName, final String rootField) { final String key = templateFileName + "#" + rootField; if (templateRoots.containsKey(key)) { return cloneIntoNewParent(templateRoots.get(key)); final Element templateRoot = firstNonMetaElement(parserDiv); if (templateRoot == null) { throw new IllegalStateException("Could not find template root for this template: " + templateContents); return cloneIntoNewParent(templateRoot);
final JsArray<Node> templateAttributes = getAttributes(element); for (int i = 0; i < templateAttributes.length(); i++) { final Node node = templateAttributes.get(i); continue; mergeAttribute(meta, field.getElement().cast(), element.cast(), name, value);
private String getI18nValue(String translationKey) { return TemplateUtil.getTranslationService().getTranslation(translationKey); } }
public static Element getRootTemplateElement(final Element rootParent) { return firstNonMetaElement(rootParent); }
final String i18nPrefix = TemplateUtil.getI18nPrefix(templateFileName); final URL resource = TranslationServiceGenerator.class.getClassLoader().getResource(templateFileName); if (resource == null) {
public static com.google.gwt.user.client.Element asDeprecatedElement(final Object element) { try { return nativeCast(element); } catch (final Throwable t) { throw new RuntimeException("Error casting @DataField of type " + element.getClass().getName() + " to " + com.google.gwt.user.client.Element.class.getName(), t); } }