Picture.java
3.68 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.template.formatting;
import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.ProtoableNode;
import com.adobe.xfa.ScriptTable;
import com.adobe.xfa.TextNode;
import com.adobe.xfa.XFA;
import com.adobe.xfa.template.formatting.PictureScript;
import com.adobe.xfa.ut.BooleanHolder;
import com.adobe.xfa.ut.PictureFmt;
import com.adobe.xfa.ut.StringHolder;
import com.adobe.xfa.ut.StringUtils;
import org.xml.sax.Attributes;
public final class Picture
extends ProtoableNode {
public Picture(Element parent, Node prevSibling) {
super(parent, prevSibling, null, "picture", "picture", null, XFA.PICTURETAG, "picture");
}
public boolean formatString(String sSource, String sLocale, StringBuilder sResult) {
Element poParent;
String sMask = "";
TextNode oTextNode = this.getText(true, false, false);
if (oTextNode != null) {
sMask = oTextNode.getValue();
}
if (StringUtils.isEmpty(sMask)) {
return true;
}
for (poParent = this.getXFAParent(); poParent != null && !poParent.isSameClass(XFA.FIELDTAG); poParent = poParent.getXFAParent()) {
}
Element poValueNode = null;
if (poParent != null) {
poValueNode = poParent.getElement(XFA.VALUETAG, true, 0, true, false);
}
Node poContentNode = null;
if (poValueNode != null) {
poContentNode = poValueNode.getOneOfChild(false, true);
}
if (poContentNode != null && poContentNode.isSameClass(XFA.TEXTTAG) && PictureFmt.isTextPicture(sMask)) {
return PictureFmt.formatText(sSource, sMask, sLocale, sResult);
}
PictureFmt oPict = new PictureFmt(sLocale);
return oPict.format(sSource, sMask, sResult);
}
public String getValue() {
String sValue = "";
TextNode oTextNode = this.getText(true, false, false);
if (oTextNode != null) {
sValue = oTextNode.getValue();
}
return sValue;
}
public void setNumericAttributes() {
}
public void setValue(String sText) {
if (sText == null) {
return;
}
TextNode oTextNode = this.getText(false, false, false);
oTextNode.setValue(sText, true, false);
this.notifyPeers(2, "", this);
}
public String unformatString(String sSource, String sLocale, BooleanHolder pbSuccess) {
Element poParent;
String sMask = "";
TextNode oTextNode = this.getText(true, false, false);
if (oTextNode != null) {
sMask = oTextNode.getValue();
}
for (poParent = this.getXFAParent(); poParent != null && !poParent.isSameClass(XFA.FIELDTAG); poParent = poParent.getXFAParent()) {
}
Element poValueNode = null;
if (poParent != null) {
poValueNode = poParent.getElement(XFA.VALUETAG, true, 0, true, false);
}
Node poContentNode = null;
if (poValueNode != null) {
poContentNode = poValueNode.getOneOfChild(false, true);
}
if (poContentNode != null && poContentNode.isSameClass(XFA.TEXTTAG) && PictureFmt.isTextPicture(sMask)) {
StringHolder sResult = new StringHolder();
boolean bSuccess = PictureFmt.parseText(sSource, sMask, sLocale, sResult);
if (pbSuccess != null) {
pbSuccess.value = bSuccess;
}
return sResult.value;
}
PictureFmt oPict = new PictureFmt(sLocale);
return oPict.parse(sSource, sMask, pbSuccess);
}
@Override
public ScriptTable getScriptTable() {
return PictureScript.getScriptTable();
}
}