1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.field;
17
18 import org.kuali.rice.krad.datadictionary.validator.ErrorReport;
19 import org.kuali.rice.krad.datadictionary.validator.RDValidator;
20 import org.kuali.rice.krad.datadictionary.validator.TracerToken;
21 import org.kuali.rice.krad.uif.component.Component;
22 import org.kuali.rice.krad.uif.component.ComponentSecurity;
23 import org.kuali.rice.krad.uif.element.Action;
24 import org.kuali.rice.krad.uif.element.Image;
25
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.Map;
29
30
31
32
33
34
35 public class ActionField extends FieldBase {
36 private static final long serialVersionUID = -8495752159848603102L;
37
38 private Action action;
39
40 public ActionField() {
41 action = new Action();
42 }
43
44
45
46
47 @Override
48 public List<Component> getComponentsForLifecycle() {
49 List<Component> components = super.getComponentsForLifecycle();
50
51 components.add(action);
52
53 return components;
54 }
55
56
57
58
59
60
61 public Action getAction() {
62 return action;
63 }
64
65
66
67
68
69
70 public void setAction(Action action) {
71 this.action = action;
72 }
73
74
75
76
77 public String getMethodToCall() {
78 return action.getMethodToCall();
79 }
80
81
82
83
84 public void setMethodToCall(String methodToCall) {
85 action.setMethodToCall(methodToCall);
86 }
87
88
89
90
91 public String getActionLabel() {
92 return action.getActionLabel();
93 }
94
95
96
97
98 public void setActionLabel(String actionLabel) {
99 action.setActionLabel(actionLabel);
100 }
101
102
103
104
105 public Image getActionImage() {
106 return action.getActionImage();
107 }
108
109
110
111
112 public void setActionImage(Image actionImage) {
113 action.setActionImage(actionImage);
114 }
115
116
117
118
119 public String getNavigateToPageId() {
120 return action.getNavigateToPageId();
121 }
122
123
124
125
126 public void setNavigateToPageId(String navigateToPageId) {
127 action.setNavigateToPageId(navigateToPageId);
128 }
129
130
131
132
133 public String getActionEvent() {
134 return action.getActionEvent();
135 }
136
137
138
139
140 public void setActionEvent(String actionEvent) {
141 action.setActionEvent(actionEvent);
142 }
143
144
145
146
147 public Map<String, String> getActionParameters() {
148 return action.getActionParameters();
149 }
150
151
152
153
154 public void setActionParameters(Map<String, String> actionParameters) {
155 action.setActionParameters(actionParameters);
156 }
157
158
159
160
161 public void addActionParameter(String parameterName, String parameterValue) {
162 action.addActionParameter(parameterName, parameterValue);
163 }
164
165
166
167
168 public String getActionParameter(String parameterName) {
169 return action.getActionParameter(parameterName);
170 }
171
172
173
174
175 public void setComponentSecurity(ComponentSecurity componentSecurity) {
176 action.setComponentSecurity(componentSecurity);
177 }
178
179
180
181
182 public String getJumpToIdAfterSubmit() {
183 return action.getJumpToIdAfterSubmit();
184 }
185
186
187
188
189 public void setJumpToIdAfterSubmit(String jumpToIdAfterSubmit) {
190 action.setJumpToIdAfterSubmit(jumpToIdAfterSubmit);
191 }
192
193
194
195
196 public String getJumpToNameAfterSubmit() {
197 return action.getJumpToNameAfterSubmit();
198 }
199
200
201
202
203 public void setJumpToNameAfterSubmit(String jumpToNameAfterSubmit) {
204 action.setJumpToNameAfterSubmit(jumpToNameAfterSubmit);
205 }
206
207
208
209
210 public String getFocusOnIdAfterSubmit() {
211 return action.getFocusOnIdAfterSubmit();
212 }
213
214
215
216
217 public void setFocusOnIdAfterSubmit(String focusOnAfterSubmit) {
218 action.setFocusOnIdAfterSubmit(focusOnAfterSubmit);
219 }
220
221
222
223
224 public boolean isPerformClientSideValidation() {
225 return action.isPerformClientSideValidation();
226 }
227
228
229
230
231 public void setPerformClientSideValidation(boolean clientSideValidate) {
232 action.setPerformClientSideValidation(clientSideValidate);
233 }
234
235
236
237
238 public String getActionScript() {
239 return action.getActionScript();
240 }
241
242
243
244
245 public void setActionScript(String actionScript) {
246 action.setActionScript(actionScript);
247 }
248
249
250
251
252 public boolean isPerformDirtyValidation() {
253 return action.isPerformDirtyValidation();
254 }
255
256
257
258
259 public void setPerformDirtyValidation(boolean blockValidateDirty) {
260 action.setPerformDirtyValidation(blockValidateDirty);
261 }
262
263
264
265
266 public boolean isDisabled() {
267 return action.isDisabled();
268 }
269
270
271
272
273 public void setDisabled(boolean disabled) {
274 action.setDisabled(disabled);
275 }
276
277
278
279
280 public String getDisabledReason() {
281 return action.getDisabledReason();
282 }
283
284
285
286
287 public void setDisabledReason(String disabledReason) {
288 action.setDisabledReason(disabledReason);
289 }
290
291
292
293
294 public String getActionImagePlacement() {
295 return action.getActionImagePlacement();
296 }
297
298
299
300
301 public void setActionImagePlacement(String actionImageLocation) {
302 action.setActionImagePlacement(actionImageLocation);
303 }
304
305
306
307
308 public String getPreSubmitCall() {
309 return action.getPreSubmitCall();
310 }
311
312
313
314
315 public void setPreSubmitCall(String preSubmitCall) {
316 action.setPreSubmitCall(preSubmitCall);
317 }
318
319
320
321
322 public boolean isAjaxSubmit() {
323 return action.isAjaxSubmit();
324 }
325
326
327
328
329 public void setAjaxSubmit(boolean ajaxSubmit) {
330 action.setAjaxSubmit(ajaxSubmit);
331 }
332
333
334
335
336
337 public String getSuccessCallback() {
338 return action.getSuccessCallback();
339 }
340
341
342
343
344
345 public void setSuccessCallback(String successCallback) {
346 action.setSuccessCallback(successCallback);
347 }
348
349
350
351
352
353 public String getErrorCallback() {
354 return action.getErrorCallback();
355 }
356
357
358
359
360
361
362 public void setErrorCallback(String errorCallback) {
363 action.setErrorCallback(errorCallback);
364 }
365
366
367
368
369 @Override
370 public ArrayList<ErrorReport> completeValidation(TracerToken tracer){
371 ArrayList<ErrorReport> reports=new ArrayList<ErrorReport>();
372 tracer.addBean(this);
373
374
375 if(getAction()==null){
376 if(RDValidator.checkExpressions(this,"action")){
377 ErrorReport error = ErrorReport.createWarning("Action should not be null",tracer);
378 error.addCurrentValue("action ="+getAction());
379 reports.add(error);
380 }
381 }
382
383
384 if(getLabel()==null){
385 if(RDValidator.checkExpressions(this,"label")){
386 ErrorReport error = ErrorReport.createWarning("Label is null, action should be used instead",tracer);
387 error.addCurrentValue("label ="+getLabel());
388 error.addCurrentValue("action ="+getAction());
389 reports.add(error);
390 }
391 }
392
393 reports.addAll(super.completeValidation(tracer.getCopy()));
394
395 return reports;
396 }
397 }