FormSubformSet.java
4.13 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.form;
import com.adobe.xfa.Attribute;
import com.adobe.xfa.DependencyTracker;
import com.adobe.xfa.Element;
import com.adobe.xfa.EnumValue;
import com.adobe.xfa.Node;
import com.adobe.xfa.Obj;
import com.adobe.xfa.ProtoableNode;
import com.adobe.xfa.XFA;
import com.adobe.xfa.form.FormInstanceManager;
import com.adobe.xfa.form.FormSubform;
import com.adobe.xfa.template.containers.SubformSet;
import com.adobe.xfa.ut.StringUtils;
public class FormSubformSet
extends SubformSet {
private FormInstanceManager mInstanceManager;
private boolean mbIsLayoutNode;
public FormSubformSet(Element parent, Node prevSibling) {
super(parent, prevSibling);
}
int getRelation() {
ProtoableNode proto;
int relation = -2144600064;
if (this.hasProto() && (proto = this.getProto()).isPropertySpecified(XFA.RELATIONTAG, true, 0)) {
relation = ((EnumValue)proto.getAttribute(XFA.RELATIONTAG)).getInt();
}
return relation;
}
boolean isValidSubformChild(String sName) {
if (StringUtils.isEmpty(sName)) {
return false;
}
String aName = sName.intern();
if (this.hasProto()) {
ProtoableNode proto = this.getProto();
for (Node child = proto.getFirstXFAChild(); child != null; child = child.getNextXFASibling()) {
if (!child.isSameClass(XFA.SUBFORMTAG) || child.getName() != aName) continue;
return true;
}
}
return false;
}
FormSubform getSubformChild(String sName) {
if (StringUtils.isEmpty(sName)) {
return null;
}
String aName = sName.intern();
for (Node child = this.getFirstXFAChild(); child != null; child = child.getNextXFASibling()) {
FormSubform formSubform;
if (!(child instanceof FormSubform) || (formSubform = (FormSubform)child).getName() != aName) continue;
return formSubform;
}
return null;
}
boolean isLayoutNode() {
return this.mbIsLayoutNode;
}
void setLayoutNode() {
this.mbIsLayoutNode = true;
}
@Override
public boolean isSpecified(int eTag, boolean bCheckProtos, int nOccurrence) {
FormInstanceManager manager;
if (eTag == XFA.OCCURTAG && (manager = this.getInstanceManager()) != null) {
return manager.isSpecified(eTag, bCheckProtos, nOccurrence);
}
return super.isSpecified(eTag, bCheckProtos, nOccurrence);
}
@Override
public Element getElement(int eTag, boolean bPeek, int nOccurrence, boolean bReturnDefault, boolean bValidate) {
FormInstanceManager manager;
if (eTag == XFA.OCCURTAG && (manager = this.getInstanceManager()) != null) {
return manager.getElement(eTag, bPeek, nOccurrence, bReturnDefault, bValidate);
}
return super.getElement(eTag, bPeek, nOccurrence, bReturnDefault, bValidate);
}
@Override
public Node setElement(Node child, int eTag, int nOccurrence) {
FormInstanceManager manager;
if (eTag == XFA.OCCURTAG && (manager = this.getInstanceManager()) != null) {
manager.setElement(child, eTag, nOccurrence);
}
return super.setElement(child, eTag, nOccurrence);
}
@Override
public FormInstanceManager getInstanceManager() {
return this.mInstanceManager;
}
void setInstanceManager(FormInstanceManager instanceManager) {
this.mInstanceManager = instanceManager;
}
@Override
protected int getInstanceIndex(DependencyTracker dependencyTrack) {
if (this.mInstanceManager != null) {
if (dependencyTrack != null) {
dependencyTrack.addDependency(this.mInstanceManager);
}
return this.mInstanceManager.findIndex(this);
}
return 0;
}
@Override
public void setInstanceIndex(int nMoveTo) {
if (this.mInstanceManager != null) {
int nIndex = this.mInstanceManager.findIndex(this);
this.mInstanceManager.moveInstance(nIndex, nMoveTo, true);
}
}
}