Java Code Examples for com.google.gwt.dom.client.Element#getInnerText()

The following examples show how to use com.google.gwt.dom.client.Element#getInnerText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JoinDataTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private SubmitCompleteHandler getSubmitCompleteHandler() {
	return new SubmitCompleteHandler() {
		public void onSubmitComplete(final SubmitCompleteEvent event) {

			final Element label = DOM.createLabel();
			label.setInnerHTML(event.getResults());

			final String csvData = label.getInnerText();
			if (hasError(csvData)) {
				showAlert("Error: " + csvData);
			} else {
				parseCsvData(csvData);
				autoMessageBox.hide();
			}
		}

		private boolean hasError(final String contentFile) {
			return contentFile.startsWith("413")
					|| contentFile.startsWith("500");
		}
	};
}
 
Example 2
Source File: DomLogger.java    From swellrt with Apache License 2.0 6 votes vote down vote up
/**
 * Outputs debug-string representing a DOM element
 *
 * @param e
 * @return XML rendering of element
 */
@SuppressWarnings("unused")
private static String toXml(Element e) {
  String out = "";
  if (DomHelper.isTextNode(e)) {
    out = "'" + shortString(e.getNodeValue()) + "'";
  } else {
    String tagName = e.getTagName();
    out = "<" + tagName;
    if (tagName.equals("INPUT")) {
      out += attr(e, "type");
      out += attr(e, "value");
    }
    out += attr(e, "class");
    if (tagName.equals("A")) {
      out += ">" + e.getInnerText() + "</A>";
    } else {
      out += "/>";
    }
  }
  return out;
}
 
Example 3
Source File: DomLogger.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
/**
 * Outputs debug-string representing a DOM element
 *
 * @param e
 * @return XML rendering of element
 */
@SuppressWarnings("unused")
private static String toXml(Element e) {
  String out = "";
  if (DomHelper.isTextNode(e)) {
    out = "'" + shortString(e.getNodeValue()) + "'";
  } else {
    String tagName = e.getTagName();
    out = "<" + tagName;
    if (tagName.equals("INPUT")) {
      out += attr(e, "type");
      out += attr(e, "value");
    }
    out += attr(e, "class");
    if (tagName.equals("A")) {
      out += ">" + e.getInnerText() + "</A>";
    } else {
      out += "/>";
    }
  }
  return out;
}
 
Example 4
Source File: ClientUtils.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Dumps Element content and traverse its children.
 * <p/><b>WARNING:</b> it is com.google.gwt.dom.client.Element not com.google.gwt.xml.client.Element!!!
 * 
 * @param elm an element to dump
 * @param indent row indentation for current level
 * @param indentIncrement increment for next level
 * @param sb dumped content
 * @return dumped content
 */
public static StringBuilder dump(Element elm, String indent, String indentIncrement, StringBuilder sb) {
    int childCount = elm.getChildCount();
    String innerText = elm.getInnerText();
    String lang = elm.getLang();
    String nodeName = elm.getNodeName();
    short nodeType = elm.getNodeType();
    String getString = elm.getString();
    String tagNameWithNS = elm.getTagName();
    String xmlLang = elm.getAttribute("xml:lang");

    sb.append(ClientUtils.format("%sElement {nodeName: %s, nodeType: %s, tagNameWithNS: %s, lang: %s,"
            + " childCount: %s, getString: %s, xmlLang: %s}\n",
            indent, nodeName, nodeType, tagNameWithNS, lang, childCount, getString, xmlLang));
    NodeList<Node> childNodes = elm.getChildNodes();
    indent += indentIncrement;
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node child = childNodes.getItem(i);
        if (Element.is(child)) {
            dump(Element.as(child), indent, indentIncrement, sb);
        } else {
            sb.append(ClientUtils.format("%sNode: nodeType: %s, nodeName: %s, childCount: %s, nodeValue: %s\n",
                    indent, child.getNodeType(), child.getNodeName(), child.getChildCount(), child.getNodeValue()));
        }
    }
    return sb;
}
 
Example 5
Source File: DefaultParagraphHtmlRenderer.java    From swellrt with Apache License 2.0 5 votes vote down vote up
protected String getIdFromNodeletText(Element implNodelet) {
 
 String text = implNodelet.getInnerText();
 text = text.substring(0, text.length() > NODE_TEXT_ID_LENGTH ? NODE_TEXT_ID_LENGTH : text.length());
 String encoded = URL.encodePathSegment(text);
 encoded += "-" + implNodelet.getAbsoluteTop();
 
 return encoded;
}