public static void revisit(Element element, DomRevisitor visitor) { if (visitor.visit(element)) { NodeList childNodes = element.getChildNodes(); for (int idx = 0; idx < childNodes.getLength(); idx++) { Node childNode = childNodes.item(idx); if (childNode.getNodeType() == Node.ELEMENT_NODE) { revisit((Element) childNode, visitor); } } } visitor.afterVisit(element); }
public static void revisit(Element element, DomRevisitor visitor) { if (visitor.visit(element)) { NodeList childNodes = element.getChildNodes(); for (int idx = 0; idx < childNodes.getLength(); idx++) { Node childNode = childNodes.item(idx); if (childNode.getNodeType() == Node.ELEMENT_NODE) { revisit((Element) childNode, visitor); } } } visitor.afterVisit(element); }
@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()); } });
/** * 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()); } }); } } }