1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.component;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
20 import org.kuali.rice.krad.uif.CssConstants;
21 import org.kuali.rice.krad.uif.control.ControlBase;
22 import org.kuali.rice.krad.uif.modifier.ComponentModifier;
23 import org.kuali.rice.krad.uif.service.ExpressionEvaluatorService;
24 import org.kuali.rice.krad.uif.util.ExpressionUtils;
25 import org.kuali.rice.krad.uif.util.ScriptUtils;
26 import org.kuali.rice.krad.uif.view.View;
27 import org.kuali.rice.krad.uif.widget.Tooltip;
28 import org.kuali.rice.krad.util.ObjectUtils;
29
30 import java.util.ArrayList;
31 import java.util.HashMap;
32 import java.util.List;
33 import java.util.Map;
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 public abstract class ComponentBase extends ConfigurableBase implements Component {
49 private static final long serialVersionUID = -4449335748129894350L;
50
51 private String id;
52 private String baseId;
53 private String template;
54 private String templateName;
55
56 private String title;
57
58 private boolean render;
59
60 @KeepExpression
61 private String progressiveRender;
62 private boolean progressiveRenderViaAJAX;
63 private boolean progressiveRenderAndRefresh;
64 private List<String> progressiveDisclosureControlNames;
65 private String progressiveDisclosureConditionJs;
66
67 @KeepExpression
68 private String conditionalRefresh;
69 private String conditionalRefreshConditionJs;
70 private List<String> conditionalRefreshControlNames;
71
72 private List<String> refreshWhenChangedPropertyNames;
73 private boolean refreshedByAction;
74
75 private boolean resetDataOnRefresh;
76 private String methodToCallOnRefresh;
77
78 private boolean hidden;
79 private boolean readOnly;
80 private Boolean required;
81
82 private String align;
83 private String valign;
84 private String width;
85
86 private int colSpan;
87 private int rowSpan;
88
89 private String style;
90 private List<String> cssClasses;
91
92 private Tooltip toolTip;
93
94 private int order;
95
96 private boolean skipInTabOrder;
97
98 private String finalizeMethodToCall;
99 private List<Object> finalizeMethodAdditionalArguments;
100 private MethodInvokerConfig finalizeMethodInvoker;
101
102 private boolean selfRendered;
103 private String renderedHtmlOutput;
104
105 private boolean disableSessionPersistence;
106 private boolean forceSessionPersistence;
107
108 private ComponentSecurity componentSecurity;
109
110 private String onLoadScript;
111 private String onUnloadScript;
112 private String onCloseScript;
113 private String onBlurScript;
114 private String onChangeScript;
115 private String onClickScript;
116 private String onDblClickScript;
117 private String onFocusScript;
118 private String onSubmitScript;
119 private String onKeyPressScript;
120 private String onKeyUpScript;
121 private String onKeyDownScript;
122 private String onMouseOverScript;
123 private String onMouseOutScript;
124 private String onMouseUpScript;
125 private String onMouseDownScript;
126 private String onMouseMoveScript;
127 private String onDocumentReadyScript;
128
129 private List<ComponentModifier> componentModifiers;
130
131 private Map<String, String> templateOptions;
132 private String templateOptionsJSString;
133
134 @ReferenceCopy(newCollectionInstance = true)
135 private transient Map<String, Object> context;
136
137 private List<PropertyReplacer> propertyReplacers;
138
139 private Map<String,String> dataAttributes;
140 private String dataRoleAttribute;
141 private String dataTypeAttribute;
142 private String dataMetaAttribute;
143
144 public ComponentBase() {
145 super();
146
147 order = 0;
148 colSpan = 1;
149 rowSpan = 1;
150
151 render = true;
152 selfRendered = false;
153 progressiveRenderViaAJAX = false;
154 progressiveRenderAndRefresh = false;
155 refreshedByAction = false;
156 resetDataOnRefresh = false;
157 disableSessionPersistence = false;
158 forceSessionPersistence = false;
159
160 componentSecurity = ObjectUtils.newInstance(getComponentSecurityClass());
161
162 refreshWhenChangedPropertyNames = new ArrayList<String>();
163 finalizeMethodAdditionalArguments = new ArrayList<Object>();
164 cssClasses = new ArrayList<String>();
165 componentModifiers = new ArrayList<ComponentModifier>();
166 templateOptions = new HashMap<String, String>();
167 context = new HashMap<String, Object>();
168 propertyReplacers = new ArrayList<PropertyReplacer>();
169 dataAttributes = new HashMap<String, String>();
170 }
171
172
173
174
175
176
177
178
179
180
181 public void performInitialization(View view, Object model) {
182
183 }
184
185
186
187
188
189
190
191
192
193
194
195 public void performApplyModel(View view, Object model, Component parent) {
196 if (this.render && StringUtils.isNotEmpty(progressiveRender)) {
197
198 ExpressionEvaluatorService expressionEvaluatorService =
199 KRADServiceLocatorWeb.getExpressionEvaluatorService();
200 String adjustedProgressiveRender = expressionEvaluatorService.replaceBindingPrefixes(view, this,
201 progressiveRender);
202 Boolean progRenderEval = (Boolean) expressionEvaluatorService.evaluateExpression(model, context,
203 adjustedProgressiveRender);
204
205 this.setRender(progRenderEval);
206 }
207 }
208
209
210
211
212
213
214
215
216
217
218
219
220
221 public void performFinalize(View view, Object model, Component parent) {
222 if (StringUtils.isNotEmpty(progressiveRender)) {
223 progressiveRender = KRADServiceLocatorWeb.getExpressionEvaluatorService().replaceBindingPrefixes(view, this,
224 progressiveRender);
225 progressiveDisclosureControlNames = new ArrayList<String>();
226 progressiveDisclosureConditionJs = ExpressionUtils.parseExpression(progressiveRender,
227 progressiveDisclosureControlNames);
228 }
229
230 if (StringUtils.isNotEmpty(conditionalRefresh)) {
231 conditionalRefresh = KRADServiceLocatorWeb.getExpressionEvaluatorService().replaceBindingPrefixes(view,
232 this, conditionalRefresh);
233 conditionalRefreshControlNames = new ArrayList<String>();
234 conditionalRefreshConditionJs = ExpressionUtils.parseExpression(conditionalRefresh,
235 conditionalRefreshControlNames);
236 }
237
238 List<String> adjustedRefreshPropertyNames = new ArrayList<String>();
239 for (String refreshPropertyName : refreshWhenChangedPropertyNames) {
240 adjustedRefreshPropertyNames.add(
241 KRADServiceLocatorWeb.getExpressionEvaluatorService().replaceBindingPrefixes(view, this,
242 refreshPropertyName));
243 }
244 refreshWhenChangedPropertyNames = adjustedRefreshPropertyNames;
245
246
247 if (StringUtils.isNotBlank(getAlign()) && !StringUtils.contains(getStyle(), CssConstants.TEXT_ALIGN)) {
248 appendToStyle(CssConstants.TEXT_ALIGN + getAlign() + ";");
249 }
250
251 if (StringUtils.isNotBlank(getValign()) && !StringUtils.contains(getStyle(), CssConstants.VERTICAL_ALIGN)) {
252 appendToStyle(CssConstants.VERTICAL_ALIGN + getValign() + ";");
253 }
254
255 if (StringUtils.isNotBlank(getWidth()) && !StringUtils.contains(getStyle(), CssConstants.WIDTH)) {
256 appendToStyle(CssConstants.WIDTH + getWidth() + ";");
257 }
258
259
260
261 for (Component component : getComponentsForLifecycle()) {
262 if (component != null && component instanceof ComponentBase && skipInTabOrder) {
263 ((ComponentBase) component).setSkipInTabOrder(skipInTabOrder);
264 if (component instanceof ControlBase) {
265 ((ControlBase) component).setTabIndex(-1);
266 }
267 }
268 }
269
270
271
272 boolean hide = false;
273 if (!this.render && !this.progressiveRenderViaAJAX && !this.progressiveRenderAndRefresh && StringUtils
274 .isNotBlank(progressiveRender)) {
275 hide = true;
276 } else if (this.isHidden()) {
277 hide = true;
278 }
279
280 if (hide) {
281 if (StringUtils.isNotBlank(this.getStyle())) {
282 if (this.getStyle().endsWith(";")) {
283 this.setStyle(this.getStyle() + " display: none;");
284 } else {
285 this.setStyle(this.getStyle() + "; display: none;");
286 }
287 } else {
288 this.setStyle("display: none;");
289 }
290 }
291 }
292
293
294
295
296 public List<Component> getComponentsForLifecycle() {
297 List<Component> components = new ArrayList<Component>();
298
299 return components;
300 }
301
302
303
304
305 public List<Component> getComponentPrototypes() {
306 List<Component> components = new ArrayList<Component>();
307
308 for (ComponentModifier modifier : componentModifiers) {
309 components.addAll(modifier.getComponentPrototypes());
310 }
311
312 components.addAll(getPropertyReplacerComponents());
313
314 return components;
315 }
316
317
318
319
320
321
322 public List<Component> getPropertyReplacerComponents() {
323 List<Component> components = new ArrayList<Component>();
324 for (Object replacer : propertyReplacers) {
325 components.addAll(((PropertyReplacer) replacer).getNestedComponents());
326 }
327
328 return components;
329 }
330
331
332
333
334 public String getId() {
335 return this.id;
336 }
337
338
339
340
341 public void setId(String id) {
342 this.id = id;
343 }
344
345
346
347
348 public String getBaseId() {
349 return this.baseId;
350 }
351
352
353
354
355 public void setBaseId(String baseId) {
356 this.baseId = baseId;
357 }
358
359
360
361
362 public String getTemplate() {
363 return this.template;
364 }
365
366
367
368
369 public void setTemplate(String template) {
370 this.template = template;
371 }
372
373 public String getTemplateName() {
374 return templateName;
375 }
376
377 public void setTemplateName(String templateName) {
378 this.templateName = templateName;
379 }
380
381
382
383
384 public String getTitle() {
385 return this.title;
386 }
387
388
389
390
391 public void setTitle(String title) {
392 this.title = title;
393 }
394
395
396
397
398 public boolean isHidden() {
399 return this.hidden;
400 }
401
402
403
404
405 public void setHidden(boolean hidden) {
406 this.hidden = hidden;
407 }
408
409
410
411
412 public boolean isReadOnly() {
413 return this.readOnly;
414 }
415
416
417
418
419 public void setReadOnly(boolean readOnly) {
420 this.readOnly = readOnly;
421 }
422
423
424
425
426 public Boolean getRequired() {
427 return this.required;
428 }
429
430
431
432
433 public void setRequired(Boolean required) {
434 this.required = required;
435 }
436
437
438
439
440 public boolean isRender() {
441 return this.render;
442 }
443
444
445
446
447 public void setRender(boolean render) {
448 this.render = render;
449 }
450
451
452
453
454 public int getColSpan() {
455 return this.colSpan;
456 }
457
458
459
460
461 public void setColSpan(int colSpan) {
462 this.colSpan = colSpan;
463 }
464
465
466
467
468 public int getRowSpan() {
469 return this.rowSpan;
470 }
471
472
473
474
475 public void setRowSpan(int rowSpan) {
476 this.rowSpan = rowSpan;
477 }
478
479
480
481
482
483
484
485
486
487
488
489
490
491 public String getAlign() {
492 return this.align;
493 }
494
495
496
497
498
499
500 public void setAlign(String align) {
501 this.align = align;
502 }
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518 public String getValign() {
519 return this.valign;
520 }
521
522
523
524
525
526
527 public void setValign(String valign) {
528 this.valign = valign;
529 }
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546 public String getWidth() {
547 return this.width;
548 }
549
550
551
552
553
554
555 public void setWidth(String width) {
556 this.width = width;
557 }
558
559
560
561
562 public String getStyle() {
563 return this.style;
564 }
565
566
567
568
569 public void setStyle(String style) {
570 this.style = style;
571 }
572
573
574
575
576 public List<String> getCssClasses() {
577 return this.cssClasses;
578 }
579
580
581
582
583 public void setCssClasses(List<String> cssClasses) {
584 this.cssClasses = cssClasses;
585 }
586
587
588
589
590
591
592
593 public String getStyleClassesAsString() {
594 if (cssClasses != null) {
595 return StringUtils.join(cssClasses, " ");
596 }
597
598 return "";
599 }
600
601
602
603
604 public void addStyleClass(String styleClass) {
605 if (!cssClasses.contains(styleClass)) {
606 cssClasses.add(styleClass);
607 }
608 }
609
610
611
612
613 public void appendToStyle(String styleRules) {
614 if (style == null) {
615 style = "";
616 }
617 style = style + styleRules;
618 }
619
620
621
622
623 public String getFinalizeMethodToCall() {
624 return this.finalizeMethodToCall;
625 }
626
627
628
629
630
631
632 public void setFinalizeMethodToCall(String finalizeMethodToCall) {
633 this.finalizeMethodToCall = finalizeMethodToCall;
634 }
635
636
637
638
639 public List<Object> getFinalizeMethodAdditionalArguments() {
640 return finalizeMethodAdditionalArguments;
641 }
642
643
644
645
646
647
648 public void setFinalizeMethodAdditionalArguments(List<Object> finalizeMethodAdditionalArguments) {
649 this.finalizeMethodAdditionalArguments = finalizeMethodAdditionalArguments;
650 }
651
652
653
654
655 public MethodInvokerConfig getFinalizeMethodInvoker() {
656 return this.finalizeMethodInvoker;
657 }
658
659
660
661
662
663
664 public void setFinalizeMethodInvoker(MethodInvokerConfig finalizeMethodInvoker) {
665 this.finalizeMethodInvoker = finalizeMethodInvoker;
666 }
667
668
669
670
671 public boolean isSelfRendered() {
672 return this.selfRendered;
673 }
674
675
676
677
678 public void setSelfRendered(boolean selfRendered) {
679 this.selfRendered = selfRendered;
680 }
681
682
683
684
685 public String getRenderedHtmlOutput() {
686 return this.renderedHtmlOutput;
687 }
688
689
690
691
692 public void setRenderedHtmlOutput(String renderedHtmlOutput) {
693 this.renderedHtmlOutput = renderedHtmlOutput;
694 }
695
696
697
698
699 public boolean isDisableSessionPersistence() {
700 return disableSessionPersistence;
701 }
702
703
704
705
706 public void setDisableSessionPersistence(boolean disableSessionPersistence) {
707 this.disableSessionPersistence = disableSessionPersistence;
708 }
709
710
711
712
713 public boolean isForceSessionPersistence() {
714 return forceSessionPersistence;
715 }
716
717
718
719
720 public void setForceSessionPersistence(boolean forceSessionPersistence) {
721 this.forceSessionPersistence = forceSessionPersistence;
722 }
723
724
725
726
727 public ComponentSecurity getComponentSecurity() {
728 return componentSecurity;
729 }
730
731
732
733
734 public void setComponentSecurity(ComponentSecurity componentSecurity) {
735 this.componentSecurity = componentSecurity;
736 }
737
738
739
740
741
742
743 protected Class<? extends ComponentSecurity> getComponentSecurityClass() {
744 return ComponentSecurity.class;
745 }
746
747
748
749
750 public List<ComponentModifier> getComponentModifiers() {
751 return this.componentModifiers;
752 }
753
754
755
756
757 public void setComponentModifiers(List<ComponentModifier> componentModifiers) {
758 this.componentModifiers = componentModifiers;
759 }
760
761
762
763
764 public Map<String, Object> getContext() {
765 return this.context;
766 }
767
768
769
770
771 public void setContext(Map<String, Object> context) {
772 this.context = context;
773 }
774
775
776
777
778
779 public void pushObjectToContext(String objectName, Object object) {
780 if (this.context == null) {
781 this.context = new HashMap<String, Object>();
782 }
783 pushToPropertyReplacerContext(objectName, object);
784 this.context.put(objectName, object);
785 }
786
787
788
789
790
791 protected void pushToPropertyReplacerContext(String objectName, Object object) {
792 for (Component replacerComponent : getPropertyReplacerComponents()) {
793 replacerComponent.pushObjectToContext(objectName, object);
794 }
795 }
796
797
798
799
800 public void pushAllToContext(Map<String, Object> objects) {
801 if (objects != null) {
802 for (Map.Entry<String, Object> objectEntry : objects.entrySet()) {
803 pushObjectToContext(objectEntry.getKey(), objectEntry.getValue());
804 }
805 }
806 }
807
808
809
810
811 public List<PropertyReplacer> getPropertyReplacers() {
812 return this.propertyReplacers;
813 }
814
815
816
817
818 public void setPropertyReplacers(List<PropertyReplacer> propertyReplacers) {
819 this.propertyReplacers = propertyReplacers;
820 }
821
822
823
824
825 public int getOrder() {
826 return this.order;
827 }
828
829
830
831
832
833
834 public void setOrder(int order) {
835 this.order = order;
836 }
837
838
839
840
841 public Tooltip getToolTip() {
842 return toolTip;
843 }
844
845
846
847
848 public void setToolTip(Tooltip toolTip) {
849 this.toolTip = toolTip;
850 }
851
852
853
854
855 public String getOnLoadScript() {
856 return onLoadScript;
857 }
858
859
860
861
862
863
864 public void setOnLoadScript(String onLoadScript) {
865 this.onLoadScript = onLoadScript;
866 }
867
868
869
870
871 public String getOnDocumentReadyScript() {
872 return onDocumentReadyScript;
873 }
874
875
876
877
878
879
880 public void setOnDocumentReadyScript(String onDocumentReadyScript) {
881 this.onDocumentReadyScript = onDocumentReadyScript;
882 }
883
884
885
886
887 public String getOnUnloadScript() {
888 return onUnloadScript;
889 }
890
891
892
893
894
895
896 public void setOnUnloadScript(String onUnloadScript) {
897 this.onUnloadScript = onUnloadScript;
898 }
899
900
901
902
903 public String getOnCloseScript() {
904 return onCloseScript;
905 }
906
907
908
909
910
911
912 public void setOnCloseScript(String onCloseScript) {
913 this.onCloseScript = onCloseScript;
914 }
915
916
917
918
919 public String getOnBlurScript() {
920 return onBlurScript;
921 }
922
923
924
925
926
927
928 public void setOnBlurScript(String onBlurScript) {
929 this.onBlurScript = onBlurScript;
930 }
931
932
933
934
935 public String getOnChangeScript() {
936 return onChangeScript;
937 }
938
939
940
941
942
943
944 public void setOnChangeScript(String onChangeScript) {
945 this.onChangeScript = onChangeScript;
946 }
947
948
949
950
951 public String getOnClickScript() {
952 return onClickScript;
953 }
954
955
956
957
958
959
960 public void setOnClickScript(String onClickScript) {
961 this.onClickScript = onClickScript;
962 }
963
964
965
966
967 public String getOnDblClickScript() {
968 return onDblClickScript;
969 }
970
971
972
973
974
975
976 public void setOnDblClickScript(String onDblClickScript) {
977 this.onDblClickScript = onDblClickScript;
978 }
979
980
981
982
983 public String getOnFocusScript() {
984 return onFocusScript;
985 }
986
987
988
989
990
991
992 public void setOnFocusScript(String onFocusScript) {
993 this.onFocusScript = onFocusScript;
994 }
995
996
997
998
999 public String getOnSubmitScript() {
1000 return onSubmitScript;
1001 }
1002
1003
1004
1005
1006
1007
1008 public void setOnSubmitScript(String onSubmitScript) {
1009 this.onSubmitScript = onSubmitScript;
1010 }
1011
1012
1013
1014
1015 public String getOnKeyPressScript() {
1016 return onKeyPressScript;
1017 }
1018
1019
1020
1021
1022
1023
1024 public void setOnKeyPressScript(String onKeyPressScript) {
1025 this.onKeyPressScript = onKeyPressScript;
1026 }
1027
1028
1029
1030
1031 public String getOnKeyUpScript() {
1032 return onKeyUpScript;
1033 }
1034
1035
1036
1037
1038
1039
1040 public void setOnKeyUpScript(String onKeyUpScript) {
1041 this.onKeyUpScript = onKeyUpScript;
1042 }
1043
1044
1045
1046
1047 public String getOnKeyDownScript() {
1048 return onKeyDownScript;
1049 }
1050
1051
1052
1053
1054
1055
1056 public void setOnKeyDownScript(String onKeyDownScript) {
1057 this.onKeyDownScript = onKeyDownScript;
1058 }
1059
1060
1061
1062
1063 public String getOnMouseOverScript() {
1064 return onMouseOverScript;
1065 }
1066
1067
1068
1069
1070
1071
1072 public void setOnMouseOverScript(String onMouseOverScript) {
1073 this.onMouseOverScript = onMouseOverScript;
1074 }
1075
1076
1077
1078
1079 public String getOnMouseOutScript() {
1080 return onMouseOutScript;
1081 }
1082
1083
1084
1085
1086
1087
1088 public void setOnMouseOutScript(String onMouseOutScript) {
1089 this.onMouseOutScript = onMouseOutScript;
1090 }
1091
1092
1093
1094
1095 public String getOnMouseUpScript() {
1096 return onMouseUpScript;
1097 }
1098
1099
1100
1101
1102
1103
1104 public void setOnMouseUpScript(String onMouseUpScript) {
1105 this.onMouseUpScript = onMouseUpScript;
1106 }
1107
1108
1109
1110
1111 public String getOnMouseDownScript() {
1112 return onMouseDownScript;
1113 }
1114
1115
1116
1117
1118
1119
1120 public void setOnMouseDownScript(String onMouseDownScript) {
1121 this.onMouseDownScript = onMouseDownScript;
1122 }
1123
1124
1125
1126
1127 public String getOnMouseMoveScript() {
1128 return onMouseMoveScript;
1129 }
1130
1131
1132
1133
1134
1135
1136 public void setOnMouseMoveScript(String onMouseMoveScript) {
1137 this.onMouseMoveScript = onMouseMoveScript;
1138 }
1139
1140
1141
1142
1143
1144 public Map<String, String> getTemplateOptions() {
1145 if (templateOptions == null) {
1146 templateOptions = new HashMap<String, String>();
1147 }
1148 return this.templateOptions;
1149 }
1150
1151
1152
1153
1154
1155 public void setTemplateOptions(Map<String, String> templateOptions) {
1156 this.templateOptions = templateOptions;
1157 }
1158
1159
1160
1161
1162
1163
1164
1165
1166 @Override
1167 public String getTemplateOptionsJSString() {
1168 if (templateOptionsJSString != null) {
1169 return templateOptionsJSString;
1170 }
1171
1172 if (templateOptions == null) {
1173 templateOptions = new HashMap<String, String>();
1174 }
1175 StringBuilder sb = new StringBuilder();
1176
1177 sb.append("{");
1178
1179 for (String optionKey : templateOptions.keySet()) {
1180 String optionValue = templateOptions.get(optionKey);
1181
1182 if (sb.length() > 1) {
1183 sb.append(",");
1184 }
1185
1186 sb.append(optionKey);
1187 sb.append(":");
1188
1189 sb.append(ScriptUtils.convertToJsValue(optionValue));
1190 }
1191
1192 sb.append("}");
1193
1194 return sb.toString();
1195 }
1196
1197 @Override
1198 public void setTemplateOptionsJSString(String templateOptionsJSString) {
1199 this.templateOptionsJSString = templateOptionsJSString;
1200 }
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222 public String getProgressiveRender() {
1223 return this.progressiveRender;
1224 }
1225
1226
1227
1228
1229 public void setProgressiveRender(String progressiveRender) {
1230 this.progressiveRender = progressiveRender;
1231 }
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250 public String getConditionalRefresh() {
1251 return this.conditionalRefresh;
1252 }
1253
1254
1255
1256
1257 public void setConditionalRefresh(String conditionalRefresh) {
1258 this.conditionalRefresh = conditionalRefresh;
1259 }
1260
1261
1262
1263
1264
1265
1266
1267 public List<String> getProgressiveDisclosureControlNames() {
1268 return this.progressiveDisclosureControlNames;
1269 }
1270
1271
1272
1273
1274
1275
1276
1277 public String getProgressiveDisclosureConditionJs() {
1278 return this.progressiveDisclosureConditionJs;
1279 }
1280
1281
1282
1283
1284
1285
1286
1287 public String getConditionalRefreshConditionJs() {
1288 return this.conditionalRefreshConditionJs;
1289 }
1290
1291
1292
1293
1294
1295
1296
1297 public List<String> getConditionalRefreshControlNames() {
1298 return this.conditionalRefreshControlNames;
1299 }
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311 public boolean isProgressiveRenderViaAJAX() {
1312 return this.progressiveRenderViaAJAX;
1313 }
1314
1315
1316
1317
1318 public void setProgressiveRenderViaAJAX(boolean progressiveRenderViaAJAX) {
1319 this.progressiveRenderViaAJAX = progressiveRenderViaAJAX;
1320 }
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332 public boolean isProgressiveRenderAndRefresh() {
1333 return this.progressiveRenderAndRefresh;
1334 }
1335
1336
1337
1338
1339 public void setProgressiveRenderAndRefresh(boolean progressiveRenderAndRefresh) {
1340 this.progressiveRenderAndRefresh = progressiveRenderAndRefresh;
1341 }
1342
1343
1344
1345
1346 public List<String> getRefreshWhenChangedPropertyNames() {
1347 return this.refreshWhenChangedPropertyNames;
1348 }
1349
1350
1351
1352
1353 public void setRefreshWhenChangedPropertyNames(List<String> refreshWhenChangedPropertyNames) {
1354 this.refreshWhenChangedPropertyNames = refreshWhenChangedPropertyNames;
1355 }
1356
1357
1358
1359
1360 public boolean isRefreshedByAction() {
1361 return refreshedByAction;
1362 }
1363
1364
1365
1366
1367 public void setRefreshedByAction(boolean refreshedByAction) {
1368 this.refreshedByAction = refreshedByAction;
1369 }
1370
1371
1372
1373
1374 public boolean isResetDataOnRefresh() {
1375 return resetDataOnRefresh;
1376 }
1377
1378
1379
1380
1381 public void setResetDataOnRefresh(boolean resetDataOnRefresh) {
1382 this.resetDataOnRefresh = resetDataOnRefresh;
1383 }
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401 public String getMethodToCallOnRefresh() {
1402 return methodToCallOnRefresh;
1403 }
1404
1405
1406
1407
1408
1409
1410 public void setMethodToCallOnRefresh(String methodToCallOnRefresh) {
1411 this.methodToCallOnRefresh = methodToCallOnRefresh;
1412 }
1413
1414
1415
1416
1417 public void setSkipInTabOrder(boolean skipInTabOrder) {
1418 this.skipInTabOrder = skipInTabOrder;
1419 }
1420
1421
1422
1423
1424
1425
1426
1427 public boolean isSkipInTabOrder() {
1428 return skipInTabOrder;
1429 }
1430
1431
1432
1433
1434
1435
1436 public void addDataAttribute(String key, String value){
1437 dataAttributes.put(key,value);
1438 }
1439
1440 public Map<String, String> getDataAttributes() {
1441 return dataAttributes;
1442 }
1443
1444
1445
1446
1447
1448 public String getDataRoleAttribute() {
1449 return dataRoleAttribute;
1450 }
1451
1452
1453
1454
1455
1456 public void setDataRoleAttribute(String dataRoleAttribute) {
1457 this.dataRoleAttribute = dataRoleAttribute;
1458 }
1459
1460
1461
1462
1463
1464 public String getDataTypeAttribute() {
1465 return dataTypeAttribute;
1466 }
1467
1468
1469
1470
1471
1472 public void setDataTypeAttribute(String dataTypeAttribute) {
1473 this.dataTypeAttribute = dataTypeAttribute;
1474 }
1475
1476
1477
1478
1479
1480 public String getDataMetaAttribute() {
1481 return dataMetaAttribute;
1482 }
1483
1484
1485
1486
1487
1488 public void setDataMetaAttribute(String dataMetaAttribute) {
1489 this.dataMetaAttribute = dataMetaAttribute;
1490 }
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500 public void setDataAttributes(Map<String, String> dataAttributes) {
1501 this.dataAttributes = dataAttributes;
1502 }
1503
1504
1505
1506
1507
1508
1509 public String getComplexDataAttributesJs(){
1510 String js = "";
1511 if (getDataAttributes() == null) {
1512 return js;
1513 } else {
1514 for(Map.Entry<String,String> data: getDataAttributes().entrySet()){
1515 if(data.getValue().trim().startsWith("{") && data.getValue().trim().endsWith("}")){
1516 js = js + "jQuery('#" + this.getId() + "').data('" + data.getKey()
1517 +"', " + data.getValue() +");";
1518 }
1519 }
1520 return js;
1521 }
1522 }
1523
1524
1525
1526
1527
1528
1529 public String getSimpleDataAttributes(){
1530 String attributes = "";
1531 if (getDataAttributes() == null) {
1532 return attributes;
1533 } else {
1534 for(Map.Entry<String,String> data: getDataAttributes().entrySet()){
1535 if(!data.getValue().trim().startsWith("{")){
1536 attributes = attributes + " " + "data-" + data.getKey() + "=\"" + data.getValue() + "\"";
1537 }
1538 }
1539 return attributes;
1540 }
1541 }
1542
1543 @Override
1544
1545
1546
1547 public String getAllDataAttributesJs() {
1548 String js = "";
1549 if (getDataAttributes() == null) {
1550 return js;
1551 } else {
1552 for(Map.Entry<String,String> data: getDataAttributes().entrySet()){
1553 js = js + "jQuery('#" + this.getId() + "').data('" + data.getKey()
1554 +"', " + ScriptUtils.convertToJsValue(data.getValue()) +");";
1555 }
1556 return js;
1557 }
1558 }
1559
1560 }