NodeWrapper wrapper = new NodeWrapper(); findGivenNode(root, wrapper, key, parentStack); // at this point, wrapper.foundNode will hold the reference to the node you need // or null if the node wasn't found
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 NodeList getChildNodes() { return new NodeListWrapper(node.getChildNodes()); }
@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()); } });
/** * Translate the text in this element if there is i18n text. * * @param i18nKeyPrefix * The template prefix for the i18n key * @param element * The element to be translated */ @Override protected void visitElement(String i18nKeyPrefix, org.w3c.dom.Element element) { String translationKey = i18nKeyPrefix + getOrGenerateTranslationKey(element); String translationValue = getI18nValue(translationKey); if (translationValue != null) ((ElementWrapper) element).getElement().setInnerHTML(translationValue); }
NodeWrapper wrapper = new NodeWrapper(); findGivenNode(root, wrapper, key, parentStack);
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 NodeList getChildNodes() { return new NodeListWrapper(node.getChildNodes()); }
/** * Translate the text in this element if there is i18n text. * * @param i18nKeyPrefix * The template prefix for the i18n key * @param element * The element to be translated */ @Override protected void visitElement(String i18nKeyPrefix, org.w3c.dom.Element element) { String translationKey = i18nKeyPrefix + getOrGenerateTranslationKey(element); String translationValue = getI18nValue(translationKey); if (translationValue != null) ((ElementWrapper) element).getElement().setInnerHTML(translationValue); }
@Override public Node getFirstChild() { return new NodeWrapper(node.getFirstChild()); }
@Override public Node getLastChild() { return new NodeWrapper(node.getLastChild()); }
@Override public Node getNextSibling() { return new NodeWrapper(node.getNextSibling()); }
@Override public Node getParentNode() { return new NodeWrapper(node.getParentNode()); }
@Override public Node getLastChild() { return new NodeWrapper(node.getLastChild()); }
@Override public Node getPreviousSibling() { return new NodeWrapper(node.getPreviousSibling()); }
@Override public Node getParentNode() { return new NodeWrapper(node.getParentNode()); }
@Override public Node getFirstChild() { return new NodeWrapper(node.getFirstChild()); }
@Override public Node getPreviousSibling() { return new NodeWrapper(node.getPreviousSibling()); }
@Override public Node getNextSibling() { return new NodeWrapper(node.getNextSibling()); }