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 java.util.ArrayList;
19 import java.util.Map;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
23 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
24 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
25 import org.kuali.rice.krad.datadictionary.validator.ErrorReport;
26 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
27 import org.kuali.rice.krad.datadictionary.validator.Validator;
28 import org.kuali.rice.krad.uif.element.Action;
29 import org.kuali.rice.krad.uif.element.Image;
30 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
31 import org.kuali.rice.krad.uif.util.LifecycleElement;
32
33
34
35
36
37
38 @BeanTags({@BeanTag(name = "actionField", parent = "Uif-ActionField"),
39 @BeanTag(name = "actionLinkField", parent = "Uif-ActionLinkField")})
40 public class ActionField extends FieldBase {
41 private static final long serialVersionUID = -8495752159848603102L;
42
43 private Action action;
44
45
46
47
48 public ActionField() {
49 action = new Action();
50 }
51
52
53
54
55
56
57
58
59 @Override
60 public void performFinalize(Object model, LifecycleElement parent) {
61 super.performFinalize(model, parent);
62
63
64 if (this.getFieldLabel() != null && this.getAction() != null && StringUtils.isNotBlank(
65 this.getAction().getId())) {
66 this.getFieldLabel().setLabelForComponentId(this.getAction().getId());
67 }
68 }
69
70
71
72
73
74
75 @BeanTagAttribute
76 public Action getAction() {
77 return action;
78 }
79
80
81
82
83
84
85 public void setAction(Action action) {
86 this.action = action;
87 }
88
89
90
91
92
93
94
95 @BeanTagAttribute
96 public String getMethodToCall() {
97 return action.getMethodToCall();
98 }
99
100
101
102
103
104
105
106 public void setMethodToCall(String methodToCall) {
107 action.setMethodToCall(methodToCall);
108 }
109
110
111
112
113
114
115
116 @BeanTagAttribute
117 public String getActionLabel() {
118 return action.getActionLabel();
119 }
120
121
122
123
124
125
126
127 public void setActionLabel(String actionLabel) {
128 action.setActionLabel(actionLabel);
129 }
130
131
132
133
134
135
136
137 @ViewLifecycleRestriction
138 @BeanTagAttribute
139 public Image getActionImage() {
140 return action.getActionImage();
141 }
142
143
144
145
146
147
148
149 public void setActionImage(Image actionImage) {
150 action.setActionImage(actionImage);
151 }
152
153
154
155
156
157
158 @BeanTagAttribute
159 public String getNavigateToPageId() {
160 return action.getNavigateToPageId();
161 }
162
163
164
165
166
167
168 public void setNavigateToPageId(String navigateToPageId) {
169 action.setNavigateToPageId(navigateToPageId);
170 }
171
172
173
174
175
176
177 @BeanTagAttribute
178 public String getActionEvent() {
179 return action.getActionEvent();
180 }
181
182
183
184
185
186
187 public void setActionEvent(String actionEvent) {
188 action.setActionEvent(actionEvent);
189 }
190
191
192
193
194 @BeanTagAttribute
195 public Map<String, String> getActionParameters() {
196 return action.getActionParameters();
197 }
198
199
200
201
202
203
204 public void setActionParameters(Map<String, String> actionParameters) {
205 action.setActionParameters(actionParameters);
206 }
207
208
209
210
211 @BeanTagAttribute
212 public Map<String, String> getAdditionalSubmitData() {
213 return action.getAdditionalSubmitData();
214 }
215
216
217
218
219
220
221 public void setAdditionalSubmitData(Map<String, String> additionalSubmitData) {
222 action.setAdditionalSubmitData(additionalSubmitData);
223 }
224
225
226
227
228 public void addActionParameter(String parameterName, String parameterValue) {
229 action.addActionParameter(parameterName, parameterValue);
230 }
231
232
233
234
235 public String getActionParameter(String parameterName) {
236 return action.getActionParameter(parameterName);
237 }
238
239
240
241
242 @BeanTagAttribute
243 public String getJumpToIdAfterSubmit() {
244 return action.getJumpToIdAfterSubmit();
245 }
246
247
248
249
250
251 public void setJumpToIdAfterSubmit(String jumpToIdAfterSubmit) {
252 action.setJumpToIdAfterSubmit(jumpToIdAfterSubmit);
253 }
254
255
256
257
258 @BeanTagAttribute
259 public String getJumpToNameAfterSubmit() {
260 return action.getJumpToNameAfterSubmit();
261 }
262
263
264
265
266 public void setJumpToNameAfterSubmit(String jumpToNameAfterSubmit) {
267 action.setJumpToNameAfterSubmit(jumpToNameAfterSubmit);
268 }
269
270
271
272
273 @BeanTagAttribute
274 public String getFocusOnIdAfterSubmit() {
275 return action.getFocusOnIdAfterSubmit();
276 }
277
278
279
280
281 public void setFocusOnIdAfterSubmit(String focusOnAfterSubmit) {
282 action.setFocusOnIdAfterSubmit(focusOnAfterSubmit);
283 }
284
285
286
287
288 @BeanTagAttribute
289 public boolean isPerformClientSideValidation() {
290 return action.isPerformClientSideValidation();
291 }
292
293
294
295
296 public void setPerformClientSideValidation(boolean clientSideValidate) {
297 action.setPerformClientSideValidation(clientSideValidate);
298 }
299
300
301
302
303 @BeanTagAttribute
304 public String getActionScript() {
305 return action.getActionScript();
306 }
307
308
309
310
311 public void setActionScript(String actionScript) {
312 action.setActionScript(actionScript);
313 }
314
315
316
317
318 @BeanTagAttribute
319 public boolean isPerformDirtyValidation() {
320 return action.isPerformDirtyValidation();
321 }
322
323
324
325
326 public void setPerformDirtyValidation(boolean blockValidateDirty) {
327 action.setPerformDirtyValidation(blockValidateDirty);
328 }
329
330
331
332
333 @BeanTagAttribute
334 public boolean isDisabled() {
335 return action.isDisabled();
336 }
337
338
339
340
341 public void setDisabled(boolean disabled) {
342 action.setDisabled(disabled);
343 }
344
345
346
347
348 @BeanTagAttribute
349 public String getDisabledReason() {
350 return action.getDisabledReason();
351 }
352
353
354
355
356 public void setDisabledReason(String disabledReason) {
357 action.setDisabledReason(disabledReason);
358 }
359
360
361
362
363 @BeanTagAttribute
364 public String getActionImagePlacement() {
365 return action.getActionImagePlacement();
366 }
367
368
369
370
371 public void setActionImagePlacement(String actionImageLocation) {
372 action.setActionImagePlacement(actionImageLocation);
373 }
374
375
376
377
378 @BeanTagAttribute
379 public String getPreSubmitCall() {
380 return action.getPreSubmitCall();
381 }
382
383
384
385
386 public void setPreSubmitCall(String preSubmitCall) {
387 action.setPreSubmitCall(preSubmitCall);
388 }
389
390
391
392
393 @BeanTagAttribute
394 public boolean isAjaxSubmit() {
395 return action.isAjaxSubmit();
396 }
397
398
399
400
401 public void setAjaxSubmit(boolean ajaxSubmit) {
402 action.setAjaxSubmit(ajaxSubmit);
403 }
404
405
406
407
408 @BeanTagAttribute
409 public String getSuccessCallback() {
410 return action.getSuccessCallback();
411 }
412
413
414
415
416
417 public void setSuccessCallback(String successCallback) {
418 action.setSuccessCallback(successCallback);
419 }
420
421
422
423
424 @BeanTagAttribute
425 public String getErrorCallback() {
426 return action.getErrorCallback();
427 }
428
429
430
431
432
433 public void setErrorCallback(String errorCallback) {
434 action.setErrorCallback(errorCallback);
435 }
436
437
438
439
440 @BeanTagAttribute
441 public String getRefreshId() {
442 return action.getRefreshId();
443 }
444
445
446
447
448 public void setRefreshId(String refreshId) {
449 action.setRefreshId(refreshId);
450 }
451
452
453
454
455 @BeanTagAttribute
456 public boolean isDisableBlocking() {
457 return action.isDisableBlocking();
458 }
459
460
461
462
463 public void setDisableBlocking(boolean disableBlocking) {
464 action.setDisableBlocking(disableBlocking);
465 }
466
467
468
469
470 @Override
471 public void completeValidation(ValidationTrace tracer) {
472 ArrayList<ErrorReport> reports = new ArrayList<ErrorReport>();
473 tracer.addBean(this);
474
475
476 if (getAction() == null) {
477 if (Validator.checkExpressions(this, "action")) {
478 String currentValues[] = {"action =" + getAction()};
479 tracer.createWarning("Action should not be null", currentValues);
480 }
481 }
482
483
484 if (getLabel() == null) {
485 if (Validator.checkExpressions(this, "label")) {
486 String currentValues[] = {"label =" + getLabel(), "action =" + getAction()};
487 tracer.createWarning("Label is null, action should be used instead", currentValues);
488 }
489 }
490
491 super.completeValidation(tracer.getCopy());
492 }
493 }