List of usage examples for com.google.gwt.dom.client Text getNodeValue
@Override
public String getNodeValue()
From source file:com.github.gwtbootstrap.client.ui.base.IconAnchor.java
License:Apache License
/** * {@inheritDoc}//w ww. j a v a2 s . c om */ public void setText(String text) { if (!this.getElement().isOrHasChild(this.text.getElement())) { Node toRemove = null; for (int i = 0; i < this.getElement().getChildCount(); i++) { Node n = this.getElement().getChildNodes().getItem(i); if (n.getNodeType() == 3 /*TEXT_NODE*/ ) { Text t = n.<Text>cast(); if (t.getNodeValue().equals(this.text.getText()) || t.getNodeValue().equals(text)) { toRemove = t; } } } if (toRemove != null) { this.getElement().removeChild(toRemove); } this.getElement().appendChild(this.text.getElement()); } this.text.removeFromParent(); this.text = new TextNode(" " + text + " "); setIconPosition(iconPosition); }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.util.TextGrabberVisitor.java
License:Apache License
public void process(Node node) { if (node.getNodeType() == Node.TEXT_NODE) { Text text = (Text) node; builder.append(text.getNodeValue()); }/*from w w w . j av a2 s. c o m*/ }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.GwtTestTextGrabberVisitor.java
License:Apache License
public void testProcess() { createDocument();/*from w w w. java 2 s.c o m*/ Node start = DOM.getElementById("thediv"); assertNotNull(start); Node end = start.getLastChild(); assertNotNull(end); assertEquals(Node.TEXT_NODE, end.getNodeType()); Text text = (Text) end; assertEquals(" and other stuff", text.getNodeValue()); TextGrabberVisitor processor = new TextGrabberVisitor(); Visitor visitor = new Visitor(processor); visitor.process(start, end); String result = processor.getText(); assertNotNull(result); assertEquals("The Da Service", result); }