1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.element;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.exception.RiceRuntimeException;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
21 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
23 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
24 import org.kuali.rice.krad.uif.UifConstants;
25 import org.kuali.rice.krad.uif.UifParameters;
26 import org.kuali.rice.krad.uif.UifPropertyPaths;
27 import org.kuali.rice.krad.uif.component.Component;
28 import org.kuali.rice.krad.uif.component.ComponentSecurity;
29 import org.kuali.rice.krad.uif.field.DataField;
30 import org.kuali.rice.krad.uif.view.ExpressionEvaluator;
31 import org.kuali.rice.krad.uif.util.ExpressionUtils;
32 import org.kuali.rice.krad.uif.util.ScriptUtils;
33 import org.kuali.rice.krad.uif.view.FormView;
34 import org.kuali.rice.krad.uif.view.View;
35 import org.kuali.rice.krad.util.KRADUtils;
36
37 import java.util.ArrayList;
38 import java.util.HashMap;
39 import java.util.List;
40 import java.util.Map;
41
42
43
44
45
46
47
48 @BeanTags({@BeanTag(name = "action-bean", parent = "Uif-Action"),
49 @BeanTag(name = "actionImage-bean", parent = "Uif-ActionImage"),
50 @BeanTag(name = "primaryActionButton-bean", parent = "Uif-PrimaryActionButton"),
51 @BeanTag(name = "secondaryActionButton-bean", parent = "Uif-SecondaryActionButton"),
52 @BeanTag(name = "primaryActionButton-small-bean", parent = "Uif-PrimaryActionButton-Small"),
53 @BeanTag(name = "secondaryActionButton-small-bean", parent = "Uif-SecondaryActionButton-Small"),
54 @BeanTag(name = "actionLink-bean", parent = "Uif-ActionLink"),
55 @BeanTag(name = "navigationActionLink-bean", parent = "Uif-NavigationActionLink"),
56 @BeanTag(name = "navigationActionButton-bean", parent = "Uif-NavigationActionButton"),
57 @BeanTag(name = "secondaryNavigationActionButton-bean", parent = "Uif-SecondaryNavigationActionButton"),
58 @BeanTag(name = "helpAction-bean", parent = "Uif-HelpAction"),
59 @BeanTag(name = "saveAction-bean", parent = "Uif-SaveAction"),
60 @BeanTag(name = "backAction-bean", parent = "Uif-BackAction"),
61 @BeanTag(name = "cancelAction-bean", parent = "Uif-CancelAction"),
62 @BeanTag(name = "checkFormAction-bean", parent = "Uif-CheckFormAction"),
63 @BeanTag(name = "addLineAction-bean", parent = "Uif-AddLineAction"),
64 @BeanTag(name = "deleteLineAction-bean", parent = "Uif-DeleteLineAction"),
65 @BeanTag(name = "saveLineAction-bean", parent = "Uif-SaveLineAction"),
66 @BeanTag(name = "addBlankLineAction-bean", parent = "Uif-AddBlankLineAction"),
67 @BeanTag(name = "addViaLightBoxAction-bean", parent = "Uif-AddViaLightBoxAction"),
68 @BeanTag(name = "toggleRowDetailsAction-bean", parent = "Uif-ToggleRowDetailsAction"),
69 @BeanTag(name = "expandDetailsAction-bean", parent = "Uif-ExpandDetailsAction"),
70 @BeanTag(name = "expandDetailsImageAction-bean", parent = "Uif-ExpandDetailsImageAction"),
71 @BeanTag(name = "jumpToTopLink-bean", parent = "Uif-JumpToTopLink"),
72 @BeanTag(name = "jumpToBottomLink-bean", parent = "Uif-JumpToBottomLink"),
73 @BeanTag(name = "expandDisclosuresButton-bean", parent = "Uif-ExpandDisclosuresButton"),
74 @BeanTag(name = "collapseDisclosuresButton-bean", parent = "Uif-CollapseDisclosuresButton"),
75 @BeanTag(name = "showInactiveCollectionItemsButton-bean", parent = "Uif-ShowInactiveCollectionItemsButton"),
76 @BeanTag(name = "hideInactiveCollectionItemsButton-bean", parent = "Uif-HideInactiveCollectionItemsButton"),
77 @BeanTag(name = "collectionQuickFinderAction-bean", parent = "Uif-CollectionQuickFinderAction")})
78 public class Action extends ContentElementBase {
79 private static final long serialVersionUID = 1025672792657238829L;
80
81 private String methodToCall;
82 private String actionEvent;
83 private String navigateToPageId;
84
85 private String actionScript;
86
87 private String actionLabel;
88 private Image actionImage;
89 private String actionImagePlacement;
90
91 private String jumpToIdAfterSubmit;
92 private String jumpToNameAfterSubmit;
93 private String focusOnIdAfterSubmit;
94
95 private boolean performClientSideValidation;
96 private boolean performDirtyValidation;
97 private boolean clearDirtyOnAction;
98 private boolean dirtyOnAction;
99
100 private String preSubmitCall;
101 private boolean ajaxSubmit;
102
103 private String ajaxReturnType;
104 private String refreshId;
105 private String refreshPropertyName;
106
107 private String successCallback;
108 private String errorCallback;
109
110 private String loadingMessageText;
111 private boolean disableBlocking;
112
113 private Map<String, String> additionalSubmitData;
114 private Map<String, String> actionParameters;
115
116 private boolean evaluateDisabledOnKeyUp;
117
118 private boolean disabled;
119 private String disabledReason;
120 private String disabledExpression;
121 private String disabledConditionJs;
122 private List<String> disabledConditionControlNames;
123
124 private List<String> disabledWhenChangedPropertyNames;
125 private List<String> enabledWhenChangedPropertyNames;
126
127 public Action() {
128 super();
129
130 actionImagePlacement = UifConstants.Position.LEFT.name();
131
132 ajaxSubmit = true;
133
134 successCallback = "";
135 errorCallback = "";
136 preSubmitCall = "";
137
138 additionalSubmitData = new HashMap<String, String>();
139 actionParameters = new HashMap<String, String>();
140
141 disabled = false;
142 disabledWhenChangedPropertyNames = new ArrayList<String>();
143 enabledWhenChangedPropertyNames = new ArrayList<String>();
144 }
145
146
147
148
149
150
151
152
153 public void performApplyModel(View view, Object model, Component parent) {
154 super.performApplyModel(view, model, parent);
155
156 disabledExpression = this.getPropertyExpression("disabled");
157 if (disabledExpression != null) {
158 ExpressionEvaluator expressionEvaluator = view.getViewHelperService().getExpressionEvaluator();
159
160 disabledExpression = expressionEvaluator.replaceBindingPrefixes(view, this, disabledExpression);
161 disabled = (Boolean) expressionEvaluator.evaluateExpression(this.getContext(), disabledExpression);
162 }
163 }
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180 @Override
181 public void performFinalize(View view, Object model, Component parent) {
182 super.performFinalize(view, model, parent);
183
184 ExpressionEvaluator expressionEvaluator = view.getViewHelperService().getExpressionEvaluator();
185
186 if (StringUtils.isNotEmpty(disabledExpression)
187 && !disabledExpression.equalsIgnoreCase("true")
188 && !disabledExpression.equalsIgnoreCase("false")) {
189 disabledConditionControlNames = new ArrayList<String>();
190 disabledConditionJs = ExpressionUtils.parseExpression(disabledExpression, disabledConditionControlNames);
191 }
192
193 List<String> adjustedDisablePropertyNames = new ArrayList<String>();
194 for (String propertyName : disabledWhenChangedPropertyNames) {
195 adjustedDisablePropertyNames.add(expressionEvaluator.replaceBindingPrefixes(view, this, propertyName));
196 }
197 disabledWhenChangedPropertyNames = adjustedDisablePropertyNames;
198
199 List<String> adjustedEnablePropertyNames = new ArrayList<String>();
200 for (String propertyName : enabledWhenChangedPropertyNames) {
201 adjustedEnablePropertyNames.add(expressionEvaluator.replaceBindingPrefixes(view, this, propertyName));
202 }
203 enabledWhenChangedPropertyNames = adjustedEnablePropertyNames;
204
205
206 if (actionImage != null && StringUtils.isNotBlank(actionImagePlacement) && StringUtils.isNotBlank(
207 actionLabel)) {
208 actionImage.setAltText("");
209 }
210
211 if (!actionParameters.containsKey(UifConstants.UrlParams.ACTION_EVENT) && StringUtils.isNotBlank(actionEvent)) {
212 actionParameters.put(UifConstants.UrlParams.ACTION_EVENT, actionEvent);
213 }
214
215 if (StringUtils.isNotBlank(navigateToPageId)) {
216 actionParameters.put(UifParameters.NAVIGATE_TO_PAGE_ID, navigateToPageId);
217 if (StringUtils.isBlank(methodToCall)) {
218 this.methodToCall = UifConstants.MethodToCallNames.NAVIGATE;
219 }
220 }
221
222 if (!actionParameters.containsKey(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME) && StringUtils
223 .isNotBlank(methodToCall)) {
224 actionParameters.put(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME, methodToCall);
225 }
226
227 setupRefreshAction(view);
228
229 buildActionData(view, model, parent);
230
231
232 String onClickScript = this.getOnClickScript();
233 if (StringUtils.isNotBlank(actionScript)) {
234 onClickScript = ScriptUtils.appendScript(onClickScript, actionScript);
235 } else {
236 onClickScript = ScriptUtils.appendScript(onClickScript, "actionInvokeHandler(this);");
237 }
238
239
240 if (view instanceof FormView) {
241 if (((FormView) view).isApplyDirtyCheck() && performDirtyValidation) {
242 onClickScript = "if (dirtyFormState.checkDirty(e) == false) { " + onClickScript + " ; } ";
243 }
244 }
245
246
247 if (disabled) {
248 this.addStyleClass("disabled");
249 this.setSkipInTabOrder(true);
250 }
251 onClickScript = "if(jQuery(this).hasClass('disabled')){ return false; }" + onClickScript;
252
253
254 this.addDataAttribute(UifConstants.DataAttributes.ONCLICK, KRADUtils.convertToHTMLAttributeSafeString(
255 "e.preventDefault();" + onClickScript));
256 }
257
258
259
260
261
262
263
264 protected void setupRefreshAction(View view) {
265
266
267 if (StringUtils.isNotBlank(refreshPropertyName) || StringUtils.isNotBlank(refreshId)) {
268 ajaxReturnType = UifConstants.AjaxReturnTypes.UPDATECOMPONENT.getKey();
269 }
270
271
272
273 Component refreshComponent = null;
274 if (StringUtils.isNotBlank(refreshPropertyName)) {
275
276 if (refreshPropertyName.startsWith(UifConstants.NO_BIND_ADJUST_PREFIX)) {
277 refreshPropertyName = StringUtils.removeStart(refreshPropertyName, UifConstants.NO_BIND_ADJUST_PREFIX);
278 } else if (StringUtils.isNotBlank(view.getDefaultBindingObjectPath())) {
279 refreshPropertyName = view.getDefaultBindingObjectPath() + "." + refreshPropertyName;
280 }
281
282 DataField dataField = view.getViewIndex().getDataFieldByPath(refreshPropertyName);
283 if (dataField != null) {
284 refreshComponent = dataField;
285 refreshId = refreshComponent.getId();
286 }
287 } else if (StringUtils.isNotBlank(refreshId)) {
288 Component component = view.getViewIndex().getComponentById(refreshId);
289 if (component != null) {
290 refreshComponent = component;
291 }
292 }
293
294 if (refreshComponent != null) {
295 refreshComponent.setRefreshedByAction(true);
296
297
298 Component initialComponent = view.getViewIndex().getInitialComponentStates().get(
299 refreshComponent.getBaseId());
300 if (initialComponent != null) {
301 initialComponent.setRefreshedByAction(true);
302 view.getViewIndex().getInitialComponentStates().put(refreshComponent.getBaseId(), initialComponent);
303 }
304 }
305 }
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320 protected void buildActionData(View view, Object model, Component parent) {
321
322 addDataAttribute("ajaxsubmit", Boolean.toString(ajaxSubmit));
323 addDataAttributeIfNonEmpty("successcallback", this.successCallback);
324 addDataAttributeIfNonEmpty("errorcallback", this.errorCallback);
325 addDataAttributeIfNonEmpty("presubmitcall", this.preSubmitCall);
326 addDataAttributeIfNonEmpty("loadingmessage", this.loadingMessageText);
327 addDataAttributeIfNonEmpty("disableblocking", Boolean.toString(this.disableBlocking));
328 addDataAttributeIfNonEmpty("ajaxreturntype", this.ajaxReturnType);
329 addDataAttributeIfNonEmpty("refreshid", this.refreshId);
330 addDataAttribute("validate", Boolean.toString(this.performClientSideValidation));
331 addDataAttribute("dirtyOnAction", Boolean.toString(this.dirtyOnAction));
332 addDataAttribute("clearDirtyOnAction", Boolean.toString(this.clearDirtyOnAction));
333
334
335 Map<String, String> submitData = new HashMap<String, String>();
336 for (String key : actionParameters.keySet()) {
337 String parameterPath = key;
338 if (!key.equals(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME)) {
339 parameterPath = UifPropertyPaths.ACTION_PARAMETERS + "[" + key + "]";
340 }
341 submitData.put(parameterPath, actionParameters.get(key));
342 }
343
344 for (String key : additionalSubmitData.keySet()) {
345 submitData.put(key, additionalSubmitData.get(key));
346 }
347
348
349 if (focusOnIdAfterSubmit == null) {
350 focusOnIdAfterSubmit = UifConstants.Order.SELF.toString();
351 }
352
353 if (focusOnIdAfterSubmit.equalsIgnoreCase(UifConstants.Order.SELF.toString())) {
354 focusOnIdAfterSubmit = this.getId();
355 submitData.put("focusId", focusOnIdAfterSubmit);
356 } else if (focusOnIdAfterSubmit.equalsIgnoreCase(UifConstants.Order.NEXT_INPUT.toString())) {
357 focusOnIdAfterSubmit = UifConstants.Order.NEXT_INPUT.toString() + ":" + this.getId();
358 submitData.put("focusId", focusOnIdAfterSubmit);
359 } else {
360
361 submitData.put("focusId", focusOnIdAfterSubmit);
362 }
363
364
365 if (StringUtils.isBlank(jumpToIdAfterSubmit) && StringUtils.isBlank(jumpToNameAfterSubmit)) {
366 jumpToIdAfterSubmit = this.getId();
367 submitData.put("jumpToId", jumpToIdAfterSubmit);
368 } else if (StringUtils.isNotBlank(jumpToIdAfterSubmit)) {
369 submitData.put("jumpToId", jumpToIdAfterSubmit);
370 } else {
371 submitData.put("jumpToName", jumpToNameAfterSubmit);
372 }
373
374 addDataAttribute(UifConstants.DataAttributes.SUBMIT_DATA, ScriptUtils.toJSON(submitData));
375 }
376
377
378
379
380 @Override
381 public List<Component> getComponentsForLifecycle() {
382 List<Component> components = super.getComponentsForLifecycle();
383
384 components.add(actionImage);
385
386 return components;
387 }
388
389
390
391
392
393
394
395
396
397
398
399
400
401 @BeanTagAttribute(name = "methodToCall")
402 public String getMethodToCall() {
403 return this.methodToCall;
404 }
405
406
407
408
409
410
411 public void setMethodToCall(String methodToCall) {
412 this.methodToCall = methodToCall;
413 }
414
415
416
417
418
419
420
421
422
423
424
425
426 @BeanTagAttribute(name = "actionLabel")
427 public String getActionLabel() {
428 return this.actionLabel;
429 }
430
431
432
433
434
435
436 public void setActionLabel(String actionLabel) {
437 this.actionLabel = actionLabel;
438 }
439
440
441
442
443
444
445
446
447
448
449
450
451
452 @BeanTagAttribute(name = "actionImage", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
453 public Image getActionImage() {
454 return this.actionImage;
455 }
456
457
458
459
460
461
462 public void setActionImage(Image actionImage) {
463 this.actionImage = actionImage;
464 }
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480 @BeanTagAttribute(name = "navigateToPageId")
481 public String getNavigateToPageId() {
482 return this.navigateToPageId;
483 }
484
485
486
487
488
489
490 public void setNavigateToPageId(String navigateToPageId) {
491 this.navigateToPageId = navigateToPageId;
492 }
493
494
495
496
497
498
499
500
501
502
503
504
505 @BeanTagAttribute(name = "actionEvent")
506 public String getActionEvent() {
507 return actionEvent;
508 }
509
510
511
512
513
514
515 public void setActionEvent(String actionEvent) {
516 this.actionEvent = actionEvent;
517 }
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538 @BeanTagAttribute(name = "additionalSubmitData", type = BeanTagAttribute.AttributeType.MAPVALUE)
539 public Map<String, String> getAdditionalSubmitData() {
540 return additionalSubmitData;
541 }
542
543
544
545
546
547
548 public void setAdditionalSubmitData(Map<String, String> additionalSubmitData) {
549 this.additionalSubmitData = additionalSubmitData;
550 }
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568 @BeanTagAttribute(name = "actionParameters", type = BeanTagAttribute.AttributeType.MAPVALUE)
569 public Map<String, String> getActionParameters() {
570 return this.actionParameters;
571 }
572
573
574
575
576
577
578 public void setActionParameters(Map<String, String> actionParameters) {
579 this.actionParameters = actionParameters;
580 }
581
582
583
584
585
586
587
588 public void addActionParameter(String parameterName, String parameterValue) {
589 if (actionParameters == null) {
590 this.actionParameters = new HashMap<String, String>();
591 }
592
593 this.actionParameters.put(parameterName, parameterValue);
594 }
595
596
597
598
599 public String getActionParameter(String parameterName) {
600 return this.actionParameters.get(parameterName);
601 }
602
603
604
605
606
607
608 public ActionSecurity getActionSecurity() {
609 return (ActionSecurity) super.getComponentSecurity();
610 }
611
612
613
614
615
616
617 @Override
618 public void setComponentSecurity(ComponentSecurity componentSecurity) {
619 if ((componentSecurity != null) && !(componentSecurity instanceof ActionSecurity)) {
620 throw new RiceRuntimeException("Component security for Action should be instance of ActionSecurity");
621 }
622
623 super.setComponentSecurity(componentSecurity);
624 }
625
626 @Override
627 protected Class<? extends ComponentSecurity> getComponentSecurityClass() {
628 return ActionSecurity.class;
629 }
630
631
632
633
634 @BeanTagAttribute(name = "jumpToIdAfterSubmit")
635 public String getJumpToIdAfterSubmit() {
636 return this.jumpToIdAfterSubmit;
637 }
638
639
640
641
642
643
644
645
646
647
648
649
650 public void setJumpToIdAfterSubmit(String jumpToIdAfterSubmit) {
651 this.jumpToIdAfterSubmit = jumpToIdAfterSubmit;
652 }
653
654
655
656
657
658
659
660
661
662
663
664 @BeanTagAttribute(name = "jumpToNameAfterSubmit")
665 public String getJumpToNameAfterSubmit() {
666 return this.jumpToNameAfterSubmit;
667 }
668
669
670
671
672 public void setJumpToNameAfterSubmit(String jumpToNameAfterSubmit) {
673 this.jumpToNameAfterSubmit = jumpToNameAfterSubmit;
674 }
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693 @BeanTagAttribute(name = "focusOnIdAfterSubmit")
694 public String getFocusOnIdAfterSubmit() {
695 return this.focusOnIdAfterSubmit;
696 }
697
698
699
700
701 public void setFocusOnIdAfterSubmit(String focusOnIdAfterSubmit) {
702 this.focusOnIdAfterSubmit = focusOnIdAfterSubmit;
703 }
704
705
706
707
708
709
710 @BeanTagAttribute(name = "performClientSideValidation")
711 public boolean isPerformClientSideValidation() {
712 return this.performClientSideValidation;
713 }
714
715
716
717
718
719
720 public void setPerformClientSideValidation(boolean performClientSideValidation) {
721 this.performClientSideValidation = performClientSideValidation;
722 }
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738 @BeanTagAttribute(name = "actionScript")
739 public String getActionScript() {
740 return this.actionScript;
741 }
742
743
744
745
746 public void setActionScript(String actionScript) {
747 if (StringUtils.isNotBlank(actionScript) && !StringUtils.endsWith(actionScript, ";")) {
748 actionScript = actionScript + ";";
749 }
750
751 this.actionScript = actionScript;
752 }
753
754
755
756
757 public void setPerformDirtyValidation(boolean performDirtyValidation) {
758 this.performDirtyValidation = performDirtyValidation;
759 }
760
761
762
763
764 @BeanTagAttribute(name = "performDirtyValidation")
765 public boolean isPerformDirtyValidation() {
766 return performDirtyValidation;
767 }
768
769
770
771
772
773
774
775
776
777 @BeanTagAttribute(name = "clearDirtyOnAction")
778 public boolean isClearDirtyOnAction() {
779 return clearDirtyOnAction;
780 }
781
782
783
784
785
786
787 public void setClearDirtyOnAction(boolean clearDirtyOnAction) {
788 this.clearDirtyOnAction = clearDirtyOnAction;
789 }
790
791
792
793
794
795
796
797
798
799
800 @BeanTagAttribute(name = "dirtyOnAction")
801 public boolean isDirtyOnAction() {
802 return dirtyOnAction;
803 }
804
805
806
807
808
809
810 public void setDirtyOnAction(boolean dirtyOnAction) {
811 this.dirtyOnAction = dirtyOnAction;
812 }
813
814
815
816
817
818
819 @BeanTagAttribute(name = "disabled")
820 public boolean isDisabled() {
821 return disabled;
822 }
823
824
825
826
827
828
829 public void setDisabled(boolean disabled) {
830 this.disabled = disabled;
831 }
832
833
834
835
836
837
838
839
840 @BeanTagAttribute(name = "disabledReason")
841 public String getDisabledReason() {
842 return disabledReason;
843 }
844
845
846
847
848
849
850 public void setDisabledReason(String disabledReason) {
851 this.disabledReason = disabledReason;
852 }
853
854 @BeanTagAttribute(name = "actionImagePlacement")
855 public String getActionImagePlacement() {
856 return actionImagePlacement;
857 }
858
859
860
861
862
863
864
865
866
867 public void setActionImagePlacement(String actionImagePlacement) {
868 this.actionImagePlacement = actionImagePlacement;
869 }
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892 @BeanTagAttribute(name = "preSubmitCall")
893 public String getPreSubmitCall() {
894 return preSubmitCall;
895 }
896
897
898
899
900
901
902 public void setPreSubmitCall(String preSubmitCall) {
903 this.preSubmitCall = preSubmitCall;
904 }
905
906
907
908
909
910
911
912 @BeanTagAttribute(name = "ajaxSubmit")
913 public boolean isAjaxSubmit() {
914 return ajaxSubmit;
915 }
916
917
918
919
920
921
922 public void setAjaxSubmit(boolean ajaxSubmit) {
923 this.ajaxSubmit = ajaxSubmit;
924 }
925
926
927
928
929
930
931
932
933
934
935
936
937 @BeanTagAttribute(name = "ajaxReturnType")
938 public String getAjaxReturnType() {
939 return this.ajaxReturnType;
940 }
941
942
943
944
945
946
947 public void setAjaxReturnType(String ajaxReturnType) {
948 this.ajaxReturnType = ajaxReturnType;
949 }
950
951
952
953
954
955
956 @BeanTagAttribute(name = "displayResponseInLightBox")
957 public boolean isDisplayResponseInLightBox() {
958 return StringUtils.equals(this.ajaxReturnType, UifConstants.AjaxReturnTypes.DISPLAYLIGHTBOX.getKey());
959 }
960
961
962
963
964
965
966 public void setDisplayResponseInLightBox(boolean displayResponseInLightBox) {
967 if (displayResponseInLightBox) {
968 this.ajaxReturnType = UifConstants.AjaxReturnTypes.DISPLAYLIGHTBOX.getKey();
969 }
970
971 else if (StringUtils.equals(this.ajaxReturnType, UifConstants.AjaxReturnTypes.DISPLAYLIGHTBOX.getKey())) {
972 this.ajaxReturnType = UifConstants.AjaxReturnTypes.UPDATEPAGE.getKey();
973 }
974 }
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995 @BeanTagAttribute(name = "successCallback")
996 public String getSuccessCallback() {
997 return successCallback;
998 }
999
1000
1001
1002
1003
1004
1005 public void setSuccessCallback(String successCallback) {
1006 this.successCallback = successCallback;
1007 }
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029 @BeanTagAttribute(name = "errorCallback")
1030 public String getErrorCallback() {
1031 return errorCallback;
1032 }
1033
1034
1035
1036
1037
1038
1039 public void setErrorCallback(String errorCallback) {
1040 this.errorCallback = errorCallback;
1041 }
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053 @BeanTagAttribute(name = "refreshId")
1054 public String getRefreshId() {
1055 return refreshId;
1056 }
1057
1058
1059
1060
1061
1062
1063 public void setRefreshId(String refreshId) {
1064 this.refreshId = refreshId;
1065 }
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083 @BeanTagAttribute(name = "refreshPropertyName")
1084 public String getRefreshPropertyName() {
1085 return refreshPropertyName;
1086 }
1087
1088
1089
1090
1091
1092
1093 public void setRefreshPropertyName(String refreshPropertyName) {
1094 this.refreshPropertyName = refreshPropertyName;
1095 }
1096
1097
1098
1099
1100
1101
1102 @BeanTagAttribute(name = "loadingMessageText")
1103 public String getLoadingMessageText() {
1104 return loadingMessageText;
1105 }
1106
1107
1108
1109
1110
1111
1112 public void setLoadingMessageText(String loadingMessageText) {
1113 this.loadingMessageText = loadingMessageText;
1114 }
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131 @BeanTagAttribute(name = "disableBlocking")
1132 public boolean isDisableBlocking() {
1133 return disableBlocking;
1134 }
1135
1136
1137
1138
1139
1140
1141 public void setDisableBlocking(boolean disableBlocking) {
1142 this.disableBlocking = disableBlocking;
1143 }
1144
1145
1146
1147
1148 @Override
1149 public void completeValidation(ValidationTrace tracer) {
1150 tracer.addBean(this);
1151
1152
1153 if (getActionLabel() == null && getActionImage() == null) {
1154 String currentValues[] = {"actionLabel =" + getActionLabel(), "actionImage =" + getActionImage()};
1155 tracer.createError("ActionLabel and/or actionImage must be set", currentValues);
1156 }
1157
1158
1159 if (getJumpToIdAfterSubmit() != null && getJumpToNameAfterSubmit() != null) {
1160 String currentValues[] = {"jumpToIdAfterSubmit =" + getJumpToIdAfterSubmit(),
1161 "jumpToNameAfterSubmit =" + getJumpToNameAfterSubmit()};
1162 tracer.createWarning("Only 1 jumpTo property should be set", currentValues);
1163 }
1164 super.completeValidation(tracer.getCopy());
1165 }
1166
1167
1168
1169
1170
1171
1172 @BeanTagAttribute(name = "evaluateDisabledOnKeyUp")
1173 public boolean isEvaluateDisabledOnKeyUp() {
1174 return evaluateDisabledOnKeyUp;
1175 }
1176
1177
1178
1179
1180
1181
1182 public void setEvaluateDisabledOnKeyUp(boolean evaluateDisabledOnKeyUp) {
1183 this.evaluateDisabledOnKeyUp = evaluateDisabledOnKeyUp;
1184 }
1185
1186
1187
1188
1189
1190
1191 public String getDisabledConditionJs() {
1192 return disabledConditionJs;
1193 }
1194
1195
1196
1197
1198
1199
1200 protected void setDisabledConditionJs(String disabledConditionJs) {
1201 this.disabledConditionJs = disabledConditionJs;
1202 }
1203
1204
1205
1206
1207
1208
1209 public List<String> getDisabledConditionControlNames() {
1210 return disabledConditionControlNames;
1211 }
1212
1213
1214
1215
1216
1217
1218 public void setDisabledConditionControlNames(List<String> disabledConditionControlNames) {
1219 this.disabledConditionControlNames = disabledConditionControlNames;
1220 }
1221
1222
1223
1224
1225
1226
1227 @BeanTagAttribute(name = "disabledWhenChangedPropertyNames", type = BeanTagAttribute.AttributeType.LISTVALUE)
1228 public List<String> getDisabledWhenChangedPropertyNames() {
1229 return disabledWhenChangedPropertyNames;
1230 }
1231
1232
1233
1234
1235
1236
1237 public void setDisabledWhenChangedPropertyNames(List<String> disabledWhenChangedPropertyNames) {
1238 this.disabledWhenChangedPropertyNames = disabledWhenChangedPropertyNames;
1239 }
1240
1241
1242
1243
1244
1245
1246 @BeanTagAttribute(name = "enabledWhenChangedPropertyNames", type = BeanTagAttribute.AttributeType.LISTVALUE)
1247 public List<String> getEnabledWhenChangedPropertyNames() {
1248 return enabledWhenChangedPropertyNames;
1249 }
1250
1251
1252
1253
1254
1255
1256 public void setEnabledWhenChangedPropertyNames(List<String> enabledWhenChangedPropertyNames) {
1257 this.enabledWhenChangedPropertyNames = enabledWhenChangedPropertyNames;
1258 }
1259
1260
1261
1262
1263
1264
1265 protected void setDisabledExpression(String disabledExpression) {
1266 this.disabledExpression = disabledExpression;
1267 }
1268
1269
1270
1271
1272 @Override
1273 protected <T> void copyProperties(T component) {
1274 super.copyProperties(component);
1275 Action actionCopy = (Action) component;
1276 actionCopy.setActionEvent(this.actionEvent);
1277
1278 if (this.actionImage != null) {
1279 actionCopy.setActionImage((Image) this.actionImage.copy());
1280 }
1281
1282 actionCopy.setActionImagePlacement(this.actionImagePlacement);
1283 actionCopy.setActionLabel(this.actionLabel);
1284
1285 if (this.actionParameters != null) {
1286 actionCopy.setActionParameters(new HashMap<String, String>(this.actionParameters));
1287 }
1288
1289 if (this.additionalSubmitData != null) {
1290 actionCopy.setAdditionalSubmitData(new HashMap<String, String>(this.additionalSubmitData));
1291 }
1292
1293 actionCopy.setActionScript(this.actionScript);
1294 actionCopy.setAjaxReturnType(this.ajaxReturnType);
1295 actionCopy.setAjaxSubmit(this.ajaxSubmit);
1296 actionCopy.setClearDirtyOnAction(this.clearDirtyOnAction);
1297 actionCopy.setDirtyOnAction(this.dirtyOnAction);
1298 actionCopy.setDisableBlocking(this.disableBlocking);
1299 actionCopy.setDisabled(this.disabled);
1300 actionCopy.setDisabledConditionJs(this.disabledConditionJs);
1301
1302 if (this.disabledConditionControlNames != null) {
1303 actionCopy.setDisabledConditionControlNames(new ArrayList<String>(this.disabledConditionControlNames));
1304 }
1305
1306 actionCopy.setDisabledExpression(this.disabledExpression);
1307 actionCopy.setDisabledReason(this.disabledReason);
1308
1309 if (this.disabledWhenChangedPropertyNames != null) {
1310 actionCopy.setDisabledWhenChangedPropertyNames(new ArrayList<String>(
1311 this.disabledWhenChangedPropertyNames));
1312 }
1313
1314 if (this.enabledWhenChangedPropertyNames != null) {
1315 actionCopy.setEnabledWhenChangedPropertyNames(new ArrayList<String>(this.enabledWhenChangedPropertyNames));
1316 }
1317
1318 actionCopy.setErrorCallback(this.errorCallback);
1319 actionCopy.setEvaluateDisabledOnKeyUp(this.evaluateDisabledOnKeyUp);
1320 actionCopy.setFocusOnIdAfterSubmit(this.focusOnIdAfterSubmit);
1321 actionCopy.setJumpToIdAfterSubmit(this.jumpToIdAfterSubmit);
1322 actionCopy.setJumpToNameAfterSubmit(this.jumpToNameAfterSubmit);
1323 actionCopy.setLoadingMessageText(this.loadingMessageText);
1324 actionCopy.setMethodToCall(this.methodToCall);
1325 actionCopy.setNavigateToPageId(this.navigateToPageId);
1326 actionCopy.setPerformClientSideValidation(this.performClientSideValidation);
1327 actionCopy.setPerformDirtyValidation(this.performDirtyValidation);
1328 actionCopy.setPreSubmitCall(this.preSubmitCall);
1329 actionCopy.setRefreshId(this.refreshId);
1330 actionCopy.setRefreshPropertyName(this.refreshPropertyName);
1331 actionCopy.setSuccessCallback(this.successCallback);
1332 }
1333 }