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.StringUtils;
19 import org.kuali.rice.core.api.data.DataType;
20 import org.kuali.rice.core.api.util.ConcreteKeyValue;
21 import org.kuali.rice.core.api.util.KeyValue;
22 import org.kuali.rice.core.api.util.type.TypeUtils;
23 import org.kuali.rice.krad.datadictionary.AttributeDefinition;
24 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
25 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
26 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
27 import org.kuali.rice.krad.datadictionary.state.StateMapping;
28 import org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint;
29 import org.kuali.rice.krad.datadictionary.validation.constraint.MustOccurConstraint;
30 import org.kuali.rice.krad.datadictionary.validation.constraint.PrerequisiteConstraint;
31 import org.kuali.rice.krad.datadictionary.validation.constraint.SimpleConstraint;
32 import org.kuali.rice.krad.datadictionary.validation.constraint.ValidCharactersConstraint;
33 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
34 import org.kuali.rice.krad.datadictionary.validator.Validator;
35 import org.kuali.rice.krad.keyvalues.KeyValuesFinder;
36 import org.kuali.rice.krad.service.DataDictionaryService;
37 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
38 import org.kuali.rice.krad.uif.CssConstants;
39 import org.kuali.rice.krad.uif.UifConstants;
40 import org.kuali.rice.krad.uif.component.Component;
41 import org.kuali.rice.krad.uif.component.DelayedCopy;
42 import org.kuali.rice.krad.uif.control.Control;
43 import org.kuali.rice.krad.uif.control.MultiValueControlBase;
44 import org.kuali.rice.krad.uif.control.TextAreaControl;
45 import org.kuali.rice.krad.uif.control.TextControl;
46 import org.kuali.rice.krad.uif.control.UifKeyValuesFinder;
47 import org.kuali.rice.krad.uif.element.Label;
48 import org.kuali.rice.krad.uif.element.Message;
49 import org.kuali.rice.krad.uif.element.ValidationMessages;
50 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
51 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
52 import org.kuali.rice.krad.uif.lifecycle.ViewPostMetadata;
53 import org.kuali.rice.krad.uif.util.ClientValidationUtils;
54 import org.kuali.rice.krad.uif.util.CloneUtils;
55 import org.kuali.rice.krad.uif.util.ComponentFactory;
56 import org.kuali.rice.krad.uif.util.ComponentUtils;
57 import org.kuali.rice.krad.uif.util.ConstraintStateUtils;
58 import org.kuali.rice.krad.uif.util.LifecycleElement;
59 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
60 import org.kuali.rice.krad.uif.view.View;
61 import org.kuali.rice.krad.uif.view.ViewModel;
62 import org.kuali.rice.krad.uif.widget.QuickFinder;
63 import org.kuali.rice.krad.uif.widget.Suggest;
64 import org.kuali.rice.krad.util.KRADUtils;
65
66 import java.util.ArrayList;
67 import java.util.List;
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 @BeanTags({@BeanTag(name = "inputField-bean", parent = "Uif-InputField"),
88 @BeanTag(name = "inputField-labelTop-bean", parent = "Uif-InputField-LabelTop"),
89 @BeanTag(name = "inputField-labelRight-bean", parent = "Uif-InputField-LabelRight"),
90 @BeanTag(name = "checkboxInputField-bean", parent = "Uif-CheckboxInputField"),
91 @BeanTag(name = "dialogResponse-bean", parent = "Uif-DialogResponse"),
92 @BeanTag(name = "dialogExplanation-bean", parent = "Uif-DialogExplanation"),
93 @BeanTag(name = "documentNumber-bean", parent = "Uif-DocumentNumber"),
94 @BeanTag(name = "documentStatus-bean", parent = "Uif-DocumentStatus"),
95 @BeanTag(name = "documentInitiatorNetworkId-bean", parent = "Uif-DocumentInitiatorNetworkId"),
96 @BeanTag(name = "documentCreateDate-bean", parent = "Uif-DocumentCreateDate"),
97 @BeanTag(name = "documentTemplateNumber-bean", parent = "Uif-DocumentTemplateNumber"),
98 @BeanTag(name = "documentDescription-bean", parent = "Uif-DocumentDescription"),
99 @BeanTag(name = "documentExplaination-bean", parent = "Uif-DocumentExplaination"),
100 @BeanTag(name = "organizationDocumentNumber-bean", parent = "Uif-OrganizationDocumentNumber"),
101 @BeanTag(name = "selectCollectionItemField-bean", parent = "Uif-SelectCollectionItemField")})
102 public class InputFieldBase extends DataFieldBase implements InputField {
103 private static final long serialVersionUID = -3703656713706343840L;
104
105
106 private String customValidatorClass;
107 private ValidCharactersConstraint validCharactersConstraint;
108 private CaseConstraint caseConstraint;
109 private List<PrerequisiteConstraint> dependencyConstraints;
110 private List<MustOccurConstraint> mustOccurConstraints;
111 private SimpleConstraint simpleConstraint;
112 private DataType dataType;
113
114
115 private Control control;
116
117 private KeyValuesFinder optionsFinder;
118
119 private boolean uppercaseValue;
120 private boolean disableNativeAutocomplete;
121
122 @DelayedCopy
123 private ValidationMessages validationMessages;
124
125
126 private String constraintText;
127 private String instructionalText;
128
129 private Message constraintMessage;
130 private Message instructionalMessage;
131
132 private String helperText;
133
134 private AttributeQuery attributeQuery;
135
136
137 private boolean enableAutoDirectInquiry;
138
139 private QuickFinder quickfinder;
140 private boolean enableAutoQuickfinder;
141
142 private Suggest suggest;
143
144 private boolean widgetInputOnly;
145
146 private boolean renderInputAddonGroup;
147 private List<String> postInputCssClasses;
148 private List<Component> postInputAddons;
149
150 public InputFieldBase() {
151 super();
152
153 simpleConstraint = new SimpleConstraint();
154
155 enableAutoDirectInquiry = true;
156 enableAutoQuickfinder = true;
157 }
158
159
160
161
162
163
164
165
166
167
168 @Override
169 public void performInitialization(Object model) {
170 super.performInitialization(model);
171
172 if ((StringUtils.isNotBlank(constraintText) || (getPropertyExpression("constraintText") != null)) && (
173 constraintMessage
174 == null)) {
175 constraintMessage = ComponentFactory.getConstraintMessage();
176 }
177
178 if ((StringUtils.isNotBlank(instructionalText) || (getPropertyExpression("instructionalText") != null)) && (
179 instructionalMessage
180 == null)) {
181 instructionalMessage = ComponentFactory.getInstructionalMessage();
182 }
183
184 }
185
186
187
188
189 @Override
190 public void performApplyModel(Object model, LifecycleElement parent) {
191 super.performApplyModel(model, parent);
192
193
194
195 if (StringUtils.isNotBlank(instructionalText) && instructionalMessage != null && StringUtils.isBlank(
196 instructionalMessage.getMessageText())) {
197 instructionalMessage.setMessageText(instructionalText);
198 }
199
200
201 if (StringUtils.isNotBlank(constraintText) && constraintMessage != null && StringUtils.isBlank(
202 constraintMessage.getMessageText())) {
203 constraintMessage.setMessageText(constraintText);
204 }
205
206
207 List<KeyValue> fieldOptions = new ArrayList<KeyValue>();
208
209
210 if ((control != null) && control instanceof MultiValueControlBase) {
211 MultiValueControlBase multiValueControl = (MultiValueControlBase) control;
212 if ((multiValueControl.getOptions() != null) && !multiValueControl.getOptions().isEmpty()) {
213 fieldOptions = multiValueControl.getOptions();
214 }
215 }
216
217
218 if (control instanceof TextAreaControl) {
219 setMultiLineReadOnlyDisplay(true);
220 }
221
222
223 if (fieldOptions.isEmpty() && (optionsFinder != null)) {
224 if (optionsFinder instanceof UifKeyValuesFinder) {
225 fieldOptions = ((UifKeyValuesFinder) optionsFinder).getKeyValues((ViewModel) model, this);
226
227
228 if (((UifKeyValuesFinder) optionsFinder).isAddBlankOption()) {
229 fieldOptions.add(0, new ConcreteKeyValue("", ""));
230 }
231 } else {
232 fieldOptions = optionsFinder.getKeyValues();
233 }
234
235 if ((control != null) && control instanceof MultiValueControlBase) {
236 ((MultiValueControlBase) control).setOptions(fieldOptions);
237 }
238 }
239
240 if (this.enableAutoDirectInquiry && (getInquiry() == null) && !isReadOnly()) {
241 buildAutomaticInquiry(model, true);
242 }
243
244 if (this.enableAutoQuickfinder && (getQuickfinder() == null)) {
245 buildAutomaticQuickfinder(model);
246 }
247
248
249 if (isReadOnly()
250 && !fieldOptions.isEmpty()
251 && StringUtils.isBlank(getReadOnlyDisplayReplacement())
252 && StringUtils.isBlank(getReadOnlyDisplaySuffix())
253 && StringUtils.isBlank(getReadOnlyDisplayReplacementPropertyName())
254 && StringUtils.isBlank(getReadOnlyDisplaySuffixPropertyName())) {
255
256 Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath());
257
258
259 if ((fieldValue != null) && (TypeUtils.isSimpleType(fieldValue.getClass()))) {
260 for (KeyValue keyValue : fieldOptions) {
261 if (StringUtils.equals(fieldValue.toString(), keyValue.getKey())) {
262 setReadOnlyDisplayReplacement(keyValue.getValue());
263 break;
264 }
265 }
266 }
267 }
268 }
269
270
271
272
273
274
275
276
277
278
279
280
281
282 @Override
283 public void performFinalize(Object model, LifecycleElement parent) {
284 super.performFinalize(model, parent);
285
286 setupIds();
287
288 this.addDataAttribute(UifConstants.DataAttributes.ROLE, UifConstants.RoleTypes.INPUT_FIELD);
289
290
291 if (isReadOnly() || getControl() == null) {
292 return;
293 }
294
295 if (StringUtils.isNotBlank(helperText) && (getControl() != null)) {
296 getControl().getCssClasses().add(CssConstants.Classes.HAS_HELPER);
297 }
298
299 DataDictionaryService dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
300 if (this.getDictionaryObjectEntry() != null && this.getDictionaryAttributeName() != null) {
301 AttributeDefinition ad = dataDictionaryService.getAttributeDefinition(this.getDictionaryObjectEntry(),
302 this.getDictionaryAttributeName());
303 if (ad.getForceUppercase() || uppercaseValue) {
304 Object currentPropertyValue = ObjectPropertyUtils.getPropertyValue(model,
305 getBindingInfo().getBindingPath());
306 if (currentPropertyValue instanceof String) {
307 String uppercasedValue = ((String) currentPropertyValue).toUpperCase();
308 ObjectPropertyUtils.setPropertyValue(model, getBindingInfo().getBindingPath(), uppercasedValue);
309 }
310 }
311 }
312
313
314 if ((suggest != null) && suggest.isSuggestConfigured()) {
315 setDisableNativeAutocomplete(true);
316 }
317
318
319 adjustPrerequisiteConstraintBinding(dependencyConstraints);
320
321
322 adjustMustOccurConstraintBinding(mustOccurConstraints);
323
324
325 if (caseConstraint != null) {
326 String propertyName = getBindingInfo().getPropertyAdjustedBindingPath(caseConstraint.getPropertyName());
327 caseConstraint.setPropertyName(propertyName);
328 }
329
330 setupFieldQuery();
331
332 View view = ViewLifecycle.getView();
333
334
335
336 String path = view.getStateObjectBindingPath();
337 Object stateObject;
338
339 if (StringUtils.isNotBlank(path)) {
340 stateObject = ObjectPropertyUtils.getPropertyValue(model, path);
341 } else {
342 stateObject = model;
343 }
344 StateMapping stateMapping = view.getStateMapping();
345 String nextStateReqIndicator = (String) KRADServiceLocatorWeb.getDataDictionaryService().getDictionaryBean(
346 UifConstants.REQUIRED_NEXT_STATE_INDICATOR_ID);
347
348 if (stateMapping != null) {
349 String validationState = ConstraintStateUtils.getClientViewValidationState(model, view);
350 SimpleConstraint appliedSimpleConstraint = ConstraintStateUtils.getApplicableConstraint(
351 this.getSimpleConstraint(), validationState, stateMapping);
352
353 if (appliedSimpleConstraint != null
354 && appliedSimpleConstraint.getRequired() != null
355 && appliedSimpleConstraint.getRequired()) {
356 SimpleConstraint prevConstraint = ConstraintStateUtils.getApplicableConstraint(
357 this.getSimpleConstraint(), stateMapping.getCurrentState(stateObject), stateMapping);
358 if (prevConstraint == null || prevConstraint.getRequired() == null || !prevConstraint.getRequired()) {
359 this.getFieldLabel().setRequiredIndicator(nextStateReqIndicator);
360 }
361 }
362 }
363
364 ClientValidationUtils.processAndApplyConstraints(this, view, model);
365
366
367 if (validationMessages != null) {
368 validationMessages.generateMessages(view, model, this);
369 }
370
371 addComponentPostMetadata();
372 }
373
374
375
376
377 protected void addComponentPostMetadata() {
378 ViewPostMetadata viewPostMetadata = ViewLifecycle.getViewPostMetadata();
379
380 viewPostMetadata.getInputFieldIds().add(this.getId());
381
382 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.LABEL, this.getLabel());
383
384 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.PATH, this.getName());
385
386 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.SIMPLE_CONSTRAINT,
387 this.getSimpleConstraint());
388
389 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.VALID_CHARACTER_CONSTRAINT,
390 this.getValidCharactersConstraint());
391
392 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.CASE_CONSTRAINT, this.getCaseConstraint());
393
394 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.MUST_OCCUR_CONSTRAINTS,
395 this.getMustOccurConstraints());
396
397 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.PREREQ_CONSTSTRAINTS,
398 this.getPrerequisiteConstraints());
399
400 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.INPUT_FIELD_ATTRIBUTE_QUERY,
401 attributeQuery);
402
403 if (this.suggest != null) {
404 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.SUGGEST, this.suggest.getPostData());
405 }
406
407 viewPostMetadata.addComponentPostData(this, UifConstants.PostMetadata.INPUT_FIELD_IS_UPPERCASE,
408 isUppercaseValue());
409
410 if ((isRender() || StringUtils.isNotBlank(getProgressiveRender())) && !isHidden() && !isReadOnly()) {
411 viewPostMetadata.addAccessibleBindingPath(getBindingInfo().getBindingPath());
412 }
413 }
414
415
416
417
418
419
420
421 protected void buildAutomaticQuickfinder(Object model) {
422 QuickFinder autoQuickfinder = ComponentFactory.getQuickFinder();
423
424
425 if (autoQuickfinder.isRender()) {
426 this.quickfinder = autoQuickfinder;
427 }
428 }
429
430
431
432
433
434
435
436
437
438 @Override
439 protected void processReadOnlyListDisplay(Object model, List<?> originalList) {
440
441 if ((control != null) && control instanceof MultiValueControlBase) {
442 List<String> newList = new ArrayList<String>();
443 List<KeyValue> fieldOptions = ((MultiValueControlBase) control).getOptions();
444
445 if (fieldOptions == null || fieldOptions.isEmpty()) {
446 return;
447 }
448
449 for (Object fieldValue : originalList) {
450 for (KeyValue keyValue : fieldOptions) {
451 if (fieldValue != null && StringUtils.equals(fieldValue.toString(), keyValue.getKey())) {
452 newList.add(keyValue.getValue());
453 break;
454 }
455 }
456 }
457 this.setReadOnlyDisplayReplacement(super.generateReadOnlyListDisplayReplacement(newList));
458 } else {
459 this.setReadOnlyDisplayReplacement(super.generateReadOnlyListDisplayReplacement(originalList));
460 }
461 }
462
463
464
465
466
467
468
469 @Override
470 protected void setAlternateAndAdditionalDisplayValue(View view, Object model) {
471
472 if (StringUtils.isNotBlank(getReadOnlyDisplayReplacement()) || StringUtils.isNotBlank(
473 getReadOnlyDisplaySuffix())) {
474 return;
475 }
476
477 if (isApplyMask()) {
478 if ((this.quickfinder != null) && StringUtils.isNotBlank(this.quickfinder.getDataObjectClassName())) {
479 setWidgetInputOnly(true);
480 } else {
481 setReadOnly(true);
482 }
483 }
484
485 super.setAlternateAndAdditionalDisplayValue(view, model);
486 }
487
488
489
490
491
492
493 protected void adjustMustOccurConstraintBinding(List<MustOccurConstraint> mustOccurConstraints) {
494 if (mustOccurConstraints != null) {
495 for (MustOccurConstraint mustOccurConstraint : mustOccurConstraints) {
496 adjustPrerequisiteConstraintBinding(mustOccurConstraint.getPrerequisiteConstraints());
497 adjustMustOccurConstraintBinding(mustOccurConstraint.getMustOccurConstraints());
498 }
499 }
500 }
501
502
503
504
505
506
507 protected void adjustPrerequisiteConstraintBinding(List<PrerequisiteConstraint> prerequisiteConstraints) {
508 if (prerequisiteConstraints != null) {
509 for (PrerequisiteConstraint prerequisiteConstraint : prerequisiteConstraints) {
510 String propertyName = getBindingInfo().getPropertyAdjustedBindingPath(
511 prerequisiteConstraint.getPropertyName());
512 prerequisiteConstraint.setPropertyName(propertyName);
513 }
514 }
515 }
516
517
518
519
520
521
522 protected void setupFieldQuery() {
523 if (getAttributeQuery() != null) {
524 getAttributeQuery().defaultQueryTarget(ViewLifecycle.getHelper());
525
526
527 getAttributeQuery().updateQueryFieldMapping(getBindingInfo());
528 getAttributeQuery().updateReturnFieldMapping(getBindingInfo());
529 getAttributeQuery().updateQueryMethodArgumentFieldList(getBindingInfo());
530
531
532 String script = "executeFieldQuery('" + getControl().getId() + "',";
533 script += "'" + getId() + "'," + getAttributeQuery().getQueryFieldMappingJsString() + ",";
534 script += getAttributeQuery().getQueryMethodArgumentFieldsJsString() + ",";
535 script += getAttributeQuery().getReturnFieldMappingJsString() + ");";
536
537
538 this.setRenderInfoMessageSpan(true);
539
540 if (StringUtils.isNotBlank(getControl().getOnBlurScript())) {
541 script = getControl().getOnBlurScript() + ";" + script;
542 }
543 getControl().setOnBlurScript(script);
544 }
545 }
546
547
548
549
550
551
552 protected void setupIds() {
553
554
555 setNestedComponentIdAndSuffix(getControl(), UifConstants.IdSuffixes.CONTROL);
556 setNestedComponentIdAndSuffix(getFieldLabel(), UifConstants.IdSuffixes.LABEL);
557 setNestedComponentIdAndSuffix(getInstructionalMessage(), UifConstants.IdSuffixes.INSTRUCTIONAL);
558 setNestedComponentIdAndSuffix(getConstraintMessage(), UifConstants.IdSuffixes.CONSTRAINT);
559 setNestedComponentIdAndSuffix(getQuickfinder(), UifConstants.IdSuffixes.QUICK_FINDER);
560 setNestedComponentIdAndSuffix(getSuggest(), UifConstants.IdSuffixes.SUGGEST);
561
562 if (this.getControl() != null) {
563 this.getControl().addDataAttribute(UifConstants.DataAttributes.CONTROL_FOR, this.getId());
564 }
565 }
566
567
568
569
570
571
572
573
574
575
576
577 @Override
578 public void copyFromAttributeDefinition(AttributeDefinition attributeDefinition) {
579 super.copyFromAttributeDefinition(attributeDefinition);
580
581
582 if (getMaxLength() == null) {
583 setMaxLength(attributeDefinition.getMaxLength());
584 }
585
586
587 if (getMinLength() == null) {
588 setMinLength(attributeDefinition.getMinLength());
589 }
590
591
592 if (getValidCharactersConstraint() == null) {
593 setValidCharactersConstraint(attributeDefinition.getValidCharactersConstraint());
594 }
595
596 if (getCaseConstraint() == null) {
597 setCaseConstraint(attributeDefinition.getCaseConstraint());
598 }
599
600 if (getDependencyConstraints() == null) {
601 setDependencyConstraints(attributeDefinition.getPrerequisiteConstraints());
602 }
603
604 if (getMustOccurConstraints() == null) {
605 setMustOccurConstraints(attributeDefinition.getMustOccurConstraints());
606 }
607
608
609 if (getRequired() == null) {
610 setRequired(attributeDefinition.isRequired());
611
612
613 if (getRequired() == null) {
614 setRequired(Boolean.FALSE);
615 }
616 }
617
618 if (getDataType() == null) {
619 setDataType(attributeDefinition.getDataType());
620
621 if (getDataType() == null
622 && control instanceof TextControl
623 && ((TextControl) control).getDatePicker() != null) {
624 setDataType(DataType.DATE);
625 }
626 }
627
628
629 if ((getControl() == null) && (attributeDefinition.getControlField() != null)) {
630 Control control = ComponentUtils.copy(attributeDefinition.getControlField());
631 setControl(control);
632 }
633
634
635 if (StringUtils.isEmpty(getConstraintText())) {
636 setConstraintText(attributeDefinition.getConstraintText());
637
638 if (constraintMessage == null) {
639 constraintMessage = ComponentFactory.getConstraintMessage();
640 }
641
642 getConstraintMessage().setMessageText(attributeDefinition.getConstraintText());
643 }
644
645
646 if (getOptionsFinder() == null) {
647 setOptionsFinder(attributeDefinition.getOptionsFinder());
648 }
649
650
651
652 if (this.getSimpleConstraint().getConstraintStateOverrides() == null) {
653 this.getSimpleConstraint().setConstraintStateOverrides(
654 attributeDefinition.getSimpleConstraint().getConstraintStateOverrides());
655 }
656
657 if (this.getSimpleConstraint().getStates().isEmpty()) {
658 this.getSimpleConstraint().setStates(attributeDefinition.getSimpleConstraint().getStates());
659 }
660
661 if (this.getSimpleConstraint().getMessageKey() == null) {
662 this.getSimpleConstraint().setMessageKey(attributeDefinition.getSimpleConstraint().getMessageKey());
663 }
664
665 if (this.getSimpleConstraint().getApplyClientSide() == null) {
666 this.getSimpleConstraint().setApplyClientSide(
667 attributeDefinition.getSimpleConstraint().getApplyClientSide());
668 }
669
670 if (this.getSimpleConstraint().getValidationMessageParams() == null) {
671 this.getSimpleConstraint().setValidationMessageParams(
672 attributeDefinition.getSimpleConstraint().getValidationMessageParams());
673 }
674 }
675
676
677
678
679 @Override
680 public boolean isInputAllowed() {
681 return true;
682 }
683
684
685
686
687
688
689
690
691
692
693
694
695
696 @BeanTagAttribute(name = "control", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
697 public Control getControl() {
698 return this.control;
699 }
700
701
702
703
704
705
706 public void setControl(Control control) {
707 this.control = control;
708 }
709
710
711
712
713
714
715
716
717 @ViewLifecycleRestriction
718 @BeanTagAttribute(name = "validationMessages", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
719 public ValidationMessages getValidationMessages() {
720 return this.validationMessages;
721 }
722
723
724
725
726
727
728 public void setValidationMessages(ValidationMessages validationMessages) {
729 this.validationMessages = validationMessages;
730 }
731
732
733
734
735
736
737
738
739
740 @BeanTagAttribute(name = "optionsFinder", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
741 public KeyValuesFinder getOptionsFinder() {
742 return this.optionsFinder;
743 }
744
745
746
747
748
749
750 public void setOptionsFinder(KeyValuesFinder optionsFinder) {
751 this.optionsFinder = optionsFinder;
752 }
753
754
755
756
757
758
759 @BeanTagAttribute(name = "optionsFinderClass")
760 public Class<? extends KeyValuesFinder> getOptionsFinderClass() {
761 if (this.optionsFinder != null) {
762 return this.optionsFinder.getClass();
763 } else {
764 return null;
765 }
766 }
767
768
769
770
771
772
773
774 public void setOptionsFinderClass(Class<? extends KeyValuesFinder> optionsFinderClass) {
775 this.optionsFinder = KRADUtils.createNewObjectFromClass(optionsFinderClass);
776 }
777
778
779
780
781
782
783
784
785
786
787
788
789 public boolean isEnableAutoDirectInquiry() {
790 return enableAutoDirectInquiry;
791 }
792
793
794
795
796
797
798 public void setEnableAutoDirectInquiry(boolean enableAutoDirectInquiry) {
799 this.enableAutoDirectInquiry = enableAutoDirectInquiry;
800 }
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816 @BeanTagAttribute(name = "quickfinder", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
817 public QuickFinder getQuickfinder() {
818 return this.quickfinder;
819 }
820
821
822
823
824
825
826 public void setQuickfinder(QuickFinder quickfinder) {
827 this.quickfinder = quickfinder;
828 }
829
830
831
832
833
834
835
836
837
838
839
840
841 public boolean isEnableAutoQuickfinder() {
842 return enableAutoQuickfinder;
843 }
844
845
846
847
848
849
850 public void setEnableAutoQuickfinder(boolean enableAutoQuickfinder) {
851 this.enableAutoQuickfinder = enableAutoQuickfinder;
852 }
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869 @BeanTagAttribute(name = "suggest", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
870 public Suggest getSuggest() {
871 return suggest;
872 }
873
874
875
876
877
878
879 public void setSuggest(Suggest suggest) {
880 this.suggest = suggest;
881 }
882
883
884
885
886
887
888
889
890
891 @BeanTagAttribute(name = "widgetInputOnly")
892 public boolean isWidgetInputOnly() {
893 return this.widgetInputOnly;
894 }
895
896
897
898
899
900
901 public void setWidgetInputOnly(boolean widgetInputOnly) {
902 this.widgetInputOnly = widgetInputOnly;
903 }
904
905
906
907
908
909
910
911
912
913
914 public boolean isRenderInputAddonGroup() {
915 return renderInputAddonGroup;
916 }
917
918
919
920
921 public void setRenderInputAddonGroup(boolean renderInputAddonGroup) {
922 this.renderInputAddonGroup = renderInputAddonGroup;
923 }
924
925
926
927
928
929
930
931
932 public List<String> getPostInputCssClasses() {
933 return postInputCssClasses;
934 }
935
936
937
938
939
940
941 public String getPostInputCssClassesAsString() {
942 if (postInputCssClasses != null) {
943 return StringUtils.join(postInputCssClasses, " ");
944 }
945
946 return "";
947 }
948
949
950
951
952 public void setPostInputCssClasses(List<String> postInputCssClasses) {
953 this.postInputCssClasses = postInputCssClasses;
954 }
955
956
957
958
959
960
961
962
963
964
965 public List<Component> getPostInputAddons() {
966 return postInputAddons;
967 }
968
969
970
971
972 public void setPostInputAddons(List<Component> postInputAddons) {
973 this.postInputAddons = postInputAddons;
974 }
975
976
977
978
979
980
981
982 public void addPostInputAddon(Component addOn) {
983 if (postInputAddons == null) {
984 postInputAddons = new ArrayList<Component>();
985 }
986
987 postInputAddons.add(addOn);
988 }
989
990
991
992
993
994
995
996
997
998
999
1000 @BeanTagAttribute(name = "instructionalText")
1001 public String getInstructionalText() {
1002 return this.instructionalText;
1003 }
1004
1005
1006
1007
1008
1009
1010 public void setInstructionalText(String instructionalText) {
1011 this.instructionalText = instructionalText;
1012 }
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024 @BeanTagAttribute(name = "instructionalMessage", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1025 public Message getInstructionalMessage() {
1026 return this.instructionalMessage;
1027 }
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039 public void setInstructionalMessage(Message instructionalMessage) {
1040 this.instructionalMessage = instructionalMessage;
1041 }
1042
1043
1044
1045
1046
1047
1048 public String getHelperText() {
1049 return helperText;
1050 }
1051
1052
1053
1054
1055 public void setHelperText(String helperText) {
1056 this.helperText = helperText;
1057 }
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070 @BeanTagAttribute(name = "constraintText")
1071 public String getConstraintText() {
1072 return this.constraintText;
1073 }
1074
1075
1076
1077
1078
1079
1080 public void setConstraintText(String constraintText) {
1081 this.constraintText = constraintText;
1082 }
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094 @BeanTagAttribute(name = "constraintMessage", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1095 public Message getConstraintMessage() {
1096 return this.constraintMessage;
1097 }
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109 public void setConstraintMessage(Message constraintMessage) {
1110 this.constraintMessage = constraintMessage;
1111 }
1112
1113
1114
1115
1116
1117
1118 @Override
1119 @BeanTagAttribute(name = "validCharactersConstraint", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1120 public ValidCharactersConstraint getValidCharactersConstraint() {
1121 return this.validCharactersConstraint;
1122 }
1123
1124
1125
1126
1127
1128
1129 public void setValidCharactersConstraint(ValidCharactersConstraint validCharactersConstraint) {
1130 this.validCharactersConstraint = validCharactersConstraint;
1131 }
1132
1133
1134
1135
1136
1137
1138 @Override
1139 @BeanTagAttribute(name = "caseConstraint", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1140 public CaseConstraint getCaseConstraint() {
1141 return this.caseConstraint;
1142 }
1143
1144
1145
1146
1147
1148
1149 public void setCaseConstraint(CaseConstraint caseConstraint) {
1150 this.caseConstraint = caseConstraint;
1151 }
1152
1153
1154
1155
1156
1157
1158 @BeanTagAttribute(name = "dependencyConstraints", type = BeanTagAttribute.AttributeType.LISTBEAN)
1159 public List<PrerequisiteConstraint> getDependencyConstraints() {
1160 return this.dependencyConstraints;
1161 }
1162
1163
1164
1165
1166
1167
1168 public void setDependencyConstraints(List<PrerequisiteConstraint> dependencyConstraints) {
1169 this.dependencyConstraints = dependencyConstraints;
1170 }
1171
1172 @Override
1173 public List<PrerequisiteConstraint> getPrerequisiteConstraints() {
1174 return dependencyConstraints;
1175 }
1176
1177
1178
1179
1180
1181
1182 @Override
1183 @BeanTagAttribute(name = "mustOccurConstraints", type = BeanTagAttribute.AttributeType.LISTBEAN)
1184 public List<MustOccurConstraint> getMustOccurConstraints() {
1185 return this.mustOccurConstraints;
1186 }
1187
1188
1189
1190
1191
1192
1193 public void setMustOccurConstraints(List<MustOccurConstraint> mustOccurConstraints) {
1194 this.mustOccurConstraints = mustOccurConstraints;
1195 }
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207 @Override
1208 @BeanTagAttribute(name = "simpleConstraint", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1209 public SimpleConstraint getSimpleConstraint() {
1210 return this.simpleConstraint;
1211 }
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224 public void setSimpleConstraint(SimpleConstraint simpleConstraint) {
1225 this.simpleConstraint = simpleConstraint;
1226 }
1227
1228
1229
1230
1231
1232
1233
1234 public void setDataType(DataType dataType) {
1235 this.simpleConstraint.setDataType(dataType);
1236 }
1237
1238 public void setDataType(String dataType) {
1239 this.simpleConstraint.setDataType(DataType.valueOf(dataType));
1240 }
1241
1242
1243
1244
1245
1246
1247
1248
1249 @BeanTagAttribute(name = "dataType", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1250 public DataType getDataType() {
1251 return this.simpleConstraint.getDataType();
1252 }
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267 @BeanTagAttribute(name = "maxLength")
1268 public Integer getMaxLength() {
1269 return simpleConstraint.getMaxLength();
1270 }
1271
1272
1273
1274
1275
1276
1277 public void setMaxLength(Integer maxLength) {
1278 simpleConstraint.setMaxLength(maxLength);
1279 }
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293 @BeanTagAttribute(name = "minLength")
1294 public Integer getMinLength() {
1295 return simpleConstraint.getMinLength();
1296 }
1297
1298
1299
1300
1301
1302
1303 public void setMinLength(Integer minLength) {
1304 simpleConstraint.setMinLength(minLength);
1305 }
1306
1307
1308
1309
1310 @Override
1311 @BeanTagAttribute(name = "required")
1312 public Boolean getRequired() {
1313 return this.simpleConstraint.getRequired();
1314 }
1315
1316
1317
1318
1319 @Override
1320 public void setRequired(Boolean required) {
1321 this.simpleConstraint.setRequired(required);
1322 }
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338 @BeanTagAttribute(name = "exclusiveMin")
1339 public String getExclusiveMin() {
1340 return simpleConstraint.getExclusiveMin();
1341 }
1342
1343
1344
1345
1346
1347
1348 public void setExclusiveMin(String exclusiveMin) {
1349 simpleConstraint.setExclusiveMin(exclusiveMin);
1350 }
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366 @BeanTagAttribute(name = "inclusiveMax")
1367 public String getInclusiveMax() {
1368 return simpleConstraint.getInclusiveMax();
1369 }
1370
1371
1372
1373
1374
1375
1376 public void setInclusiveMax(String inclusiveMax) {
1377 simpleConstraint.setInclusiveMax(inclusiveMax);
1378 }
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394 @BeanTagAttribute(name = "attributeQuery", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1395 public AttributeQuery getAttributeQuery() {
1396 return attributeQuery;
1397 }
1398
1399
1400
1401
1402
1403
1404 public void setAttributeQuery(AttributeQuery attributeQuery) {
1405 this.attributeQuery = attributeQuery;
1406 }
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418 @BeanTagAttribute(name = "uppercaseValue")
1419 public boolean isUppercaseValue() {
1420 return uppercaseValue;
1421 }
1422
1423
1424
1425
1426
1427
1428 public void setUppercaseValue(boolean uppercaseValue) {
1429 this.uppercaseValue = uppercaseValue;
1430 }
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443 public boolean isDisableNativeAutocomplete() {
1444 return disableNativeAutocomplete;
1445 }
1446
1447
1448
1449
1450
1451
1452 public void setDisableNativeAutocomplete(boolean disableNativeAutocomplete) {
1453 this.disableNativeAutocomplete = disableNativeAutocomplete;
1454 }
1455
1456 @Override
1457 public boolean isRenderFieldset() {
1458 return super.isRenderFieldset() || (quickfinder != null
1459 && quickfinder.isRender()
1460 && quickfinder.getQuickfinderAction() != null
1461 && quickfinder.getQuickfinderAction().isRender());
1462 }
1463
1464
1465
1466
1467 @Override
1468 public void completeValidation(ValidationTrace tracer) {
1469 tracer.addBean(this);
1470
1471
1472 if (getControl() == null) {
1473 if (Validator.checkExpressions(this, "control")) {
1474 String currentValues[] = {"control =" + getConstraintText()};
1475 tracer.createWarning("Control should be set", currentValues);
1476 }
1477 }
1478
1479 super.completeValidation(tracer.getCopy());
1480 }
1481
1482 public void setCustomValidatorClass(String customValidatorClass) {
1483 this.customValidatorClass = customValidatorClass;
1484 }
1485 }