public Node item(int index) { final com.google.gwt.dom.client.Node node = nodeList.getItem(index); if (node instanceof Element) { return new ElementWrapper((Element) node); } return new NodeWrapper(node); }
public Node item(int index) { final com.google.gwt.dom.client.Node node = nodeList.getItem(index); if (node instanceof Element) { return new ElementWrapper((Element) node); } return new NodeWrapper(node); }
@Override public void callback(final Composite beanInstance) { /* * Only translate parent-less widgets to avoid re-translating a single widget multiple * times (the call to revisit will traverse the whole subtree rooted at this widget). */ if (beanInstance.getParent() == null) DomVisit.revisit(new ElementWrapper(beanInstance.getElement()), new TranslationDomRevisitor()); } });
@Override public void callback(final Composite beanInstance) { /* * Only translate parent-less widgets to avoid re-translating a single widget multiple * times (the call to revisit will traverse the whole subtree rooted at this widget). */ if (beanInstance.getParent() == null) DomVisit.revisit(new ElementWrapper(beanInstance.getElement()), new TranslationDomRevisitor()); } });
@Override public void callback(final Composite beanInstance) { /* * Only translate parent-less widgets to avoid re-translating a single widget multiple * times (the call to revisit will traverse the whole subtree rooted at this widget). */ if (beanInstance.getParent() == null) DomVisit.revisit(new ElementWrapper(beanInstance.getElement()), new TranslationDomRevisitor()); } });
/** * 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)); }
/** * 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)); }
/** * Re-translate displayed {@link Templated} beans to the current locale. */ public static void retranslateTemplatedBeans() { // Translate DOM-attached templates DomVisit.revisit(new ElementWrapper(Document.get().getBody()), new TranslationDomRevisitor()); // Translate DOM-detached Singleton templates for (final AsyncBeanDef<Composite> beanDef : IOC.getAsyncBeanManager().lookupBeans(Composite.class)) { final Class<? extends Annotation> scope = beanDef.getScope(); if (scope != null && (scope.equals(ApplicationScoped.class))) beanDef.getInstance(new CreationalCallback<Composite>() { @Override public void callback(final Composite beanInstance) { /* * Only translate parent-less widgets to avoid re-translating a single widget multiple * times (the call to revisit will traverse the whole subtree rooted at this widget). */ if (beanInstance.getParent() == null) DomVisit.revisit(new ElementWrapper(beanInstance.getElement()), new TranslationDomRevisitor()); } }); } } }
/** * Re-translate displayed {@link Templated} beans to the current locale. */ public static void retranslateTemplatedBeans() { // Translate DOM-attached templates DomVisit.revisit(new ElementWrapper(Document.get().getBody()), new TranslationDomRevisitor()); // Translate DOM-detached Singleton templates for (final AsyncBeanDef<Composite> beanDef : IOC.getAsyncBeanManager().lookupBeans(Composite.class)) { final Class<? extends Annotation> scope = beanDef.getScope(); if (scope != null && (scope.equals(ApplicationScoped.class))) beanDef.getInstance(new CreationalCallback<Composite>() { @Override public void callback(final Composite beanInstance) { /* * Only translate parent-less widgets to avoid re-translating a single widget multiple * times (the call to revisit will traverse the whole subtree rooted at this widget). */ if (beanInstance.getParent() == null) DomVisit.revisit(new ElementWrapper(beanInstance.getElement()), new TranslationDomRevisitor()); } }); } } }
/** * Re-translate displayed {@link Templated} beans to the current locale. */ public static void retranslateTemplatedBeans() { // Translate DOM-attached templates DomVisit.revisit(new ElementWrapper(Document.get().getBody()), new TranslationDomRevisitor()); // Translate DOM-detached Singleton templates for (final AsyncBeanDef<Composite> beanDef : IOC.getAsyncBeanManager().lookupBeans(Composite.class)) { final Class<? extends Annotation> scope = beanDef.getScope(); if (scope != null && (scope.equals(ApplicationScoped.class))) beanDef.getInstance(new CreationalCallback<Composite>() { @Override public void callback(final Composite beanInstance) { /* * Only translate parent-less widgets to avoid re-translating a single widget multiple * times (the call to revisit will traverse the whole subtree rooted at this widget). */ if (beanInstance.getParent() == null) DomVisit.revisit(new ElementWrapper(beanInstance.getElement()), new TranslationDomRevisitor()); } }); } } }