SVGTextData.java 1.21 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa.svg;

import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.TextNode;
import com.adobe.xfa.XFA;

public class SVGTextData
extends TextNode {
    public SVGTextData(Element oParent, Node oNode, String text) {
        super(oParent, oNode, text);
    }

    @Override
    public Node clone(Element parent) {
        return new SVGTextData(parent, parent.getLastXMLChild(), this.getValue());
    }

    @Override
    public String getValue() {
        StringBuilder sReturn = new StringBuilder();
        if (this.getClassTag() == XFA.TEXTNODETAG) {
            sReturn.append(super.getValue());
        } else {
            this.getValuesFromDom(sReturn, this);
        }
        return sReturn.toString();
    }

    public void setValue(String sData) {
        super.setValue(sData, false, false);
        this.makeNonDefault(false);
    }

    public String toString() {
        return this.getValue();
    }

    private void getValuesFromDom(StringBuilder textValue, Node oNode) {
        for (Node child = oNode.getFirstXMLChild(); child != null; child = child.getNextXMLSibling()) {
            this.getValuesFromDom(textValue, child);
        }
    }
}