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