1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.field;
17
18 import org.apache.commons.lang.StringEscapeUtils;
19 import org.apache.commons.lang.StringUtils;
20 import org.kuali.rice.core.api.exception.RiceRuntimeException;
21 import org.kuali.rice.core.api.util.type.TypeUtils;
22 import org.kuali.rice.krad.bo.DataObjectRelationship;
23 import org.kuali.rice.krad.bo.KualiCode;
24 import org.kuali.rice.krad.datadictionary.AttributeDefinition;
25 import org.kuali.rice.krad.datadictionary.mask.MaskFormatter;
26 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
27 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
28 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
29 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
30 import org.kuali.rice.krad.datadictionary.validator.Validator;
31 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
32 import org.kuali.rice.krad.uif.UifConstants;
33 import org.kuali.rice.krad.uif.component.BindingInfo;
34 import org.kuali.rice.krad.uif.component.Component;
35 import org.kuali.rice.krad.uif.component.ComponentSecurity;
36 import org.kuali.rice.krad.uif.component.DataBinding;
37 import org.kuali.rice.krad.uif.component.KeepExpression;
38 import org.kuali.rice.krad.uif.util.ComponentFactory;
39 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
40 import org.kuali.rice.krad.uif.util.ViewModelUtils;
41 import org.kuali.rice.krad.uif.view.View;
42 import org.kuali.rice.krad.uif.widget.Help;
43 import org.kuali.rice.krad.uif.widget.Helpable;
44 import org.kuali.rice.krad.uif.widget.Inquiry;
45 import org.kuali.rice.krad.uif.widget.Tooltip;
46 import org.kuali.rice.krad.util.KRADPropertyConstants;
47 import org.kuali.rice.krad.util.ObjectUtils;
48 import org.kuali.rice.krad.valuefinder.ValueFinder;
49
50 import java.beans.PropertyEditor;
51 import java.util.ArrayList;
52 import java.util.List;
53
54
55
56
57
58
59 @BeanTags({@BeanTag(name = "dataField-bean", parent = "Uif-DataField"),
60 @BeanTag(name = "dataField-labelTop-bean", parent = "Uif-DataField-LabelTop"),
61 @BeanTag(name = "dataField-labelRight-bean", parent = "Uif-DataField-LabelRight"),
62 @BeanTag(name = "dataField-withoutLabel-bean", parent = "Uif-DataField-withoutLabel")})
63 public class DataField extends FieldBase implements DataBinding, Helpable {
64 private static final long serialVersionUID = -4129678891948564724L;
65
66
67 private String propertyName;
68 private BindingInfo bindingInfo;
69
70 private String dictionaryAttributeName;
71 private String dictionaryObjectEntry;
72
73
74 private String defaultValue;
75 private Class<? extends ValueFinder> defaultValueFinderClass;
76 private Object[] defaultValues;
77 private String forcedValue;
78
79 private PropertyEditor propertyEditor;
80
81 private boolean addHiddenWhenReadOnly;
82
83
84 protected String readOnlyDisplayReplacementPropertyName;
85 protected String readOnlyDisplaySuffixPropertyName;
86
87 private String readOnlyDisplayReplacement;
88 private String readOnlyDisplaySuffix;
89
90 private String readOnlyListDisplayType;
91 private String readOnlyListDelimiter;
92
93 private boolean applyMask;
94 private MaskFormatter maskFormatter;
95
96 private List<String> additionalHiddenPropertyNames;
97 private List<String> propertyNamesForAdditionalDisplay;
98
99 private boolean escapeHtmlInPropertyValue;
100 private boolean multiLineReadOnlyDisplay;
101
102
103 private Inquiry inquiry;
104 private boolean enableAutoInquiry;
105
106 private Help help;
107
108 public DataField() {
109 super();
110
111 enableAutoInquiry = true;
112 escapeHtmlInPropertyValue = true;
113
114 additionalHiddenPropertyNames = new ArrayList<String>();
115 propertyNamesForAdditionalDisplay = new ArrayList<String>();
116 }
117
118
119
120
121
122
123
124
125
126
127
128
129 @Override
130 public void performInitialization(View view, Object model) {
131 super.performInitialization(view, model);
132
133 if (bindingInfo != null) {
134 bindingInfo.setDefaults(view, getPropertyName());
135 }
136 }
137
138
139
140
141
142
143
144
145 public void performApplyModel(View view, Object model, Component parent) {
146 super.performApplyModel(view, model, parent);
147
148 if (this.enableAutoInquiry && (this.inquiry == null) && isReadOnly()) {
149 buildAutomaticInquiry(view, model, false);
150 }
151
152 if (isAddHiddenWhenReadOnly()) {
153 setReadOnly(true);
154 getAdditionalHiddenPropertyNames().add(getPropertyName());
155 }
156 }
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172 @Override
173 public void performFinalize(View view, Object model, Component parent) {
174 super.performFinalize(view, model, parent);
175
176
177
178 List<String> hiddenPropertyPaths = new ArrayList<String>();
179 for (String hiddenPropertyName : getAdditionalHiddenPropertyNames()) {
180 String hiddenPropertyPath = getBindingInfo().getPropertyAdjustedBindingPath(hiddenPropertyName);
181 hiddenPropertyPaths.add(hiddenPropertyPath);
182 }
183 this.additionalHiddenPropertyNames = hiddenPropertyPaths;
184
185
186 List<String> informationalPropertyPaths = new ArrayList<String>();
187 for (String infoPropertyName : getPropertyNamesForAdditionalDisplay()) {
188 String infoPropertyPath = getBindingInfo().getPropertyAdjustedBindingPath(infoPropertyName);
189 informationalPropertyPaths.add(infoPropertyPath);
190 }
191 this.propertyNamesForAdditionalDisplay = informationalPropertyPaths;
192
193
194 Class<?> type = ObjectPropertyUtils.getPropertyType(model, getBindingInfo().getBindingPath());
195 if (this.isReadOnly() && type != null && List.class.isAssignableFrom(type) && StringUtils.isBlank(
196 getReadOnlyDisplayReplacement()) && StringUtils.isBlank(getReadOnlyDisplayReplacementPropertyName())) {
197
198 Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath());
199
200
201 if (fieldValue != null && fieldValue instanceof List<?> && !((List) fieldValue).isEmpty()) {
202 List<?> list = (List<?>) fieldValue;
203 processReadOnlyListDisplay(model, list);
204 } else {
205 this.setReadOnlyDisplayReplacement(" ");
206 }
207
208 } else {
209
210 setAlternateAndAdditionalDisplayValue(view, model);
211 }
212
213 if (this.getFieldLabel() != null && StringUtils.isNotBlank(this.getId())) {
214 this.getFieldLabel().setLabelForComponentId(this.getId() + UifConstants.IdSuffixes.CONTROL);
215 }
216 }
217
218
219
220
221
222
223
224
225
226 protected void buildAutomaticInquiry(View view, Object model, boolean enableDirectInquiry) {
227 Inquiry autoInquiry = ComponentFactory.getInquiry();
228
229 view.getViewHelperService().spawnSubLifecyle(view, model, autoInquiry, this, null, null);
230
231
232 if (autoInquiry.isRender()) {
233 this.inquiry = autoInquiry;
234 }
235 }
236
237
238
239
240
241
242
243
244
245
246 protected void processReadOnlyListDisplay(Object model, List<?> originalList) {
247 this.setReadOnlyDisplayReplacement(generateReadOnlyListDisplayReplacement(originalList));
248 }
249
250
251
252
253
254
255
256
257 protected String generateReadOnlyListDisplayReplacement(List<?> list) {
258 String generatedHtml = "";
259
260
261 if (getReadOnlyListDisplayType() == null) {
262 this.setReadOnlyListDisplayType(UifConstants.ReadOnlyListTypes.DELIMITED.name());
263 }
264
265
266 if (getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.UL.name())) {
267 generatedHtml = "<ul class='uif-readOnlyStringList'>";
268 } else if (getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.OL.name())) {
269 generatedHtml = "<ol class='uif-readOnlyStringList'>";
270 } else if (getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.BREAK.name())) {
271 setReadOnlyListDelimiter("<br/>");
272 } else if (this.getReadOnlyListDelimiter() == null) {
273 setReadOnlyListDelimiter(", ");
274 }
275
276
277 for (Object value : list) {
278
279 if (!TypeUtils.isSimpleType(value.getClass()) || StringUtils.isBlank(value.toString())) {
280 continue;
281 }
282
283
284 if (isApplyMask()) {
285 value = getMaskFormatter().maskValue(value);
286 }
287
288
289
290 if (getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.UL.name())
291 || getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.OL.name())) {
292 generatedHtml = generatedHtml + "<li>" + StringEscapeUtils.escapeHtml(value.toString()) + "</li>";
293 } else {
294
295 generatedHtml = generatedHtml + StringEscapeUtils.escapeHtml(value.toString())
296 + this.getReadOnlyListDelimiter();
297 }
298 }
299
300
301 if (getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.UL.name())) {
302 generatedHtml = generatedHtml + "</ul>";
303 } else if (getReadOnlyListDisplayType().equalsIgnoreCase(UifConstants.ReadOnlyListTypes.OL.name())) {
304 generatedHtml = generatedHtml + "</ol>";
305 } else {
306 generatedHtml = StringUtils.removeEnd(generatedHtml, this.getReadOnlyListDelimiter());
307 }
308
309 if (StringUtils.isNotBlank(generatedHtml)) {
310 return generatedHtml;
311 } else {
312
313 return " ";
314 }
315 }
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340 protected void setAlternateAndAdditionalDisplayValue(View view, Object model) {
341
342 if (StringUtils.isNotBlank(readOnlyDisplayReplacement) || StringUtils.isNotBlank(readOnlyDisplaySuffix)) {
343 return;
344 }
345
346
347 if (isApplyMask()) {
348 Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath());
349 readOnlyDisplayReplacement = getMaskFormatter().maskValue(fieldValue);
350
351 return;
352 }
353
354
355 if (!isReadOnly()) {
356 return;
357 }
358
359
360 if (StringUtils.isNotBlank(getReadOnlyDisplayReplacementPropertyName())) {
361 String alternateDisplayPropertyPath = getBindingInfo().getPropertyAdjustedBindingPath(
362 getReadOnlyDisplayReplacementPropertyName());
363
364 Object alternateFieldValue = ObjectPropertyUtils.getPropertyValue(model, alternateDisplayPropertyPath);
365 if (alternateFieldValue != null) {
366
367 readOnlyDisplayReplacement = alternateFieldValue.toString();
368 }
369 }
370
371
372 if (StringUtils.isBlank(getReadOnlyDisplaySuffixPropertyName()) && view.isTranslateCodesOnReadOnlyDisplay()) {
373
374 Class<?> parentObjectClass = ViewModelUtils.getParentObjectClassForMetadata(view, model, this);
375 DataObjectRelationship relationship =
376 KRADServiceLocatorWeb.getDataObjectMetaDataService().getDataObjectRelationship(null,
377 parentObjectClass, getBindingInfo().getBindingName(), "", true, false, false);
378
379 if (relationship != null
380 && getPropertyName().startsWith(relationship.getParentAttributeName())
381 && KualiCode.class.isAssignableFrom(relationship.getRelatedClass())) {
382 readOnlyDisplaySuffixPropertyName =
383 relationship.getParentAttributeName() + "." + KRADPropertyConstants.NAME;
384 }
385 }
386
387
388 if (StringUtils.isNotBlank(getReadOnlyDisplaySuffixPropertyName())) {
389 String additionalDisplayPropertyPath = getBindingInfo().getPropertyAdjustedBindingPath(
390 getReadOnlyDisplaySuffixPropertyName());
391
392 Object additionalFieldValue = ObjectPropertyUtils.getPropertyValue(model, additionalDisplayPropertyPath);
393 if (additionalFieldValue != null) {
394
395 readOnlyDisplaySuffix = additionalFieldValue.toString();
396 }
397 }
398 }
399
400
401
402
403
404
405
406
407
408
409
410
411 public void copyFromAttributeDefinition(View view, AttributeDefinition attributeDefinition) {
412
413 if (StringUtils.isEmpty(getLabel())) {
414 setLabel(attributeDefinition.getLabel());
415 }
416
417
418 if (StringUtils.isEmpty(getShortLabel())) {
419 setShortLabel(attributeDefinition.getShortLabel());
420 }
421
422
423 if (getDataFieldSecurity().getAttributeSecurity() == null) {
424 getDataFieldSecurity().setAttributeSecurity(attributeDefinition.getAttributeSecurity());
425 }
426
427
428 if (getReadOnlyDisplayReplacementPropertyName() == null && StringUtils.isNotBlank(
429 attributeDefinition.getAlternateDisplayAttributeName())) {
430 setReadOnlyDisplayReplacementPropertyName(attributeDefinition.getAlternateDisplayAttributeName());
431 }
432
433
434 if (getReadOnlyDisplaySuffixPropertyName() == null && StringUtils.isNotBlank(
435 attributeDefinition.getAdditionalDisplayAttributeName())) {
436 setReadOnlyDisplaySuffixPropertyName(attributeDefinition.getAdditionalDisplayAttributeName());
437 }
438
439
440 if (getPropertyEditor() == null) {
441 setPropertyEditor(attributeDefinition.getPropertyEditor());
442 }
443 }
444
445
446
447
448 @Override
449 public List<Component> getComponentsForLifecycle() {
450 List<Component> components = super.getComponentsForLifecycle();
451
452 components.add(inquiry);
453 components.add(help);
454
455 return components;
456 }
457
458
459
460
461
462
463
464 public boolean isInputAllowed() {
465 return false;
466 }
467
468
469
470
471 @BeanTagAttribute(name = "propertyName")
472 public String getPropertyName() {
473 return this.propertyName;
474 }
475
476
477
478
479
480
481 public void setPropertyName(String propertyName) {
482 this.propertyName = propertyName;
483 }
484
485
486
487
488
489
490
491
492
493
494
495
496
497 @BeanTagAttribute(name = "propertyEditor", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
498 public PropertyEditor getPropertyEditor() {
499 return propertyEditor;
500 }
501
502
503
504
505
506
507 public void setPropertyEditor(PropertyEditor propertyEditor) {
508 this.propertyEditor = propertyEditor;
509 }
510
511
512
513
514
515
516 public void setPropertyEditorClass(Class<? extends PropertyEditor> propertyEditorClass) {
517 this.propertyEditor = ObjectUtils.newInstance(propertyEditorClass);
518 }
519
520
521
522
523 @BeanTagAttribute(name = "bindingInfo", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
524 public BindingInfo getBindingInfo() {
525 return this.bindingInfo;
526 }
527
528
529
530
531
532
533 public void setBindingInfo(BindingInfo bindingInfo) {
534 this.bindingInfo = bindingInfo;
535 }
536
537
538
539
540
541
542
543 public String getName() {
544 return this.getBindingInfo().getBindingPath();
545 }
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568 @BeanTagAttribute(name = "dictionaryAttributeName")
569 public String getDictionaryAttributeName() {
570 return this.dictionaryAttributeName;
571 }
572
573
574
575
576
577
578 public void setDictionaryAttributeName(String dictionaryAttributeName) {
579 this.dictionaryAttributeName = dictionaryAttributeName;
580 }
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602 @BeanTagAttribute(name = "dictionaryObjectEntry")
603 public String getDictionaryObjectEntry() {
604 return this.dictionaryObjectEntry;
605 }
606
607
608
609
610
611
612 public void setDictionaryObjectEntry(String dictionaryObjectEntry) {
613 this.dictionaryObjectEntry = dictionaryObjectEntry;
614 }
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638 @BeanTagAttribute(name = "defaultValue")
639 public String getDefaultValue() {
640 return this.defaultValue;
641 }
642
643
644
645
646
647
648 public void setDefaultValue(String defaultValue) {
649 this.defaultValue = defaultValue;
650 }
651
652
653
654
655
656
657
658 @BeanTagAttribute(name = "defaultValueFinderClass")
659 public Class<? extends ValueFinder> getDefaultValueFinderClass() {
660 return this.defaultValueFinderClass;
661 }
662
663
664
665
666
667
668 public void setDefaultValueFinderClass(Class<? extends ValueFinder> defaultValueFinderClass) {
669 this.defaultValueFinderClass = defaultValueFinderClass;
670 }
671
672
673
674
675
676
677
678
679
680
681
682
683 @BeanTagAttribute(name = "defaultValues", type = BeanTagAttribute.AttributeType.LISTBEAN)
684 public Object[] getDefaultValues() {
685 return this.defaultValues;
686 }
687
688
689
690
691
692
693 public void setDefaultValues(Object[] defaultValues) {
694 this.defaultValues = defaultValues;
695 }
696
697 public String getForcedValue() {
698 return forcedValue;
699 }
700
701 public void setForcedValue(String forcedValue) {
702 this.forcedValue = forcedValue;
703 }
704
705
706
707
708
709
710 @BeanTagAttribute(name = "helpSummary")
711 public String getHelpSummary() {
712 return this.help.getTooltipHelpContent();
713 }
714
715
716
717
718
719
720 public void setHelpSummary(String helpSummary) {
721 this.help.setTooltipHelpContent(helpSummary);
722 }
723
724
725
726
727
728
729 public DataFieldSecurity getDataFieldSecurity() {
730 return (DataFieldSecurity) super.getComponentSecurity();
731 }
732
733
734
735
736
737
738 @Override
739 public void setComponentSecurity(ComponentSecurity componentSecurity) {
740 if ((componentSecurity != null) && !(componentSecurity instanceof DataFieldSecurity)) {
741 throw new RiceRuntimeException("Component security for DataField should be instance of DataFieldSecurity");
742 }
743
744 super.setComponentSecurity(componentSecurity);
745 }
746
747
748
749
750 @Override
751 protected Class<? extends ComponentSecurity> getComponentSecurityClass() {
752 return DataFieldSecurity.class;
753 }
754
755
756
757
758
759
760
761
762
763
764 @BeanTagAttribute(name = "addHiddenWhenReadOnly")
765 public boolean isAddHiddenWhenReadOnly() {
766 return addHiddenWhenReadOnly;
767 }
768
769
770
771
772
773
774 public void setAddHiddenWhenReadOnly(boolean addHiddenWhenReadOnly) {
775 this.addHiddenWhenReadOnly = addHiddenWhenReadOnly;
776 }
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791 @BeanTagAttribute(name = "inquiry", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
792 public Inquiry getInquiry() {
793 return this.inquiry;
794 }
795
796
797
798
799
800
801 public void setInquiry(Inquiry inquiry) {
802 this.inquiry = inquiry;
803 }
804
805
806
807
808
809
810
811
812
813
814
815
816 public boolean isEnableAutoInquiry() {
817 return enableAutoInquiry;
818 }
819
820
821
822
823
824
825 public void setEnableAutoInquiry(boolean enableAutoInquiry) {
826 this.enableAutoInquiry = enableAutoInquiry;
827 }
828
829
830
831
832
833
834
835
836
837
838
839
840 @Override
841 @BeanTagAttribute(name = "help", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
842 public Help getHelp() {
843 return this.help;
844 }
845
846
847
848
849
850
851 @Override
852 public void setHelp(Help help) {
853 this.help = help;
854 }
855
856
857
858
859
860
861 @Override
862 @BeanTagAttribute(name = "tooltipOfComponent", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
863 public void setTooltipOfComponent(Tooltip tooltip) {
864 getFieldLabel().setToolTip(tooltip);
865 }
866
867
868
869
870
871
872
873 @Override
874 public String getHelpTitle() {
875 return this.getLabel();
876 }
877
878
879
880
881
882
883
884 public void setReadOnlyDisplaySuffixPropertyName(String readOnlyDisplaySuffixPropertyName) {
885 this.readOnlyDisplaySuffixPropertyName = readOnlyDisplaySuffixPropertyName;
886 }
887
888
889
890
891
892
893 @BeanTagAttribute(name = "readOnlyDisplaceSuffixPropertyName")
894 public String getReadOnlyDisplaySuffixPropertyName() {
895 return this.readOnlyDisplaySuffixPropertyName;
896 }
897
898
899
900
901
902
903
904 public void setReadOnlyDisplayReplacementPropertyName(String readOnlyDisplayReplacementPropertyName) {
905 this.readOnlyDisplayReplacementPropertyName = readOnlyDisplayReplacementPropertyName;
906 }
907
908
909
910
911
912
913 @BeanTagAttribute(name = "readOnlyDisplayReplacementPropertyName")
914 public String getReadOnlyDisplayReplacementPropertyName() {
915 return this.readOnlyDisplayReplacementPropertyName;
916 }
917
918
919
920
921
922
923 @BeanTagAttribute(name = "readOnlyDisplayReplacement")
924 public String getReadOnlyDisplayReplacement() {
925 return readOnlyDisplayReplacement;
926 }
927
928
929
930
931
932
933 public void setReadOnlyDisplayReplacement(String value) {
934 this.readOnlyDisplayReplacement = value;
935 }
936
937
938
939
940
941
942 @BeanTagAttribute(name = "readOnlyDispalySuffix")
943 public String getReadOnlyDisplaySuffix() {
944 return readOnlyDisplaySuffix;
945 }
946
947
948
949
950
951
952 public void setReadOnlyDisplaySuffix(String value) {
953 this.readOnlyDisplaySuffix = value;
954 }
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971 public String getReadOnlyListDisplayType() {
972 return readOnlyListDisplayType;
973 }
974
975
976
977
978
979
980 public void setReadOnlyListDisplayType(String readOnlyListDisplayType) {
981 this.readOnlyListDisplayType = readOnlyListDisplayType;
982 }
983
984
985
986
987
988
989
990 public String getReadOnlyListDelimiter() {
991 return readOnlyListDelimiter;
992 }
993
994
995
996
997
998
999 public void setReadOnlyListDelimiter(String readOnlyListDelimiter) {
1000 this.readOnlyListDelimiter = readOnlyListDelimiter;
1001 }
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020 @BeanTagAttribute(name = "applyMask")
1021 public boolean isApplyMask() {
1022 return applyMask;
1023 }
1024
1025
1026
1027
1028
1029
1030 public void setApplyMask(boolean applyMask) {
1031 this.applyMask = applyMask;
1032 }
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044 @BeanTagAttribute(name = "maskFormatter", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1045 public MaskFormatter getMaskFormatter() {
1046 return maskFormatter;
1047 }
1048
1049
1050
1051
1052
1053
1054 public void setMaskFormatter(MaskFormatter maskFormatter) {
1055 this.maskFormatter = maskFormatter;
1056 }
1057
1058
1059
1060
1061
1062
1063
1064 @BeanTagAttribute(name = "additionalHiddenPropertyNames", type = BeanTagAttribute.AttributeType.LISTVALUE)
1065 public List<String> getAdditionalHiddenPropertyNames() {
1066 return additionalHiddenPropertyNames;
1067 }
1068
1069
1070
1071
1072
1073
1074 public void setAdditionalHiddenPropertyNames(List<String> additionalHiddenPropertyNames) {
1075 this.additionalHiddenPropertyNames = additionalHiddenPropertyNames;
1076 }
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096 @BeanTagAttribute(name = "propertyNamesForAdditionalDisplay", type = BeanTagAttribute.AttributeType.LISTVALUE)
1097 public List<String> getPropertyNamesForAdditionalDisplay() {
1098 return propertyNamesForAdditionalDisplay;
1099 }
1100
1101
1102
1103
1104
1105
1106 public void setPropertyNamesForAdditionalDisplay(List<String> propertyNamesForAdditionalDisplay) {
1107 this.propertyNamesForAdditionalDisplay = propertyNamesForAdditionalDisplay;
1108 }
1109
1110
1111
1112
1113
1114 public void setEscapeHtmlInPropertyValue(boolean escapeHtmlInPropertyValue) {
1115 this.escapeHtmlInPropertyValue = escapeHtmlInPropertyValue;
1116 }
1117
1118
1119
1120
1121
1122
1123 @BeanTagAttribute(name = "escapeHtmlInPropertyValue")
1124 public boolean isEscapeHtmlInPropertyValue() {
1125 return this.escapeHtmlInPropertyValue;
1126 }
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138 public boolean isMultiLineReadOnlyDisplay() {
1139 return multiLineReadOnlyDisplay;
1140 }
1141
1142
1143
1144
1145
1146
1147 public void setMultiLineReadOnlyDisplay(boolean multiLineReadOnlyDisplay) {
1148 this.multiLineReadOnlyDisplay = multiLineReadOnlyDisplay;
1149 }
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161 public boolean hasSecureValue() {
1162 return isApplyMask() || ((getComponentSecurity().isViewAuthz()
1163 || getDataFieldSecurity().isViewInLineAuthz()
1164 || ((getDataFieldSecurity().getAttributeSecurity() != null) && getDataFieldSecurity()
1165 .getAttributeSecurity().isHide())) && isHidden());
1166 }
1167
1168 public boolean isRenderFieldset() {
1169 return (!this.isReadOnly()
1170 && inquiry != null
1171 && inquiry.isRender()
1172 && inquiry.getInquiryLink() != null
1173 && inquiry.getInquiryLink().isRender()) || (help != null
1174 && help.isRender()
1175 && help.getHelpAction() != null
1176 && help.getHelpAction().isRender());
1177 }
1178
1179
1180
1181
1182 @Override
1183 public void completeValidation(ValidationTrace tracer) {
1184 tracer.addBean(this);
1185
1186
1187 if (getPropertyName() == null) {
1188 if (!Validator.checkExpressions(this, "propertyName")) {
1189 String currentValues[] = {"propertyName = " + getPropertyName()};
1190 tracer.createError("Property name not set", currentValues);
1191 }
1192 }
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202 if (isApplyMask()) {
1203 if (maskFormatter == null) {
1204 String currentValues[] = {"applyMask =" + isApplyMask(), "maskFormatter =" + maskFormatter};
1205 tracer.createWarning("Apply mask is true, but no value is set for maskFormatter", currentValues);
1206 }
1207 }
1208
1209 super.completeValidation(tracer.getCopy());
1210 }
1211
1212
1213
1214
1215 @Override
1216 protected <T> void copyProperties(T component) {
1217 super.copyProperties(component);
1218 DataField dataFieldCopy = (DataField) component;
1219 dataFieldCopy.setAddHiddenWhenReadOnly(this.addHiddenWhenReadOnly);
1220 dataFieldCopy.setAdditionalHiddenPropertyNames(new ArrayList<String>(this.additionalHiddenPropertyNames));
1221 dataFieldCopy.setApplyMask(this.applyMask);
1222
1223 if (this.maskFormatter != null) {
1224 dataFieldCopy.setMaskFormatter(this.maskFormatter);
1225 }
1226
1227 if (this.bindingInfo != null) {
1228 dataFieldCopy.setBindingInfo((BindingInfo) this.bindingInfo.copy());
1229 }
1230
1231 dataFieldCopy.setDefaultValue(this.defaultValue);
1232
1233 if (this.defaultValues != null) {
1234 dataFieldCopy.setDefaultValues(this.defaultValues);
1235 }
1236
1237 dataFieldCopy.setDictionaryAttributeName(this.dictionaryAttributeName);
1238 dataFieldCopy.setDictionaryObjectEntry(this.dictionaryObjectEntry);
1239 dataFieldCopy.setEnableAutoInquiry(this.enableAutoInquiry);
1240 dataFieldCopy.setEscapeHtmlInPropertyValue(this.escapeHtmlInPropertyValue);
1241 dataFieldCopy.setForcedValue(this.forcedValue);
1242 dataFieldCopy.setMultiLineReadOnlyDisplay(this.multiLineReadOnlyDisplay);
1243
1244 if (this.propertyEditor != null) {
1245 dataFieldCopy.setPropertyEditor(this.propertyEditor);
1246 }
1247
1248 dataFieldCopy.setPropertyName(this.propertyName);
1249
1250 if (this.propertyNamesForAdditionalDisplay != null) {
1251 dataFieldCopy.setPropertyNamesForAdditionalDisplay(new ArrayList<String>(
1252 this.propertyNamesForAdditionalDisplay));
1253 }
1254
1255 dataFieldCopy.setReadOnlyDisplayReplacement(this.readOnlyDisplayReplacement);
1256 dataFieldCopy.setReadOnlyDisplayReplacementPropertyName(this.readOnlyDisplayReplacementPropertyName);
1257 dataFieldCopy.setReadOnlyDisplaySuffix(this.readOnlyDisplaySuffix);
1258 dataFieldCopy.setReadOnlyDisplaySuffixPropertyName(this.readOnlyDisplaySuffixPropertyName);
1259 dataFieldCopy.setReadOnlyListDelimiter(this.readOnlyListDelimiter);
1260 dataFieldCopy.setReadOnlyListDisplayType(this.readOnlyListDisplayType);
1261 dataFieldCopy.setDefaultValueFinderClass(this.defaultValueFinderClass);
1262
1263 if (this.help != null) {
1264 dataFieldCopy.setHelp((Help) this.help.copy());
1265 }
1266
1267 if (this.inquiry != null) {
1268 dataFieldCopy.setInquiry((Inquiry) this.inquiry.copy());
1269 }
1270 }
1271 }