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.service.KRADServiceLocatorWeb;
25 import org.kuali.rice.krad.uif.UifConstants;
26 import org.kuali.rice.krad.uif.UifParameters;
27 import org.kuali.rice.krad.uif.UifPropertyPaths;
28 import org.kuali.rice.krad.uif.component.Component;
29 import org.kuali.rice.krad.uif.component.ComponentSecurity;
30 import org.kuali.rice.krad.uif.container.DialogGroup;
31 import org.kuali.rice.krad.uif.container.Group;
32 import org.kuali.rice.krad.uif.field.DataField;
33 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
34 import org.kuali.rice.krad.uif.util.ComponentFactory;
35 import org.kuali.rice.krad.uif.util.LifecycleElement;
36 import org.kuali.rice.krad.uif.util.ScriptUtils;
37 import org.kuali.rice.krad.uif.util.UrlInfo;
38 import org.kuali.rice.krad.uif.view.ExpressionEvaluator;
39 import org.kuali.rice.krad.uif.view.FormView;
40 import org.kuali.rice.krad.uif.view.View;
41 import org.kuali.rice.krad.util.KRADUtils;
42
43 import java.util.ArrayList;
44 import java.util.HashMap;
45 import java.util.List;
46 import java.util.Map;
47
48
49
50
51
52
53 @BeanTags({@BeanTag(name = "action", parent = "Uif-Action"),
54 @BeanTag(name = "actionImage", parent = "Uif-ActionImage"),
55 @BeanTag(name = "button", parent = "Uif-PrimaryActionButton"),
56 @BeanTag(name = "secondaryButton", parent = "Uif-SecondaryActionButton"),
57 @BeanTag(name = "buttonLarge", parent = "Uif-PrimaryActionButton-Large"),
58 @BeanTag(name = "secondaryButtonLarge", parent = "Uif-SecondaryActionButton-Large"),
59 @BeanTag(name = "buttonSmall", parent = "Uif-PrimaryActionButton-Small"),
60 @BeanTag(name = "secondaryButtonSmall", parent = "Uif-SecondaryActionButton-Small"),
61 @BeanTag(name = "buttonMini", parent = "Uif-PrimaryActionButton-Mini"),
62 @BeanTag(name = "secondaryButtonMini", parent = "Uif-SecondaryActionButton-Mini"),
63 @BeanTag(name = "actionLink", parent = "Uif-ActionLink"),
64 @BeanTag(name = "navigationActionLink", parent = "Uif-NavigationActionLink"),
65 @BeanTag(name = "navigationButton", parent = "Uif-NavigationActionButton"),
66 @BeanTag(name = "secondaryNavigationActionButton", parent = "Uif-SecondaryNavigationActionButton")})
67 public class Action extends ContentElementBase {
68 private static final long serialVersionUID = 1025672792657238829L;
69
70 private String methodToCall;
71 private String actionEvent;
72 private String navigateToPageId;
73 private List<String> fieldsToSend;
74
75 private String actionScript;
76 private UrlInfo actionUrl;
77
78 private String actionLabel;
79 private boolean renderInnerTextSpan;
80
81 private Image actionImage;
82 private String actionImagePlacement;
83
84 private String iconClass;
85 private String actionIconPlacement;
86
87 private String jumpToIdAfterSubmit;
88 private String jumpToNameAfterSubmit;
89 private String focusOnIdAfterSubmit;
90
91 private boolean performClientSideValidation;
92 private boolean performDirtyValidation;
93 private boolean clearDirtyOnAction;
94 private boolean dirtyOnAction;
95
96 private String preSubmitCall;
97 private String confirmationPromptText;
98 private DialogGroup confirmationDialog;
99
100 private String dialogDismissOption;
101 private String dialogResponse;
102
103 private boolean ajaxSubmit;
104 private String ajaxReturnType;
105 private String refreshId;
106 private String refreshPropertyName;
107
108 private String successCallback;
109 private String errorCallback;
110
111 private String loadingMessageText;
112 private boolean disableBlocking;
113
114 private Map<String, String> additionalSubmitData;
115 private Map<String, String> actionParameters;
116
117 private boolean evaluateDisabledOnKeyUp;
118
119 private boolean defaultEnterKeyAction;
120
121 private boolean disabled;
122 private String disabledReason;
123 private String disabledExpression;
124 private String disabledConditionJs;
125 private List<String> disabledConditionControlNames;
126
127 private List<String> disabledWhenChangedPropertyNames;
128 private List<String> enabledWhenChangedPropertyNames;
129
130
131
132
133 public Action() {
134 super();
135
136 actionImagePlacement = UifConstants.Position.LEFT.name();
137 actionIconPlacement = UifConstants.Position.LEFT.name();
138
139 ajaxSubmit = true;
140
141 successCallback = "";
142 errorCallback = "";
143 preSubmitCall = "";
144
145 additionalSubmitData = new HashMap<String, String>();
146 actionParameters = new HashMap<String, String>();
147
148 disabled = false;
149 disabledWhenChangedPropertyNames = new ArrayList<String>();
150 enabledWhenChangedPropertyNames = new ArrayList<String>();
151 }
152
153
154
155
156
157
158
159 public void performApplyModel(Object model, LifecycleElement parent) {
160 super.performApplyModel(model, parent);
161
162 disabledExpression = this.getPropertyExpression("disabled");
163 if (disabledExpression != null) {
164 ExpressionEvaluator expressionEvaluator = ViewLifecycle.getExpressionEvaluator();
165
166 disabledExpression = expressionEvaluator.replaceBindingPrefixes(ViewLifecycle.getView(), this,
167 disabledExpression);
168 disabled = (Boolean) expressionEvaluator.evaluateExpression(this.getContext(), disabledExpression);
169 }
170
171 if (actionUrl != null) {
172 ViewLifecycle.getExpressionEvaluator().populatePropertyExpressionsFromGraph(actionUrl, false);
173 ViewLifecycle.getExpressionEvaluator().evaluateExpressionsOnConfigurable(ViewLifecycle.getView(),
174 actionUrl, this.getContext());
175 }
176
177 if (StringUtils.isNotBlank(confirmationPromptText) && (confirmationDialog != null) && StringUtils.isBlank(
178 confirmationDialog.getPromptText())) {
179 confirmationDialog.setPromptText(confirmationPromptText);
180 }
181
182 addConfirmDialogToView();
183 }
184
185
186
187
188
189 protected void addConfirmDialogToView() {
190 if (StringUtils.isBlank(confirmationPromptText) || (confirmationDialog != null)) {
191 return;
192 }
193
194 boolean containsYesNoDialog = false;
195
196 List<Group> viewDialogs = ViewLifecycle.getView().getDialogs();
197 if (viewDialogs == null) {
198 viewDialogs = new ArrayList<Group>();
199 } else {
200 for (Group dialogGroup : viewDialogs) {
201 if (StringUtils.equals(ComponentFactory.YES_NO_DIALOG, dialogGroup.getId())) {
202 containsYesNoDialog = true;
203 }
204 }
205 }
206
207 if (!containsYesNoDialog) {
208 Group confirmDialog = ComponentFactory.getYesNoDialog();
209 confirmDialog.setId(ComponentFactory.YES_NO_DIALOG);
210
211 viewDialogs.add(confirmDialog);
212 }
213 }
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229 @Override
230 public void performFinalize(Object model, LifecycleElement parent) {
231 super.performFinalize(model, parent);
232
233 View view = ViewLifecycle.getView();
234 ExpressionEvaluator expressionEvaluator = ViewLifecycle.getExpressionEvaluator();
235
236 if (StringUtils.isNotEmpty(disabledExpression)
237 && !disabledExpression.equalsIgnoreCase("true")
238 && !disabledExpression.equalsIgnoreCase("false")) {
239 disabledConditionControlNames = new ArrayList<String>();
240 disabledConditionJs = ViewLifecycle.getExpressionEvaluator().parseExpression(disabledExpression,
241 disabledConditionControlNames, this.getContext());
242 }
243
244 List<String> adjustedDisablePropertyNames = new ArrayList<String>();
245 for (String propertyName : disabledWhenChangedPropertyNames) {
246 adjustedDisablePropertyNames.add(expressionEvaluator.replaceBindingPrefixes(view, this, propertyName));
247 }
248 disabledWhenChangedPropertyNames = adjustedDisablePropertyNames;
249
250 List<String> adjustedEnablePropertyNames = new ArrayList<String>();
251 for (String propertyName : enabledWhenChangedPropertyNames) {
252 adjustedEnablePropertyNames.add(expressionEvaluator.replaceBindingPrefixes(view, this, propertyName));
253 }
254 enabledWhenChangedPropertyNames = adjustedEnablePropertyNames;
255
256
257 if (actionImage != null && StringUtils.isNotBlank(actionImagePlacement) && StringUtils.isNotBlank(actionLabel)) {
258 actionImage.setAltText("");
259 }
260
261
262 if (StringUtils.isNotBlank(iconClass) && (UifConstants.ICON_ONLY_PLACEMENT.equals(actionIconPlacement)
263 || StringUtils.isBlank(actionLabel))) {
264 getCssClasses().add(iconClass);
265
266
267 actionIconPlacement = UifConstants.ICON_ONLY_PLACEMENT;
268 }
269
270 if (!actionParameters.containsKey(UifConstants.UrlParams.ACTION_EVENT) && StringUtils.isNotBlank(actionEvent)) {
271 actionParameters.put(UifConstants.UrlParams.ACTION_EVENT, actionEvent);
272 }
273
274 if (StringUtils.isNotBlank(navigateToPageId)) {
275 actionParameters.put(UifParameters.NAVIGATE_TO_PAGE_ID, navigateToPageId);
276 if (StringUtils.isBlank(methodToCall)) {
277 this.methodToCall = UifConstants.MethodToCallNames.NAVIGATE;
278 }
279 }
280
281 if (!actionParameters.containsKey(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME) && StringUtils
282 .isNotBlank(methodToCall)) {
283 actionParameters.put(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME, methodToCall);
284 }
285
286 setupRefreshAction(view);
287
288
289 if (view instanceof FormView) {
290 performDirtyValidation = performDirtyValidation && ((FormView) view).isApplyDirtyCheck();
291 }
292
293 if (StringUtils.isBlank(getActionScript()) && (actionUrl != null) && actionUrl.isFullyConfigured()) {
294 String actionScript = ScriptUtils.buildFunctionCall(UifConstants.JsFunctions.REDIRECT, actionUrl.getHref());
295 setActionScript(actionScript);
296
297 if (StringUtils.isNotBlank(actionUrl.getMethodToCall())) {
298 ViewLifecycle.getViewPostMetadata().addAvailableMethodToCall(actionUrl.getMethodToCall());
299 }
300 }
301
302
303 if (StringUtils.isBlank(getActionScript()) && StringUtils.isNotBlank(methodToCall)) {
304 ViewLifecycle.getViewPostMetadata().addAvailableMethodToCall(methodToCall);
305 }
306
307
308 if (isRender()) {
309 for (String additionalSubmitPath : additionalSubmitData.keySet()) {
310 ViewLifecycle.getViewPostMetadata().addAccessibleBindingPath(additionalSubmitPath);
311 }
312
313 if ((actionUrl != null) && actionUrl.isFullyConfigured() && StringUtils.isNotBlank(
314 actionUrl.getMethodToCall())) {
315 ViewLifecycle.getViewPostMetadata().addAccessibleMethodToCall(actionUrl.getMethodToCall());
316 } else if (StringUtils.isBlank(getActionScript()) && StringUtils.isNotBlank(methodToCall)) {
317 ViewLifecycle.getViewPostMetadata().addAccessibleMethodToCall(methodToCall);
318 }
319 }
320
321 buildActionData(view, model, parent);
322 }
323
324
325
326
327
328
329
330 protected void setupRefreshAction(View view) {
331
332
333 if (StringUtils.isNotBlank(refreshPropertyName) || StringUtils.isNotBlank(refreshId)) {
334 ajaxReturnType = UifConstants.AjaxReturnTypes.UPDATECOMPONENT.getKey();
335 }
336
337
338
339 Component refreshComponent = null;
340 if (StringUtils.isNotBlank(refreshPropertyName)) {
341
342 if (refreshPropertyName.startsWith(UifConstants.NO_BIND_ADJUST_PREFIX)) {
343 refreshPropertyName = StringUtils.removeStart(refreshPropertyName, UifConstants.NO_BIND_ADJUST_PREFIX);
344 } else if (StringUtils.isNotBlank(view.getDefaultBindingObjectPath())) {
345 refreshPropertyName = view.getDefaultBindingObjectPath() + "." + refreshPropertyName;
346 }
347
348 DataField dataField = view.getViewIndex().getDataFieldByPath(refreshPropertyName);
349 if (dataField != null) {
350 refreshComponent = dataField;
351 refreshId = refreshComponent.getId();
352 }
353 } else if (StringUtils.isNotBlank(refreshId)) {
354 Component component = view.getViewIndex().getComponentById(refreshId);
355 if (component != null) {
356 refreshComponent = component;
357 }
358 }
359
360 if (refreshComponent != null) {
361 refreshComponent.setRefreshedByAction(true);
362 }
363 }
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378 protected void buildActionData(View view, Object model, LifecycleElement parent) {
379 HashMap<String, String> actionDataAttributes = new HashMap<String, String>();
380
381 Map<String, String> dataDefaults =
382 (Map<String, String>) (KRADServiceLocatorWeb.getDataDictionaryService().getDictionaryBean(
383 UifConstants.ACTION_DEFAULTS_MAP_ID));
384
385
386 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.AJAX_SUBMIT,
387 Boolean.toString(ajaxSubmit));
388 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
389 UifConstants.ActionDataAttributes.SUCCESS_CALLBACK, this.successCallback);
390 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.ERROR_CALLBACK,
391 this.errorCallback);
392 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
393 UifConstants.ActionDataAttributes.PRE_SUBMIT_CALL, this.preSubmitCall);
394 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
395 UifConstants.ActionDataAttributes.LOADING_MESSAGE, this.loadingMessageText);
396 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
397 UifConstants.ActionDataAttributes.DISABLE_BLOCKING, Boolean.toString(this.disableBlocking));
398 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
399 UifConstants.ActionDataAttributes.AJAX_RETURN_TYPE, this.ajaxReturnType);
400 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.REFRESH_ID,
401 this.refreshId);
402 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.VALIDATE,
403 Boolean.toString(this.performClientSideValidation));
404 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
405 UifConstants.ActionDataAttributes.DIRTY_ON_ACTION, Boolean.toString(this.dirtyOnAction));
406 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.CLEAR_DIRTY,
407 Boolean.toString(this.clearDirtyOnAction));
408 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
409 UifConstants.ActionDataAttributes.PERFORM_DIRTY_VALIDATION, Boolean.toString(
410 this.performDirtyValidation));
411 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.FIELDS_TO_SEND,
412 ScriptUtils.translateValue(this.fieldsToSend));
413
414 if (confirmationDialog != null) {
415 addDataAttribute(UifConstants.ActionDataAttributes.CONFIRM_DIALOG_ID, confirmationDialog.getId());
416 } else if (StringUtils.isNotBlank(confirmationPromptText)) {
417 addDataAttribute(UifConstants.ActionDataAttributes.CONFIRM_PROMPT_TEXT, confirmationPromptText);
418 }
419
420 if (StringUtils.isNotBlank(dialogDismissOption)) {
421 addDataAttribute(UifConstants.DataAttributes.DISMISS_DIALOG_OPTION, dialogDismissOption);
422 }
423
424 if (StringUtils.isNotBlank(dialogResponse)) {
425 addDataAttribute(UifConstants.DataAttributes.DISMISS_RESPONSE, dialogResponse);
426 }
427
428
429 Map<String, String> submitData = new HashMap<String, String>();
430 for (String key : actionParameters.keySet()) {
431 String parameterPath = key;
432 if (!key.equals(UifConstants.CONTROLLER_METHOD_DISPATCH_PARAMETER_NAME)) {
433 parameterPath = UifPropertyPaths.ACTION_PARAMETERS + "[" + key + "]";
434 }
435 submitData.put(parameterPath, actionParameters.get(key));
436 }
437
438 for (String key : additionalSubmitData.keySet()) {
439 submitData.put(key, additionalSubmitData.get(key));
440 }
441
442
443 if (focusOnIdAfterSubmit.equalsIgnoreCase(UifConstants.Order.NEXT_INPUT.toString())) {
444 focusOnIdAfterSubmit = UifConstants.Order.NEXT_INPUT.toString() + ":" + this.getId();
445 }
446
447 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.FOCUS_ID,
448 focusOnIdAfterSubmit);
449
450 if (StringUtils.isNotBlank(jumpToIdAfterSubmit)) {
451 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.ActionDataAttributes.JUMP_TO_ID,
452 jumpToIdAfterSubmit);
453 } else if (StringUtils.isNotBlank(jumpToNameAfterSubmit)) {
454 addActionDataSettingsValue(actionDataAttributes, dataDefaults,
455 UifConstants.ActionDataAttributes.JUMP_TO_NAME, jumpToNameAfterSubmit);
456 }
457
458 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.DataAttributes.SUBMIT_DATA,
459 ScriptUtils.toJSON(submitData));
460
461
462 String onClickScript = this.getOnClickScript();
463 if (StringUtils.isNotBlank(actionScript)) {
464 onClickScript = ScriptUtils.appendScript(onClickScript, actionScript);
465 } else {
466 onClickScript = ScriptUtils.appendScript(onClickScript, "actionInvokeHandler(this);");
467 }
468
469
470 if (disabled) {
471 this.addStyleClass("disabled");
472 this.setSkipInTabOrder(true);
473 }
474
475
476 addActionDataSettingsValue(actionDataAttributes, dataDefaults, UifConstants.DataAttributes.ONCLICK,
477 KRADUtils.convertToHTMLAttributeSafeString(onClickScript));
478
479 if (!actionDataAttributes.isEmpty()) {
480 this.getDataAttributes().putAll(actionDataAttributes);
481 }
482
483 this.addDataAttribute(UifConstants.DataAttributes.ROLE, UifConstants.RoleTypes.ACTION);
484
485
486 if (this.isDefaultEnterKeyAction()) {
487 this.addDataAttribute(UifConstants.DataAttributes.DEFAULT_ENTER_KEY_ACTION,
488 Boolean.toString(this.isDefaultEnterKeyAction()));
489 }
490 }
491
492
493
494
495
496
497
498
499
500
501
502 protected void addActionDataSettingsValue(Map<String, String> valueMap, Map<String, String> defaults, String key,
503 String value) {
504 if (StringUtils.isBlank(value)) {
505 return;
506 }
507
508 String defaultValue = defaults.get(key);
509 if (defaultValue == null || !value.equals(defaultValue)) {
510 valueMap.put(key, value);
511 }
512 }
513
514
515
516
517
518
519
520
521
522
523
524
525
526 @BeanTagAttribute
527 public String getMethodToCall() {
528 return this.methodToCall;
529 }
530
531
532
533
534
535
536 public void setMethodToCall(String methodToCall) {
537 this.methodToCall = methodToCall;
538 }
539
540
541
542
543
544
545
546
547
548
549
550
551 @BeanTagAttribute
552 public String getActionLabel() {
553 return this.actionLabel;
554 }
555
556
557
558
559
560
561 public void setActionLabel(String actionLabel) {
562 this.actionLabel = actionLabel;
563 }
564
565
566
567
568
569
570 @BeanTagAttribute
571 public boolean isRenderInnerTextSpan() {
572 return renderInnerTextSpan;
573 }
574
575
576
577
578
579
580 public void setRenderInnerTextSpan(boolean renderInnerTextSpan) {
581 this.renderInnerTextSpan = renderInnerTextSpan;
582 }
583
584
585
586
587
588
589
590
591
592
593
594
595
596 @BeanTagAttribute
597 public Image getActionImage() {
598 return this.actionImage;
599 }
600
601
602
603
604
605
606 public void setActionImage(Image actionImage) {
607 this.actionImage = actionImage;
608 }
609
610
611
612
613
614
615 @BeanTagAttribute
616 public String getIconClass() {
617 return iconClass;
618 }
619
620
621
622
623
624
625 public void setIconClass(String iconClass) {
626 this.iconClass = iconClass;
627 }
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643 @BeanTagAttribute
644 public String getNavigateToPageId() {
645 return this.navigateToPageId;
646 }
647
648
649
650
651
652
653 public void setNavigateToPageId(String navigateToPageId) {
654 this.navigateToPageId = navigateToPageId;
655 }
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670 @BeanTagAttribute
671 public List<String> getFieldsToSend() {
672 return fieldsToSend;
673 }
674
675
676
677
678 public void setFieldsToSend(List<String> fieldsToSend) {
679 this.fieldsToSend = fieldsToSend;
680 }
681
682
683
684
685
686
687
688
689
690
691
692
693 @BeanTagAttribute
694 public String getActionEvent() {
695 return actionEvent;
696 }
697
698
699
700
701
702
703 public void setActionEvent(String actionEvent) {
704 this.actionEvent = actionEvent;
705 }
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726 @BeanTagAttribute
727 public Map<String, String> getAdditionalSubmitData() {
728 return additionalSubmitData;
729 }
730
731
732
733
734
735
736 public void setAdditionalSubmitData(Map<String, String> additionalSubmitData) {
737 this.additionalSubmitData = additionalSubmitData;
738 }
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756 @BeanTagAttribute
757 public Map<String, String> getActionParameters() {
758 return this.actionParameters;
759 }
760
761
762
763
764
765
766 public void setActionParameters(Map<String, String> actionParameters) {
767 this.actionParameters = actionParameters;
768 }
769
770
771
772
773
774
775
776 public void addActionParameter(String parameterName, String parameterValue) {
777 if (actionParameters == null) {
778 this.actionParameters = new HashMap<String, String>();
779 }
780
781 this.actionParameters.put(parameterName, parameterValue);
782 }
783
784
785
786
787
788
789
790 public String getActionParameter(String parameterName) {
791 return this.actionParameters.get(parameterName);
792 }
793
794
795
796
797
798
799 public ActionSecurity getActionSecurity() {
800 return (ActionSecurity) super.getComponentSecurity();
801 }
802
803
804
805
806
807
808 @Override
809 public void setComponentSecurity(ComponentSecurity componentSecurity) {
810 if ((componentSecurity != null) && !(componentSecurity instanceof ActionSecurity)) {
811 throw new RiceRuntimeException("Component security for Action should be instance of ActionSecurity");
812 }
813
814 super.setComponentSecurity(componentSecurity);
815 }
816
817
818
819
820 @Override
821 protected void initializeComponentSecurity() {
822 if (getComponentSecurity() == null) {
823 setComponentSecurity(KRADUtils.createNewObjectFromClass(ActionSecurity.class));
824 }
825 }
826
827
828
829
830
831
832 @BeanTagAttribute
833 public boolean isPerformActionAuthz() {
834 initializeComponentSecurity();
835
836 return getActionSecurity().isPerformActionAuthz();
837 }
838
839
840
841
842
843
844 public void setPerformActionAuthz(boolean performActionAuthz) {
845 initializeComponentSecurity();
846
847 getActionSecurity().setPerformActionAuthz(performActionAuthz);
848 }
849
850
851
852
853
854
855 @BeanTagAttribute
856 public boolean isPerformLineActionAuthz() {
857 initializeComponentSecurity();
858
859 return getActionSecurity().isPerformLineActionAuthz();
860 }
861
862
863
864
865
866
867 public void setPerformLineActionAuthz(boolean performLineActionAuthz) {
868 initializeComponentSecurity();
869
870 getActionSecurity().setPerformLineActionAuthz(performLineActionAuthz);
871 }
872
873
874
875
876
877
878 @BeanTagAttribute
879 public String getJumpToIdAfterSubmit() {
880 return this.jumpToIdAfterSubmit;
881 }
882
883
884
885
886
887
888
889
890
891
892
893
894 public void setJumpToIdAfterSubmit(String jumpToIdAfterSubmit) {
895 this.jumpToIdAfterSubmit = jumpToIdAfterSubmit;
896 }
897
898
899
900
901
902
903
904
905
906
907
908 @BeanTagAttribute
909 public String getJumpToNameAfterSubmit() {
910 return this.jumpToNameAfterSubmit;
911 }
912
913
914
915
916
917
918 public void setJumpToNameAfterSubmit(String jumpToNameAfterSubmit) {
919 this.jumpToNameAfterSubmit = jumpToNameAfterSubmit;
920 }
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939 @BeanTagAttribute
940 public String getFocusOnIdAfterSubmit() {
941 return this.focusOnIdAfterSubmit;
942 }
943
944
945
946
947
948
949 public void setFocusOnIdAfterSubmit(String focusOnIdAfterSubmit) {
950 this.focusOnIdAfterSubmit = focusOnIdAfterSubmit;
951 }
952
953
954
955
956
957
958 @BeanTagAttribute
959 public boolean isPerformClientSideValidation() {
960 return this.performClientSideValidation;
961 }
962
963
964
965
966
967
968 public void setPerformClientSideValidation(boolean performClientSideValidation) {
969 this.performClientSideValidation = performClientSideValidation;
970 }
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986 @BeanTagAttribute
987 public String getActionScript() {
988 return this.actionScript;
989 }
990
991
992
993
994
995
996 public void setActionScript(String actionScript) {
997 if (StringUtils.isNotBlank(actionScript) && !StringUtils.endsWith(actionScript, ";")) {
998 actionScript = actionScript + ";";
999 }
1000
1001 this.actionScript = actionScript;
1002 }
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014 @BeanTagAttribute
1015 public UrlInfo getActionUrl() {
1016 return actionUrl;
1017 }
1018
1019
1020
1021
1022
1023
1024 public void setActionUrl(UrlInfo actionUrl) {
1025 this.actionUrl = actionUrl;
1026 }
1027
1028
1029
1030
1031
1032
1033 public void setPerformDirtyValidation(boolean performDirtyValidation) {
1034 this.performDirtyValidation = performDirtyValidation;
1035 }
1036
1037
1038
1039
1040
1041
1042 @BeanTagAttribute
1043 public boolean isPerformDirtyValidation() {
1044 return performDirtyValidation;
1045 }
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055 @BeanTagAttribute
1056 public boolean isClearDirtyOnAction() {
1057 return clearDirtyOnAction;
1058 }
1059
1060
1061
1062
1063
1064
1065 public void setClearDirtyOnAction(boolean clearDirtyOnAction) {
1066 this.clearDirtyOnAction = clearDirtyOnAction;
1067 }
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078 @BeanTagAttribute
1079 public boolean isDirtyOnAction() {
1080 return dirtyOnAction;
1081 }
1082
1083
1084
1085
1086
1087
1088 public void setDirtyOnAction(boolean dirtyOnAction) {
1089 this.dirtyOnAction = dirtyOnAction;
1090 }
1091
1092
1093
1094
1095
1096
1097 @BeanTagAttribute
1098 public boolean isDisabled() {
1099 return disabled;
1100 }
1101
1102
1103
1104
1105
1106
1107 public void setDisabled(boolean disabled) {
1108 this.disabled = disabled;
1109 }
1110
1111
1112
1113
1114
1115
1116
1117
1118 @BeanTagAttribute
1119 public String getDisabledReason() {
1120 return disabledReason;
1121 }
1122
1123
1124
1125
1126
1127
1128 public void setDisabledReason(String disabledReason) {
1129 this.disabledReason = disabledReason;
1130 }
1131
1132
1133
1134
1135
1136
1137 @BeanTagAttribute
1138 public String getActionImagePlacement() {
1139 return actionImagePlacement;
1140 }
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150 public void setActionImagePlacement(String actionImagePlacement) {
1151 this.actionImagePlacement = actionImagePlacement;
1152 }
1153
1154
1155
1156
1157
1158
1159 @BeanTagAttribute
1160 public String getActionIconPlacement() {
1161 return actionIconPlacement;
1162 }
1163
1164
1165
1166
1167
1168
1169 public void setActionIconPlacement(String actionIconPlacement) {
1170 this.actionIconPlacement = actionIconPlacement;
1171 }
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194 @BeanTagAttribute
1195 public String getPreSubmitCall() {
1196 return preSubmitCall;
1197 }
1198
1199
1200
1201
1202
1203
1204 public void setPreSubmitCall(String preSubmitCall) {
1205 this.preSubmitCall = preSubmitCall;
1206 }
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217 public String getConfirmationPromptText() {
1218 return confirmationPromptText;
1219 }
1220
1221
1222
1223
1224 public void setConfirmationPromptText(String confirmationPromptText) {
1225 this.confirmationPromptText = confirmationPromptText;
1226 }
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236 public DialogGroup getConfirmationDialog() {
1237 return confirmationDialog;
1238 }
1239
1240
1241
1242
1243 public void setConfirmationDialog(DialogGroup confirmationDialog) {
1244 this.confirmationDialog = confirmationDialog;
1245 }
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263 public String getDialogDismissOption() {
1264 return dialogDismissOption;
1265 }
1266
1267
1268
1269
1270 public void setDialogDismissOption(String dialogDismissOption) {
1271 this.dialogDismissOption = dialogDismissOption;
1272 }
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286 public String getDialogResponse() {
1287 return dialogResponse;
1288 }
1289
1290
1291
1292
1293 public void setDialogResponse(String dialogResponse) {
1294 this.dialogResponse = dialogResponse;
1295 }
1296
1297
1298
1299
1300
1301
1302
1303 @BeanTagAttribute
1304 public boolean isAjaxSubmit() {
1305 return ajaxSubmit;
1306 }
1307
1308
1309
1310
1311
1312
1313 public void setAjaxSubmit(boolean ajaxSubmit) {
1314 this.ajaxSubmit = ajaxSubmit;
1315 }
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328 @BeanTagAttribute
1329 public String getAjaxReturnType() {
1330 return this.ajaxReturnType;
1331 }
1332
1333
1334
1335
1336
1337
1338 public void setAjaxReturnType(String ajaxReturnType) {
1339 this.ajaxReturnType = ajaxReturnType;
1340 }
1341
1342
1343
1344
1345
1346
1347 @BeanTagAttribute
1348 public boolean isDisplayResponseInLightBox() {
1349 return StringUtils.equals(this.ajaxReturnType, UifConstants.AjaxReturnTypes.DISPLAYLIGHTBOX.getKey());
1350 }
1351
1352
1353
1354
1355
1356
1357 public void setDisplayResponseInLightBox(boolean displayResponseInLightBox) {
1358 if (displayResponseInLightBox) {
1359 this.ajaxReturnType = UifConstants.AjaxReturnTypes.DISPLAYLIGHTBOX.getKey();
1360 }
1361
1362 else if (StringUtils.equals(this.ajaxReturnType, UifConstants.AjaxReturnTypes.DISPLAYLIGHTBOX.getKey())) {
1363 this.ajaxReturnType = UifConstants.AjaxReturnTypes.UPDATEPAGE.getKey();
1364 }
1365 }
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386 @BeanTagAttribute
1387 public String getSuccessCallback() {
1388 return successCallback;
1389 }
1390
1391
1392
1393
1394
1395
1396 public void setSuccessCallback(String successCallback) {
1397 this.successCallback = successCallback;
1398 }
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420 @BeanTagAttribute
1421 public String getErrorCallback() {
1422 return errorCallback;
1423 }
1424
1425
1426
1427
1428
1429
1430 public void setErrorCallback(String errorCallback) {
1431 this.errorCallback = errorCallback;
1432 }
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444 @BeanTagAttribute
1445 public String getRefreshId() {
1446 return refreshId;
1447 }
1448
1449
1450
1451
1452
1453
1454 public void setRefreshId(String refreshId) {
1455 this.refreshId = refreshId;
1456 }
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474 @BeanTagAttribute
1475 public String getRefreshPropertyName() {
1476 return refreshPropertyName;
1477 }
1478
1479
1480
1481
1482
1483
1484 public void setRefreshPropertyName(String refreshPropertyName) {
1485 this.refreshPropertyName = refreshPropertyName;
1486 }
1487
1488
1489
1490
1491
1492
1493 @BeanTagAttribute
1494 public String getLoadingMessageText() {
1495 return loadingMessageText;
1496 }
1497
1498
1499
1500
1501
1502
1503 public void setLoadingMessageText(String loadingMessageText) {
1504 this.loadingMessageText = loadingMessageText;
1505 }
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522 @BeanTagAttribute
1523 public boolean isDisableBlocking() {
1524 return disableBlocking;
1525 }
1526
1527
1528
1529
1530
1531
1532 public void setDisableBlocking(boolean disableBlocking) {
1533 this.disableBlocking = disableBlocking;
1534 }
1535
1536
1537
1538
1539
1540
1541 @BeanTagAttribute
1542 public boolean isEvaluateDisabledOnKeyUp() {
1543 return evaluateDisabledOnKeyUp;
1544 }
1545
1546
1547
1548
1549
1550
1551 public void setEvaluateDisabledOnKeyUp(boolean evaluateDisabledOnKeyUp) {
1552 this.evaluateDisabledOnKeyUp = evaluateDisabledOnKeyUp;
1553 }
1554
1555
1556
1557
1558
1559
1560 @BeanTagAttribute(name = "defaultEnterKeyAction")
1561 public boolean isDefaultEnterKeyAction() {
1562 return this.defaultEnterKeyAction;
1563 }
1564
1565
1566
1567
1568 public void setDefaultEnterKeyAction(boolean defaultEnterKeyAction) {
1569 this.defaultEnterKeyAction = defaultEnterKeyAction;
1570 }
1571
1572
1573
1574
1575
1576
1577 public String getDisabledConditionJs() {
1578 return disabledConditionJs;
1579 }
1580
1581
1582
1583
1584
1585
1586 protected void setDisabledConditionJs(String disabledConditionJs) {
1587 this.disabledConditionJs = disabledConditionJs;
1588 }
1589
1590
1591
1592
1593
1594
1595 public List<String> getDisabledConditionControlNames() {
1596 return disabledConditionControlNames;
1597 }
1598
1599
1600
1601
1602
1603
1604 public void setDisabledConditionControlNames(List<String> disabledConditionControlNames) {
1605 this.disabledConditionControlNames = disabledConditionControlNames;
1606 }
1607
1608
1609
1610
1611
1612
1613 @BeanTagAttribute
1614 public List<String> getDisabledWhenChangedPropertyNames() {
1615 return disabledWhenChangedPropertyNames;
1616 }
1617
1618
1619
1620
1621
1622
1623 public void setDisabledWhenChangedPropertyNames(List<String> disabledWhenChangedPropertyNames) {
1624 this.disabledWhenChangedPropertyNames = disabledWhenChangedPropertyNames;
1625 }
1626
1627
1628
1629
1630
1631
1632 @BeanTagAttribute
1633 public List<String> getEnabledWhenChangedPropertyNames() {
1634 return enabledWhenChangedPropertyNames;
1635 }
1636
1637
1638
1639
1640
1641
1642 public void setEnabledWhenChangedPropertyNames(List<String> enabledWhenChangedPropertyNames) {
1643 this.enabledWhenChangedPropertyNames = enabledWhenChangedPropertyNames;
1644 }
1645
1646
1647
1648
1649
1650
1651 protected void setDisabledExpression(String disabledExpression) {
1652 this.disabledExpression = disabledExpression;
1653 }
1654
1655
1656
1657
1658 @Override
1659 public void completeValidation(ValidationTrace tracer) {
1660 tracer.addBean(this);
1661
1662
1663 if (getJumpToIdAfterSubmit() != null && getJumpToNameAfterSubmit() != null) {
1664 String currentValues[] = {"jumpToIdAfterSubmit =" + getJumpToIdAfterSubmit(),
1665 "jumpToNameAfterSubmit =" + getJumpToNameAfterSubmit()};
1666 tracer.createWarning("Only 1 jumpTo property should be set", currentValues);
1667 }
1668 super.completeValidation(tracer.getCopy());
1669 }
1670 }