ExecuteDispatcher.java
4.04 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.form;
import com.adobe.xfa.AppModel;
import com.adobe.xfa.Attribute;
import com.adobe.xfa.Dispatcher;
import com.adobe.xfa.Element;
import com.adobe.xfa.EnumValue;
import com.adobe.xfa.EventManager;
import com.adobe.xfa.Model;
import com.adobe.xfa.Node;
import com.adobe.xfa.XFA;
import com.adobe.xfa.form.FormExclGroup;
import com.adobe.xfa.form.FormField;
import com.adobe.xfa.form.FormModel;
import com.adobe.xfa.form.FormSubform;
import com.adobe.xfa.template.TemplateModel;
import com.adobe.xfa.template.containers.Container;
import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.ResId;
class ExecuteDispatcher
extends Dispatcher {
private final Element mExecuteNode;
private final boolean mbValidate;
ExecuteDispatcher(Element scriptContextNode, String sEventContext, int nEventID, EventManager eventManager, Element executeNode, boolean bValidate) {
super(scriptContextNode, sEventContext, nEventID, eventManager);
this.mExecuteNode = executeNode;
this.mbValidate = bValidate;
}
@Override
public void dispatch() {
int ePresence;
TemplateModel templateModel;
Container container;
Element node = this.getActionContextNode();
if (node == null) {
return;
}
int eRunAt = this.getRunAt();
String sConnection = this.getConnection();
int eExecuteType = this.getExecuteType();
assert (node instanceof FormField || node instanceof FormSubform || node instanceof FormExclGroup);
FormModel formModel = (FormModel)node.getModel();
int eModelRunAtSetting = formModel.getRunScripts();
AppModel appModel = node.getAppModel();
if (appModel != null && (templateModel = TemplateModel.getTemplateModel(appModel, false)) != null && templateModel.getOriginalXFAVersion() >= 30 && node instanceof Container && 1076494339 == (ePresence = (container = (Container)node).getRuntimePresence(0))) {
return;
}
boolean bValid = true;
if (this.mbValidate) {
bValid = formModel.performPreEventValidations();
}
if (bValid) {
FormModel.Execute execute;
if (eRunAt != 1079836672 && eModelRunAtSetting == 1080754176) {
formModel.serverExchange(node, "click");
}
if ((execute = formModel.getExecute()) == null) {
return;
}
boolean bLegacyScripting = true;
TemplateModel oTemplateModel = TemplateModel.getTemplateModel(appModel, true);
if (null != oTemplateModel && !oTemplateModel.getLegacySetting(AppModel.XFA_LEGACY_V32_SCRIPTING)) {
bLegacyScripting = false;
}
if (bLegacyScripting) {
execute.execute(sConnection, eRunAt, eExecuteType);
} else if (eRunAt != 1079836673) {
execute.execute(sConnection, eRunAt, eExecuteType);
}
} else {
ExFull exFull = new ExFull(ResId.FormExecuteCancelled);
formModel.addErrorList(exFull, 3, this.getActionContextNode());
}
}
int getRunAt() {
if (this.mExecuteNode != null) {
Attribute runAt = this.mExecuteNode.getAttribute(XFA.RUNATTAG);
int eRunAt = ((EnumValue)runAt).getInt();
return eRunAt;
}
return 1079836674;
}
String getConnection() {
if (this.mExecuteNode != null) {
Attribute connectionAttr = this.mExecuteNode.getAttribute(XFA.CONNECTIONTAG);
String sConnection = connectionAttr.toString();
return sConnection;
}
return "";
}
int getExecuteType() {
if (this.mExecuteNode != null) {
Attribute executeType = this.mExecuteNode.getAttribute(XFA.EXECUTETYPETAG);
int eExecuteType = ((EnumValue)executeType).getInt();
return eExecuteType;
}
return 6291456;
}
@Override
public String getDispatcherType() {
return "execute";
}
}