Subform.java
6.96 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.template.containers;
import com.adobe.xfa.Arg;
import com.adobe.xfa.Attribute;
import com.adobe.xfa.DependencyTracker;
import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.Obj;
import com.adobe.xfa.ScriptDynamicPropObj;
import com.adobe.xfa.ScriptTable;
import com.adobe.xfa.StringAttr;
import com.adobe.xfa.XFA;
import com.adobe.xfa.data.DataNode;
import com.adobe.xfa.template.InstanceManager;
import com.adobe.xfa.template.TemplateModel;
import com.adobe.xfa.template.containers.Container;
import com.adobe.xfa.template.containers.SubformScript;
import com.adobe.xfa.template.containers.SubformSet;
import org.xml.sax.Attributes;
public class Subform
extends Container {
private static final ScriptDynamicPropObj getInstanceManagerScriptObj = new ScriptDynamicPropObj(21, 63){
@Override
public boolean invokeGetProp(Obj scriptThis, Arg retValue, String sPropertyName) {
return Subform.getInstanceManagerFunc(scriptThis, retValue, sPropertyName);
}
};
public Subform(Element parent, Node prevSibling) {
super(parent, prevSibling, null, "subform", "subform", null, XFA.SUBFORMTAG, "subform");
}
public Obj getInstanceManager() {
return new InstanceManager(this);
}
public DataNode getDataNode() {
return null;
}
public void execEvent(String sActivity) {
}
public boolean execValidate() {
return true;
}
@Override
public Attribute getAttribute(int eTag, boolean bPeek, boolean bValidate) {
Attribute oProperty = super.getAttribute(eTag, bPeek, bValidate);
if (eTag == XFA.LOCALETAG && !bPeek) {
if (oProperty != null && !oProperty.isEmpty()) {
return oProperty;
}
String sLocale = this.getInstalledLocale();
return this.newAttribute(eTag, sLocale);
}
return oProperty;
}
String getBackColor() {
Element pFillNode;
Element pColorNode;
String sRet = "";
Element pBorderNode = this.getElement(XFA.BORDERTAG, true, 0, true, false);
if (pBorderNode != null && (pFillNode = pBorderNode.getElement(XFA.FILLTAG, true, 0, true, false)) != null && (pColorNode = pFillNode.getElement(XFA.COLORTAG, true, 0, true, false)) != null) {
sRet = pColorNode.getAttribute(XFA.VALUETAG).toString();
}
return sRet;
}
String getBorderColor() {
Element pEdgeNode;
Element pColorNode;
String sRet = "";
Element pBorderNode = this.getElement(XFA.BORDERTAG, true, 0, true, false);
if (pBorderNode != null && (pEdgeNode = pBorderNode.getElement(XFA.EDGETAG, true, 0, true, false)) != null && (pColorNode = pEdgeNode.getElement(XFA.COLORTAG, true, 0, true, false)) != null) {
sRet = pColorNode.getAttribute(XFA.VALUETAG).toString();
}
return sRet;
}
String getBorderWidth() {
Element pEdgeNode;
String sRet = "";
Element pBorderNode = this.getElement(XFA.BORDERTAG, true, 0, true, false);
if (pBorderNode != null && (pEdgeNode = pBorderNode.getElement(XFA.EDGETAG, true, 0, true, false)) != null) {
sRet = pEdgeNode.getAttribute(XFA.THICKNESSTAG).toString();
}
return sRet;
}
protected int getInstanceIndex(DependencyTracker pDepTrack) {
return 0;
}
String getMessage() {
String sRet = "";
Element pValidateNode = this.getElement(XFA.VALIDATETAG, true, 0, false, false);
if (pValidateNode != null) {
sRet = TemplateModel.getValidationMessage(pValidateNode, "scriptTest");
}
return sRet;
}
@Override
public boolean isConnectSupported() {
return true;
}
@Override
public boolean isHeightGrowSupported() {
return true;
}
@Override
public boolean isWidthGrowSupported() {
return true;
}
public void reset() {
}
void setBackColor(String sString) {
Element pBorderNode = this.getElement(XFA.BORDERTAG, 0);
Element pFillNode = pBorderNode.getElement(XFA.FILLTAG, 0);
Element pColorNode = pFillNode.getElement(XFA.COLORTAG, 0);
pColorNode.setAttribute(new StringAttr("value", sString), XFA.VALUETAG);
}
void setBorderColor(String sString) {
Element pColorNode;
int i;
Element pBorderNode = this.getElement(XFA.BORDERTAG, 0);
for (i = 0; i < 4 && pBorderNode.isPropertySpecified(XFA.EDGETAG, true, i); ++i) {
Element pEdgeNode = pBorderNode.getElement(XFA.EDGETAG, false, i, false, false);
pColorNode = pEdgeNode.getElement(XFA.COLORTAG, 0);
pColorNode.setAttribute(new StringAttr("value", sString), XFA.VALUETAG);
}
for (i = 0; i < 4 && pBorderNode.isPropertySpecified(XFA.CORNERTAG, true, i); ++i) {
Element pCornerNode = pBorderNode.getElement(XFA.CORNERTAG, false, i, false, false);
pColorNode = pCornerNode.getElement(XFA.COLORTAG, 0);
pColorNode.setAttribute(new StringAttr("value", sString), XFA.VALUETAG);
}
}
void setBorderWidth(String sString) {
int i;
Element pBorderNode = this.getElement(XFA.BORDERTAG, 0);
for (i = 0; i < 4 && pBorderNode.isPropertySpecified(XFA.EDGETAG, true, i); ++i) {
Element pEdgeNode = pBorderNode.getElement(XFA.EDGETAG, false, i, false, false);
pEdgeNode.setAttribute(new StringAttr("thickness", sString), XFA.THICKNESSTAG);
}
for (i = 0; i < 4 && pBorderNode.isPropertySpecified(XFA.CORNERTAG, true, i); ++i) {
Element pCornerNode = pBorderNode.getElement(XFA.CORNERTAG, false, i, false, false);
pCornerNode.setAttribute(new StringAttr("thickness", sString), XFA.THICKNESSTAG);
}
}
public void setInstanceIndex(int nIndex) {
}
void setMessage(String sString) {
Element pValidateNode = this.getElement(XFA.VALIDATETAG, 0);
TemplateModel.setValidationMessage(pValidateNode, sString, "scriptTest");
}
@Override
public ScriptTable getScriptTable() {
return SubformScript.getScriptTable();
}
@Override
protected ScriptDynamicPropObj getDynamicScriptProp(String sPropertyName, boolean bPropertyOverride, boolean bPeek) {
String sNewName;
Node oChild;
if (sPropertyName.length() > 0 && sPropertyName.charAt(0) == '_' && (sNewName = sPropertyName.substring(1)).length() > 0 && (oChild = this.locateChildByName(sNewName, 0)) != null && (oChild instanceof Subform || oChild instanceof SubformSet)) {
return getInstanceManagerScriptObj;
}
return super.getDynamicScriptProp(sPropertyName, bPropertyOverride, bPeek);
}
private static boolean getInstanceManagerFunc(Obj oObj, Arg oRetVal, String sProp) {
Subform oSubform = (Subform)oObj;
oRetVal.setObject(oSubform.getInstanceManager());
return true;
}
}