Example usage for com.google.gwt.user.client Element getNodeValue

List of usage examples for com.google.gwt.user.client Element getNodeValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client Element getNodeValue.

Prototype

@Override
    public String getNodeValue() 

Source Link

Usage

From source file:org.geomajas.gwt.client.util.impl.DomImpl.java

License:Open Source License

/**
 * Clone a single SVG element./* w ww.  ja  v a  2  s . com*/
 * 
 * @param source The source SVG element.
 * @return Returns the clone.
 */
public Element cloneSvgElement(Element source) {
    if (source == null || source.getNodeName() == null) {
        return null;
    }
    if ("#text".equals(source.getNodeName())) {
        return Document.get().createTextNode(source.getNodeValue()).cast();
    }
    Element clone = createElementNS(Dom.NS_SVG, source.getNodeName(), Dom.createUniqueId());
    cloneAttributes(source, clone);
    for (int i = 0; i < source.getChildCount(); i++) {
        Element child = source.getChild(i).cast();
        clone.appendChild(cloneSvgElement(child));
    }

    return clone;
}

From source file:org.geomajas.gwt2.client.gfx.VectorTileObject.java

License:Open Source License

/**
 * Clone a single SVG element./*  w w  w.  jav  a  2 s.  c  om*/
 * 
 * @param source
 *            The source SVG element.
 * @return Returns the clone.
 */
private static Element clone(Element source) {
    if (source == null || source.getNodeName() == null) {
        return null;
    }
    if ("#text".equals(source.getNodeName())) {
        return Document.get().createTextNode(source.getNodeValue()).cast();
    }
    Element clone = createElementNS(Dom.NS_SVG, source.getNodeName());
    cloneAttributes(source, clone);
    for (int i = 0; i < source.getChildCount(); i++) {
        Element child = source.getChild(i).cast();
        clone.appendChild(clone(child));
    }

    return clone;
}