DoRTextBoxElement.java
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* 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
* org.apache.commons.lang3.StringUtils
*/
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.Map;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
public class DoRTextBoxElement
extends DoRElement {
public DoRTextBoxElement(Element xfaElement) throws Exception {
super(xfaElement);
this.xPathExprs.put("multiLine", "ui/textEdit/@multiLine");
this.xPathExprs.put("maxChars", "value/text/@maxChars");
}
@Override
public void applyProperties(Properties properties) throws Exception {
String allowRichText = properties.getProperty("allowRichText", "false");
Value valueNode = (Value)this.xfaElement.resolveNode("#value");
if (StringUtils.equals((CharSequence)allowRichText, (CharSequence)"true")) {
DoRUtils.enableRichText((Value)valueNode);
if (properties.containsKey("_value") && valueNode != null) {
String plainText = properties.getProperty("_value");
plainText = DoRUtils.convertToPlainText((String)plainText);
DoRUtils.setValue((Content)((Content)valueNode.getOneOfChild()), (String)plainText, (String)"text/html");
}
} else {
DoRUtils.enablePlainText((Value)valueNode);
if (properties.containsKey("_value") && valueNode != null) {
DoRUtils.setValue((Content)((Content)valueNode.getOneOfChild()), (String)properties.getProperty("_value"), (String)null);
}
}
properties.remove("_value");
super.applyProperties(properties, true);
}
}