DoRTextDrawElement.java 1.48 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.aemds.guide.addon.dor.DoRUtils
 *  com.adobe.xfa.Element
 *  com.adobe.xfa.Node
 *  com.adobe.xfa.content.Content
 *  com.adobe.xfa.template.Value
 */
package com.adobe.aemds.guide.addon.dor.elements;

import com.adobe.aemds.guide.addon.dor.DoRUtils;
import com.adobe.aemds.guide.addon.dor.elements.DoRElement;
import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.content.Content;
import com.adobe.xfa.template.Value;
import java.util.Properties;

public class DoRTextDrawElement
extends DoRElement {
    public DoRTextDrawElement(Element xfaElement) throws Exception {
        super(xfaElement);
    }

    protected String massageText(String text) {
        return DoRUtils.convertToPlainText((String)text);
    }

    @Override
    public void applyProperties(Properties properties) throws Exception {
        if (!properties.containsKey("_value")) {
            properties.put("_value", "");
        }
        Value valueNode = (Value)this.xfaElement.resolveNode("#value");
        DoRUtils.enableRichText((Value)valueNode);
        if (properties.containsKey("_value")) {
            String text = properties.getProperty("_value");
            text = this.massageText(text);
            DoRUtils.setValue((Content)((Content)valueNode.getOneOfChild()), (String)text, (String)"text/html");
            properties.remove("_value");
        }
        super.applyProperties(properties, true);
    }
}