Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AttributeField |
|
| 1.492063492063492;1.492 |
1 | /* | |
2 | * Copyright 2007 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 1.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl1.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kns.uif.field; | |
17 | ||
18 | import java.util.List; | |
19 | ||
20 | import org.apache.commons.lang.StringUtils; | |
21 | import org.kuali.rice.core.web.format.Formatter; | |
22 | import org.kuali.rice.kns.datadictionary.AttributeDefinition; | |
23 | import org.kuali.rice.kns.datadictionary.AttributeSecurity; | |
24 | import org.kuali.rice.kns.datadictionary.validation.constraint.CaseConstraint; | |
25 | import org.kuali.rice.kns.datadictionary.validation.constraint.MustOccurConstraint; | |
26 | import org.kuali.rice.kns.datadictionary.validation.constraint.PrerequisiteConstraint; | |
27 | import org.kuali.rice.kns.datadictionary.validation.constraint.SimpleConstraint; | |
28 | import org.kuali.rice.kns.datadictionary.validation.constraint.ValidCharactersConstraint; | |
29 | import org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder; | |
30 | import org.kuali.rice.kns.uif.UifConstants; | |
31 | import org.kuali.rice.kns.uif.container.View; | |
32 | import org.kuali.rice.kns.uif.control.Control; | |
33 | import org.kuali.rice.kns.uif.control.MultiValueControlBase; | |
34 | import org.kuali.rice.kns.uif.core.BindingInfo; | |
35 | import org.kuali.rice.kns.uif.core.Component; | |
36 | import org.kuali.rice.kns.uif.core.DataBinding; | |
37 | import org.kuali.rice.kns.uif.util.ClientValidationUtils; | |
38 | import org.kuali.rice.kns.uif.widget.Inquiry; | |
39 | import org.kuali.rice.kns.uif.widget.QuickFinder; | |
40 | ||
41 | /** | |
42 | * Field that encapsulates data input/output captured by an attribute within the | |
43 | * application | |
44 | * | |
45 | * <p> | |
46 | * The <code>AttributField</code> provides the majority of the data input/output | |
47 | * for the screen. Through these fields the model can be displayed and updated. | |
48 | * For data input, the field contains a <code>Control</code> instance will | |
49 | * render an HTML control element(s). The attribute field also contains a | |
50 | * <code>LabelField</code>, summary, and widgets such as a quickfinder (for | |
51 | * looking up values) and inquiry (for getting more information on the value). | |
52 | * <code>AttributeField</code> instances can have associated messages (errors) | |
53 | * due to invalid input or business rule failures. Security can also be | |
54 | * configured to restrict who may view the fields value. | |
55 | * </p> | |
56 | * | |
57 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
58 | */ | |
59 | public class AttributeField extends FieldBase implements DataBinding { | |
60 | private static final long serialVersionUID = -3703656713706343840L; | |
61 | ||
62 | // value props | |
63 | private String defaultValue; | |
64 | ||
65 | // Constraint variables | |
66 | protected String customValidatorClass; | |
67 | protected ValidCharactersConstraint validCharactersConstraint; | |
68 | protected CaseConstraint caseConstraint; | |
69 | protected List<PrerequisiteConstraint> dependencyConstraints; | |
70 | protected List<MustOccurConstraint> mustOccurConstraints; | |
71 | protected SimpleConstraint simpleConstraint; | |
72 | ||
73 | private Formatter formatter; | |
74 | private KeyValuesFinder optionsFinder; | |
75 | ||
76 | // binding | |
77 | private String propertyName; | |
78 | private BindingInfo bindingInfo; | |
79 | ||
80 | private String dictionaryAttributeName; | |
81 | private String dictionaryObjectEntry; | |
82 | ||
83 | // display props | |
84 | private Control control; | |
85 | ||
86 | private String errorMessagePlacement; | |
87 | private ErrorsField errorsField; | |
88 | ||
89 | // messages | |
90 | private String summary; | |
91 | private String constraint; | |
92 | ||
93 | private String description; | |
94 | ||
95 | private AttributeSecurity attributeSecurity; | |
96 | private MessageField summaryMessageField; | |
97 | private MessageField constraintMessageField; | |
98 | ||
99 | // widgets | |
100 | private Inquiry fieldInquiry; | |
101 | private QuickFinder fieldLookup; | |
102 | ||
103 | public AttributeField() { | |
104 | 0 | super(); |
105 | 0 | simpleConstraint = new SimpleConstraint(); |
106 | 0 | } |
107 | ||
108 | /** | |
109 | * <p> | |
110 | * The following initialization is performed: | |
111 | * <ul> | |
112 | * <li>Set defaults for binding</li> | |
113 | * <li>Default the model path if not set</li> | |
114 | * </ul> | |
115 | * </p> | |
116 | * | |
117 | * @see org.kuali.rice.kns.uif.core.ComponentBase#performInitialization(org.kuali.rice.kns.uif.container.View) | |
118 | */ | |
119 | @Override | |
120 | public void performInitialization(View view) { | |
121 | 0 | super.performInitialization(view); |
122 | ||
123 | 0 | if (bindingInfo != null) { |
124 | 0 | bindingInfo.setDefaults(view, getPropertyName()); |
125 | } | |
126 | ||
127 | // TODO: remove later, this should be done within the service lifecycle | |
128 | 0 | if ((optionsFinder != null) && (control != null) && control instanceof MultiValueControlBase) { |
129 | 0 | MultiValueControlBase multiValueControl = (MultiValueControlBase) control; |
130 | 0 | if ((multiValueControl.getOptions() == null) || multiValueControl.getOptions().isEmpty()) { |
131 | 0 | multiValueControl.setOptions(optionsFinder.getKeyValues()); |
132 | } | |
133 | } | |
134 | 0 | } |
135 | ||
136 | /** | |
137 | * The following actions are performed: | |
138 | * <ul> | |
139 | * <li>Sets up the client side validation for constraints on this field. In | |
140 | * addition, it sets up the messages applied to this field</li> | |
141 | * <li>Set the ids for the various attribute components</li> | |
142 | * </ul> | |
143 | * | |
144 | * @see org.kuali.rice.kns.uif.core.ComponentBase#performFinalize(org.kuali.rice.kns.uif.container.View, | |
145 | * java.lang.Object, org.kuali.rice.kns.uif.core.Component) | |
146 | */ | |
147 | @Override | |
148 | public void performFinalize(View view, Object model, Component parent) { | |
149 | 0 | super.performFinalize(view, model, parent); |
150 | ||
151 | 0 | setupIds(); |
152 | ||
153 | // Sets message | |
154 | 0 | if (StringUtils.isNotBlank(summary)) { |
155 | 0 | summaryMessageField.setMessageText(summary); |
156 | } | |
157 | ||
158 | // Sets constraints | |
159 | 0 | if (StringUtils.isNotBlank(constraint)) { |
160 | 0 | constraintMessageField.setMessageText(constraint); |
161 | } | |
162 | ||
163 | // if read only or the control is not set no need to set client side | |
164 | // validation | |
165 | 0 | if (isReadOnly() || getControl() == null) { |
166 | 0 | return; |
167 | } | |
168 | ||
169 | 0 | ClientValidationUtils.processAndApplyConstraints(this, view); |
170 | 0 | } |
171 | ||
172 | /** | |
173 | * Sets the ids on all components the attribute field uses so they will all | |
174 | * contain this attribute's id in their ids. This is useful for jQuery | |
175 | * manipulation. | |
176 | */ | |
177 | private void setupIds() { | |
178 | // update ids so they all match the attribute | |
179 | 0 | String id = getId(); |
180 | 0 | if (getControl() != null) { |
181 | 0 | getControl().setId(id); |
182 | } | |
183 | 0 | if (getErrorsField() != null) { |
184 | 0 | getErrorsField().setId(id + UifConstants.IdSuffixes.ERRORS); |
185 | } | |
186 | 0 | if (getLabelField() != null) { |
187 | 0 | getLabelField().setId(id + UifConstants.IdSuffixes.LABEL); |
188 | } | |
189 | 0 | if (getSummaryMessageField() != null) { |
190 | 0 | getSummaryMessageField().setId(id + UifConstants.IdSuffixes.SUMMARY); |
191 | } | |
192 | 0 | if (getConstraintMessageField() != null) { |
193 | 0 | getConstraintMessageField().setId(id + UifConstants.IdSuffixes.CONSTRAINT); |
194 | } | |
195 | 0 | if (getFieldLookup() != null) { |
196 | 0 | getFieldLookup().setId(id + UifConstants.IdSuffixes.QUICK_FINDER); |
197 | } | |
198 | 0 | setId(id + UifConstants.IdSuffixes.ATTRIBUTE); |
199 | 0 | } |
200 | ||
201 | /** | |
202 | * Defaults the properties of the <code>AttributeField</code> to the | |
203 | * corresponding properties of its <code>AttributeDefinition</code> | |
204 | * retrieved from the dictionary (if such an entry exists). If the field | |
205 | * already contains a value for a property, the definitions value is not | |
206 | * used. | |
207 | * | |
208 | * @param attributeDefinition | |
209 | * - AttributeDefinition instance the property values should be | |
210 | * copied from | |
211 | */ | |
212 | public void copyFromAttributeDefinition(AttributeDefinition attributeDefinition) { | |
213 | // label | |
214 | 0 | if (StringUtils.isEmpty(getLabel())) { |
215 | 0 | setLabel(attributeDefinition.getLabel()); |
216 | } | |
217 | ||
218 | // short label | |
219 | 0 | if (StringUtils.isEmpty(getShortLabel())) { |
220 | 0 | setShortLabel(attributeDefinition.getShortLabel()); |
221 | } | |
222 | ||
223 | // max length | |
224 | 0 | if (getMaxLength() == null) { |
225 | 0 | setMaxLength(attributeDefinition.getMaxLength()); |
226 | } | |
227 | ||
228 | // max length | |
229 | 0 | if (getMinLength() == null) { |
230 | 0 | setMinLength(attributeDefinition.getMinLength()); |
231 | } | |
232 | ||
233 | // valid characters | |
234 | 0 | if (getValidCharactersConstraint() == null) { |
235 | 0 | setValidCharactersConstraint(attributeDefinition.getValidCharactersConstraint()); |
236 | } | |
237 | ||
238 | 0 | if (getCaseConstraint() == null) { |
239 | 0 | setCaseConstraint(attributeDefinition.getCaseConstraint()); |
240 | } | |
241 | ||
242 | 0 | if (getDependencyConstraints() == null) { |
243 | 0 | setDependencyConstraints(attributeDefinition.getPrerequisiteConstraints()); |
244 | } | |
245 | ||
246 | 0 | if (getMustOccurConstraints() == null) { |
247 | 0 | setMustOccurConstraints(attributeDefinition.getMustOccurConstraints()); |
248 | } | |
249 | ||
250 | // required | |
251 | 0 | if (getRequired() == null) { |
252 | 0 | setRequired(attributeDefinition.isRequired()); |
253 | } | |
254 | ||
255 | // control | |
256 | 0 | if (getControl() == null) { |
257 | 0 | setControl(attributeDefinition.getControlField()); |
258 | } | |
259 | ||
260 | // summary | |
261 | 0 | if (StringUtils.isEmpty(getSummary())) { |
262 | 0 | setSummary(attributeDefinition.getSummary()); |
263 | 0 | getSummaryMessageField().setMessageText(attributeDefinition.getSummary()); |
264 | } | |
265 | ||
266 | // description | |
267 | 0 | if (StringUtils.isEmpty(getDescription())) { |
268 | 0 | setDescription(attributeDefinition.getDescription()); |
269 | } | |
270 | ||
271 | // security | |
272 | 0 | if (getAttributeSecurity() == null) { |
273 | 0 | setAttributeSecurity(attributeDefinition.getAttributeSecurity()); |
274 | } | |
275 | ||
276 | // constraint | |
277 | 0 | if (StringUtils.isEmpty(getConstraint())) { |
278 | 0 | setConstraint(attributeDefinition.getConstraint()); |
279 | 0 | getConstraintMessageField().setMessageText(attributeDefinition.getConstraint()); |
280 | } | |
281 | ||
282 | 0 | } |
283 | ||
284 | /** | |
285 | * @see org.kuali.rice.kns.uif.core.ComponentBase#getNestedComponents() | |
286 | */ | |
287 | @Override | |
288 | public List<Component> getNestedComponents() { | |
289 | 0 | List<Component> components = super.getNestedComponents(); |
290 | ||
291 | 0 | components.add(control); |
292 | 0 | components.add(errorsField); |
293 | 0 | components.add(fieldLookup); |
294 | 0 | components.add(fieldInquiry); |
295 | ||
296 | 0 | return components; |
297 | } | |
298 | ||
299 | /** | |
300 | * @see org.kuali.rice.kns.uif.core.DataBinding#getPropertyName() | |
301 | */ | |
302 | public String getPropertyName() { | |
303 | 0 | return this.propertyName; |
304 | } | |
305 | ||
306 | /** | |
307 | * Setter for the component's property name | |
308 | * | |
309 | * @param propertyName | |
310 | */ | |
311 | public void setPropertyName(String propertyName) { | |
312 | 0 | this.propertyName = propertyName; |
313 | 0 | } |
314 | ||
315 | /** | |
316 | * Default value for the model property the field points to | |
317 | * | |
318 | * <p> | |
319 | * When a new <code>View</code> instance is requested, the corresponding | |
320 | * model will be newly created. During this initialization process the value | |
321 | * for the model property will be set to the given default value (if set) | |
322 | * </p> | |
323 | * | |
324 | * @return String default value | |
325 | */ | |
326 | public String getDefaultValue() { | |
327 | 0 | return this.defaultValue; |
328 | } | |
329 | ||
330 | /** | |
331 | * Setter for the fields default value | |
332 | * | |
333 | * @param defaultValue | |
334 | */ | |
335 | public void setDefaultValue(String defaultValue) { | |
336 | 0 | this.defaultValue = defaultValue; |
337 | 0 | } |
338 | ||
339 | /** | |
340 | * <code>Formatter</code> instance that should be used when displaying and | |
341 | * accepting the field's value in the user interface | |
342 | * | |
343 | * <p> | |
344 | * Formatters can provide conversion between datatypes in addition to | |
345 | * special string formatting such as currency display | |
346 | * </p> | |
347 | * | |
348 | * @return Formatter instance | |
349 | * @see org.kuali.rice.kns.web.format.Formatter | |
350 | */ | |
351 | public Formatter getFormatter() { | |
352 | 0 | return this.formatter; |
353 | } | |
354 | ||
355 | /** | |
356 | * Setter for the field's formatter | |
357 | * | |
358 | * @param formatter | |
359 | */ | |
360 | public void setFormatter(Formatter formatter) { | |
361 | 0 | this.formatter = formatter; |
362 | 0 | } |
363 | ||
364 | /** | |
365 | * @see org.kuali.rice.kns.uif.core.DataBinding#getBindingInfo() | |
366 | */ | |
367 | public BindingInfo getBindingInfo() { | |
368 | 0 | return this.bindingInfo; |
369 | } | |
370 | ||
371 | /** | |
372 | * Setter for the field's binding info | |
373 | * | |
374 | * @param bindingInfo | |
375 | */ | |
376 | public void setBindingInfo(BindingInfo bindingInfo) { | |
377 | 0 | this.bindingInfo = bindingInfo; |
378 | 0 | } |
379 | ||
380 | /** | |
381 | * <code>Control</code> instance that should be used to input data for the | |
382 | * field | |
383 | * | |
384 | * <p> | |
385 | * When the field is editable, the control will be rendered so the user can | |
386 | * input a value(s). Controls typically are part of a Form and render | |
387 | * standard HTML control elements such as text input, select, and checkbox | |
388 | * </p> | |
389 | * | |
390 | * @return Control instance | |
391 | */ | |
392 | public Control getControl() { | |
393 | 0 | return this.control; |
394 | } | |
395 | ||
396 | /** | |
397 | * Setter for the field's control | |
398 | * | |
399 | * @param control | |
400 | */ | |
401 | public void setControl(Control control) { | |
402 | 0 | this.control = control; |
403 | 0 | } |
404 | ||
405 | public String getErrorMessagePlacement() { | |
406 | 0 | return this.errorMessagePlacement; |
407 | } | |
408 | ||
409 | public void setErrorMessagePlacement(String errorMessagePlacement) { | |
410 | 0 | this.errorMessagePlacement = errorMessagePlacement; |
411 | 0 | } |
412 | ||
413 | /** | |
414 | * Field that contains the messages (errors) for the attribute field. The | |
415 | * <code>ErrorsField</code> holds configuration on associated messages along | |
416 | * with information on rendering the messages in the user interface | |
417 | * | |
418 | * @return ErrorsField instance | |
419 | */ | |
420 | public ErrorsField getErrorsField() { | |
421 | 0 | return this.errorsField; |
422 | } | |
423 | ||
424 | /** | |
425 | * Setter for the attribute field's errors field | |
426 | * | |
427 | * @param errorsField | |
428 | */ | |
429 | public void setErrorsField(ErrorsField errorsField) { | |
430 | 0 | this.errorsField = errorsField; |
431 | 0 | } |
432 | ||
433 | /** | |
434 | * Name of the attribute within the data dictionary the attribute field is | |
435 | * associated with | |
436 | * | |
437 | * <p> | |
438 | * During the initialize phase for the <code>View</code>, properties for | |
439 | * attribute fields are defaulted from a corresponding | |
440 | * <code>AttributeDefinition</code> in the data dictionary. Based on the | |
441 | * propertyName and parent object class the framework attempts will | |
442 | * determine the attribute definition that is associated with the field and | |
443 | * set this property. However this property can also be set in the fields | |
444 | * configuration to use another dictionary attribute. | |
445 | * </p> | |
446 | * <p> | |
447 | * The attribute name is used along with the dictionary object entry to find | |
448 | * the <code>AttributeDefinition</code> | |
449 | * </p> | |
450 | * | |
451 | * @return String attribute name | |
452 | */ | |
453 | public String getDictionaryAttributeName() { | |
454 | 0 | return this.dictionaryAttributeName; |
455 | } | |
456 | ||
457 | /** | |
458 | * Setter for the dictionary attribute name | |
459 | * | |
460 | * @param dictionaryAttributeName | |
461 | */ | |
462 | public void setDictionaryAttributeName(String dictionaryAttributeName) { | |
463 | 0 | this.dictionaryAttributeName = dictionaryAttributeName; |
464 | 0 | } |
465 | ||
466 | /** | |
467 | * Object entry name in the data dictionary the associated attribute is | |
468 | * apart of | |
469 | * | |
470 | * <p> | |
471 | * During the initialize phase for the <code>View</code>, properties for | |
472 | * attribute fields are defaulted from a corresponding | |
473 | * <code>AttributeDefinition</code> in the data dictionary. Based on the | |
474 | * parent object class the framework will determine the object entry for the | |
475 | * associated attribute. However the object entry can be set in the field's | |
476 | * configuration to use another object entry for the attribute | |
477 | * </p> | |
478 | * | |
479 | * <p> | |
480 | * The attribute name is used along with the dictionary object entry to find | |
481 | * the <code>AttributeDefinition</code> | |
482 | * </p> | |
483 | * | |
484 | * @return | |
485 | */ | |
486 | public String getDictionaryObjectEntry() { | |
487 | 0 | return this.dictionaryObjectEntry; |
488 | } | |
489 | ||
490 | /** | |
491 | * Setter for the dictionary object entry | |
492 | * | |
493 | * @param dictionaryObjectEntry | |
494 | */ | |
495 | public void setDictionaryObjectEntry(String dictionaryObjectEntry) { | |
496 | 0 | this.dictionaryObjectEntry = dictionaryObjectEntry; |
497 | 0 | } |
498 | ||
499 | /** | |
500 | * Instance of <code>KeyValluesFinder</code> that should be invoked to | |
501 | * provide a List of values the field can have. Generally used to provide | |
502 | * the options for a multi-value control or to validate the submitted field | |
503 | * value | |
504 | * | |
505 | * @return KeyValuesFinder instance | |
506 | */ | |
507 | public KeyValuesFinder getOptionsFinder() { | |
508 | 0 | return this.optionsFinder; |
509 | } | |
510 | ||
511 | /** | |
512 | * Setter for the field's KeyValuesFinder instance | |
513 | * | |
514 | * @param optionsFinder | |
515 | */ | |
516 | public void setOptionsFinder(KeyValuesFinder optionsFinder) { | |
517 | 0 | this.optionsFinder = optionsFinder; |
518 | 0 | } |
519 | ||
520 | /** | |
521 | * Brief statement of the field (attribute) purpose. Used to display helpful | |
522 | * information to the user on the form | |
523 | * | |
524 | * @return String summary message | |
525 | */ | |
526 | public String getSummary() { | |
527 | 0 | return this.summary; |
528 | } | |
529 | ||
530 | /** | |
531 | * Setter for the summary message | |
532 | * | |
533 | * @param summary | |
534 | */ | |
535 | public void setSummary(String summary) { | |
536 | 0 | this.summary = summary; |
537 | 0 | } |
538 | ||
539 | /** | |
540 | * Full explanation of the field (attribute). Used in help contents | |
541 | * | |
542 | * @return String description message | |
543 | */ | |
544 | public String getDescription() { | |
545 | 0 | return this.description; |
546 | } | |
547 | ||
548 | /** | |
549 | * Setter for the description message | |
550 | * | |
551 | * @param description | |
552 | */ | |
553 | public void setDescription(String description) { | |
554 | 0 | this.description = description; |
555 | 0 | } |
556 | ||
557 | /** | |
558 | * Holds security configuration for the attribute field. This triggers | |
559 | * corresponding permission checks in KIM and can result in an update to the | |
560 | * field state (such as read-only or hidden) and masking of the value | |
561 | * | |
562 | * @return AttributeSecurity instance configured for field or Null if no | |
563 | * restrictions are defined | |
564 | */ | |
565 | public AttributeSecurity getAttributeSecurity() { | |
566 | 0 | return this.attributeSecurity; |
567 | } | |
568 | ||
569 | /** | |
570 | * Setter for the AttributeSecurity instance that defines restrictions for | |
571 | * the field | |
572 | * | |
573 | * @param attributeSecurity | |
574 | */ | |
575 | public void setAttributeSecurity(AttributeSecurity attributeSecurity) { | |
576 | 0 | this.attributeSecurity = attributeSecurity; |
577 | 0 | } |
578 | ||
579 | /** | |
580 | * @see org.kuali.rice.kns.uif.core.ComponentBase#getSupportsOnLoad() | |
581 | */ | |
582 | @Override | |
583 | public boolean getSupportsOnLoad() { | |
584 | 0 | return true; |
585 | } | |
586 | ||
587 | /** | |
588 | * Lookup finder widget for the field | |
589 | * | |
590 | * <p> | |
591 | * The quickfinder widget places a small icon next to the field that allows | |
592 | * the user to bring up a search screen for finding valid field values. The | |
593 | * <code>Widget</code> instance can be configured to point to a certain | |
594 | * <code>LookupView</code>, or the framework will attempt to associate the | |
595 | * field with a lookup based on its metadata (in particular its | |
596 | * relationships in the model) | |
597 | * </p> | |
598 | * | |
599 | * @return QuickFinder lookup widget | |
600 | */ | |
601 | public QuickFinder getFieldLookup() { | |
602 | 0 | return this.fieldLookup; |
603 | } | |
604 | ||
605 | /** | |
606 | * Setter for the lookup widget | |
607 | * | |
608 | * @param fieldLookup | |
609 | */ | |
610 | public void setFieldLookup(QuickFinder fieldLookup) { | |
611 | 0 | this.fieldLookup = fieldLookup; |
612 | 0 | } |
613 | ||
614 | /** | |
615 | * Inquiry widget for the field | |
616 | * | |
617 | * <p> | |
618 | * The inquiry widget will render a link for the field value when read-only | |
619 | * that points to the associated inquiry view for the field. The inquiry can | |
620 | * be configured to point to a certain <code>InquiryView</code>, or the | |
621 | * framework will attempt to associate the field with a inquiry based on its | |
622 | * metadata (in particular its relationships in the model) | |
623 | * </p> | |
624 | * | |
625 | * @return Inquiry field inquiry | |
626 | */ | |
627 | public Inquiry getFieldInquiry() { | |
628 | 0 | return this.fieldInquiry; |
629 | } | |
630 | ||
631 | /** | |
632 | * Setter for the inquiry widget | |
633 | * | |
634 | * @param fieldInquiry | |
635 | */ | |
636 | public void setFieldInquiry(Inquiry fieldInquiry) { | |
637 | 0 | this.fieldInquiry = fieldInquiry; |
638 | 0 | } |
639 | ||
640 | /** | |
641 | * @return the summaryField | |
642 | */ | |
643 | public MessageField getSummaryMessageField() { | |
644 | 0 | return this.summaryMessageField; |
645 | } | |
646 | ||
647 | /** | |
648 | * Sets the summary message field. Developers can use the setSummary method | |
649 | * which would set the summary text. | |
650 | * | |
651 | * @param summary | |
652 | * field to set | |
653 | * @see setSummary | |
654 | */ | |
655 | public void setSummaryMessageField(MessageField summaryField) { | |
656 | 0 | this.summaryMessageField = summaryField; |
657 | 0 | } |
658 | ||
659 | /** | |
660 | * Returns the contraint set on the field | |
661 | * | |
662 | * @return the constraint | |
663 | */ | |
664 | public String getConstraint() { | |
665 | 0 | return this.constraint; |
666 | } | |
667 | ||
668 | /** | |
669 | * Sets the constraint text. This text will be displayed below the | |
670 | * component. | |
671 | * | |
672 | * @param constraint | |
673 | * for this field | |
674 | */ | |
675 | public void setConstraint(String constraint) { | |
676 | 0 | this.constraint = constraint; |
677 | 0 | } |
678 | ||
679 | /** | |
680 | * Sets the constraint message field. Developers can use the setContraint | |
681 | * method which would set the constraint text. | |
682 | * | |
683 | * @param constraint | |
684 | * field to set | |
685 | * @see setContraint | |
686 | */ | |
687 | public void setConstraintMessageField(MessageField constraintMessageField) { | |
688 | 0 | this.constraintMessageField = constraintMessageField; |
689 | 0 | } |
690 | ||
691 | /** | |
692 | * Returns the contraint message field. | |
693 | * | |
694 | * @return constraint Message Field | |
695 | */ | |
696 | public MessageField getConstraintMessageField() { | |
697 | 0 | return this.constraintMessageField; |
698 | } | |
699 | ||
700 | /** | |
701 | * Valid character constraint that defines regular expressions for the valid | |
702 | * characters for this field | |
703 | * | |
704 | * @return the validCharactersConstraint | |
705 | */ | |
706 | public ValidCharactersConstraint getValidCharactersConstraint() { | |
707 | 0 | return this.validCharactersConstraint; |
708 | } | |
709 | ||
710 | /** | |
711 | * @param validCharactersConstraint | |
712 | * the validCharactersConstraint to set | |
713 | */ | |
714 | public void setValidCharactersConstraint(ValidCharactersConstraint validCharactersConstraint) { | |
715 | 0 | this.validCharactersConstraint = validCharactersConstraint; |
716 | 0 | } |
717 | ||
718 | /** | |
719 | * @return the caseConstraint | |
720 | */ | |
721 | public CaseConstraint getCaseConstraint() { | |
722 | 0 | return this.caseConstraint; |
723 | } | |
724 | ||
725 | /** | |
726 | * @param caseConstraint | |
727 | * the caseConstraint to set | |
728 | */ | |
729 | public void setCaseConstraint(CaseConstraint caseConstraint) { | |
730 | 0 | this.caseConstraint = caseConstraint; |
731 | 0 | } |
732 | ||
733 | /** | |
734 | * @return the dependencyConstraints | |
735 | */ | |
736 | public List<PrerequisiteConstraint> getDependencyConstraints() { | |
737 | 0 | return this.dependencyConstraints; |
738 | } | |
739 | ||
740 | /** | |
741 | * @param dependencyConstraints | |
742 | * the dependencyConstraints to set | |
743 | */ | |
744 | public void setDependencyConstraints(List<PrerequisiteConstraint> dependencyConstraints) { | |
745 | 0 | this.dependencyConstraints = dependencyConstraints; |
746 | 0 | } |
747 | ||
748 | /** | |
749 | * @return the mustOccurConstraints | |
750 | */ | |
751 | public List<MustOccurConstraint> getMustOccurConstraints() { | |
752 | 0 | return this.mustOccurConstraints; |
753 | } | |
754 | ||
755 | /** | |
756 | * @param mustOccurConstraints | |
757 | * the mustOccurConstraints to set | |
758 | */ | |
759 | public void setMustOccurConstraints(List<MustOccurConstraint> mustOccurConstraints) { | |
760 | 0 | this.mustOccurConstraints = mustOccurConstraints; |
761 | 0 | } |
762 | ||
763 | /** | |
764 | * A simple constraint which store the values for required, min/max length, | |
765 | * and min/max value | |
766 | * | |
767 | * @return the simpleConstraint | |
768 | */ | |
769 | public SimpleConstraint getSimpleConstraint() { | |
770 | 0 | return this.simpleConstraint; |
771 | } | |
772 | ||
773 | /** | |
774 | * When a simple constraint is set on this object ALL simple validation | |
775 | * constraints set directly will be overridden - recommended to use this or | |
776 | * the other gets/sets for defining simple constraints, not both | |
777 | * | |
778 | * @param simpleConstraint | |
779 | * the simpleConstraint to set | |
780 | */ | |
781 | public void setSimpleConstraint(SimpleConstraint simpleConstraint) { | |
782 | 0 | this.simpleConstraint = simpleConstraint; |
783 | 0 | } |
784 | ||
785 | /** | |
786 | * Maximum number of the characters the attribute value is allowed to have. | |
787 | * Used to set the maxLength for supporting controls. Note this can be | |
788 | * smaller or longer than the actual control size | |
789 | * | |
790 | * @return Integer max length | |
791 | */ | |
792 | public Integer getMaxLength() { | |
793 | 0 | return simpleConstraint.getMaxLength(); |
794 | } | |
795 | ||
796 | /** | |
797 | * Setter for attributes max length | |
798 | * | |
799 | * @param maxLength | |
800 | */ | |
801 | public void setMaxLength(Integer maxLength) { | |
802 | 0 | simpleConstraint.setMaxLength(maxLength); |
803 | 0 | } |
804 | ||
805 | /** | |
806 | * @return the minLength | |
807 | */ | |
808 | public Integer getMinLength() { | |
809 | 0 | return simpleConstraint.getMinLength(); |
810 | } | |
811 | ||
812 | /** | |
813 | * @param minLength | |
814 | * the minLength to set | |
815 | */ | |
816 | public void setMinLength(Integer minLength) { | |
817 | 0 | simpleConstraint.setMinLength(minLength); |
818 | 0 | } |
819 | ||
820 | /** | |
821 | * @see org.kuali.rice.kns.uif.core.ComponentBase#getRequired() | |
822 | */ | |
823 | @Override | |
824 | public Boolean getRequired() { | |
825 | 0 | return this.simpleConstraint.getRequired(); |
826 | } | |
827 | ||
828 | /** | |
829 | * @see org.kuali.rice.kns.uif.core.ComponentBase#setRequired(java.lang.Boolean) | |
830 | */ | |
831 | @Override | |
832 | public void setRequired(Boolean required) { | |
833 | 0 | this.simpleConstraint.setRequired(required); |
834 | 0 | } |
835 | ||
836 | /** | |
837 | * The exclusiveMin element determines the minimum allowable value for data | |
838 | * entry editing purposes. Value can be an integer or decimal value such as | |
839 | * -.001 or 99. | |
840 | */ | |
841 | public String getExclusiveMin() { | |
842 | 0 | return simpleConstraint.getExclusiveMin(); |
843 | } | |
844 | ||
845 | /** | |
846 | * @param minValue | |
847 | * the minValue to set | |
848 | */ | |
849 | public void setExclusiveMin(String exclusiveMin) { | |
850 | 0 | simpleConstraint.setExclusiveMin(exclusiveMin); |
851 | 0 | } |
852 | ||
853 | /** | |
854 | * The inclusiveMax element determines the maximum allowable value for data | |
855 | * entry editing purposes. Value can be an integer or decimal value such as | |
856 | * -.001 or 99. | |
857 | * | |
858 | * JSTL: This field is mapped into the field named "exclusiveMax". | |
859 | */ | |
860 | public String getInclusiveMax() { | |
861 | 0 | return simpleConstraint.getInclusiveMax(); |
862 | } | |
863 | ||
864 | /** | |
865 | * @param maxValue | |
866 | * the maxValue to set | |
867 | */ | |
868 | public void setInclusiveMax(String inclusiveMax) { | |
869 | 0 | simpleConstraint.setInclusiveMax(inclusiveMax); |
870 | 0 | } |
871 | ||
872 | } |