Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AttributeField |
|
| 1.7840909090909092;1.784 |
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.krad.uif.field; | |
17 | ||
18 | import org.apache.commons.lang.StringUtils; | |
19 | import org.kuali.rice.core.api.util.KeyValue; | |
20 | import org.kuali.rice.core.web.format.Formatter; | |
21 | import org.kuali.rice.krad.bo.DataObjectRelationship; | |
22 | import org.kuali.rice.krad.bo.KualiCode; | |
23 | import org.kuali.rice.krad.datadictionary.AttributeDefinition; | |
24 | import org.kuali.rice.krad.datadictionary.AttributeSecurity; | |
25 | import org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint; | |
26 | import org.kuali.rice.krad.datadictionary.validation.constraint.MustOccurConstraint; | |
27 | import org.kuali.rice.krad.datadictionary.validation.constraint.PrerequisiteConstraint; | |
28 | import org.kuali.rice.krad.datadictionary.validation.constraint.SimpleConstraint; | |
29 | import org.kuali.rice.krad.datadictionary.validation.constraint.ValidCharactersConstraint; | |
30 | import org.kuali.rice.krad.keyvalues.KeyValuesFinder; | |
31 | import org.kuali.rice.krad.service.KRADServiceLocatorWeb; | |
32 | import org.kuali.rice.krad.uif.UifConstants; | |
33 | import org.kuali.rice.krad.uif.container.FormView; | |
34 | import org.kuali.rice.krad.uif.container.View; | |
35 | import org.kuali.rice.krad.uif.control.Control; | |
36 | import org.kuali.rice.krad.uif.control.MultiValueControlBase; | |
37 | import org.kuali.rice.krad.uif.core.BindingInfo; | |
38 | import org.kuali.rice.krad.uif.core.Component; | |
39 | import org.kuali.rice.krad.uif.core.DataBinding; | |
40 | import org.kuali.rice.krad.uif.util.ClientValidationUtils; | |
41 | import org.kuali.rice.krad.uif.util.ComponentUtils; | |
42 | import org.kuali.rice.krad.uif.util.ObjectPropertyUtils; | |
43 | import org.kuali.rice.krad.uif.util.ViewModelUtils; | |
44 | import org.kuali.rice.krad.uif.widget.DirectInquiry; | |
45 | import org.kuali.rice.krad.uif.widget.Inquiry; | |
46 | import org.kuali.rice.krad.uif.widget.QuickFinder; | |
47 | import org.kuali.rice.krad.uif.widget.Suggest; | |
48 | import org.kuali.rice.krad.util.KRADPropertyConstants; | |
49 | import org.kuali.rice.krad.util.ObjectUtils; | |
50 | import org.kuali.rice.krad.valuefinder.ValueFinder; | |
51 | ||
52 | import java.util.ArrayList; | |
53 | import java.util.List; | |
54 | ||
55 | /** | |
56 | * Field that encapsulates data input/output captured by an attribute within the | |
57 | * application | |
58 | * | |
59 | * <p> | |
60 | * The <code>AttributField</code> provides the majority of the data input/output | |
61 | * for the screen. Through these fields the model can be displayed and updated. | |
62 | * For data input, the field contains a <code>Control</code> instance will | |
63 | * render an HTML control element(s). The attribute field also contains a | |
64 | * <code>LabelField</code>, summary, and widgets such as a quickfinder (for | |
65 | * looking up values) and inquiry (for getting more information on the value). | |
66 | * <code>AttributeField</code> instances can have associated messages (errors) | |
67 | * due to invalid input or business rule failures. Security can also be | |
68 | * configured to restrict who may view the fields value. | |
69 | * </p> | |
70 | * | |
71 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
72 | */ | |
73 | public class AttributeField extends FieldBase implements DataBinding { | |
74 | private static final long serialVersionUID = -3703656713706343840L; | |
75 | ||
76 | // value props | |
77 | private String defaultValue; | |
78 | private Class<? extends ValueFinder> defaultValueFinderClass; | |
79 | ||
80 | // Constraint variables | |
81 | private String customValidatorClass; | |
82 | private ValidCharactersConstraint validCharactersConstraint; | |
83 | private CaseConstraint caseConstraint; | |
84 | private List<PrerequisiteConstraint> dependencyConstraints; | |
85 | private List<MustOccurConstraint> mustOccurConstraints; | |
86 | private SimpleConstraint simpleConstraint; | |
87 | ||
88 | private Formatter formatter; | |
89 | private KeyValuesFinder optionsFinder; | |
90 | ||
91 | // binding | |
92 | private String propertyName; | |
93 | private BindingInfo bindingInfo; | |
94 | ||
95 | private String dictionaryAttributeName; | |
96 | private String dictionaryObjectEntry; | |
97 | ||
98 | // display props | |
99 | private Control control; | |
100 | ||
101 | private String errorMessagePlacement; | |
102 | private ErrorsField errorsField; | |
103 | ||
104 | // messages | |
105 | private String summary; | |
106 | private String constraint; | |
107 | private String description; | |
108 | ||
109 | private AttributeSecurity attributeSecurity; | |
110 | private MessageField summaryMessageField; | |
111 | private MessageField constraintMessageField; | |
112 | ||
113 | // Alternate and additional display properties | |
114 | protected String alternateDisplayPropertyName; | |
115 | protected String additionalDisplayPropertyName; | |
116 | ||
117 | private String alternateDisplayValue; | |
118 | private String additionalDisplayValue; | |
119 | ||
120 | private List<String> informationalDisplayPropertyNames; | |
121 | private List<String> hiddenPropertyNames; | |
122 | ||
123 | private AttributeQuery fieldAttributeQuery; | |
124 | ||
125 | private boolean escapeHtmlInPropertyValue; | |
126 | ||
127 | // widgets | |
128 | private Inquiry fieldInquiry; | |
129 | private QuickFinder fieldLookup; | |
130 | private DirectInquiry fieldDirectInquiry; | |
131 | private Suggest fieldSuggest; | |
132 | ||
133 | public AttributeField() { | |
134 | 0 | super(); |
135 | ||
136 | 0 | simpleConstraint = new SimpleConstraint(); |
137 | 0 | informationalDisplayPropertyNames = new ArrayList<String>(); |
138 | 0 | hiddenPropertyNames = new ArrayList<String>(); |
139 | 0 | } |
140 | ||
141 | /** | |
142 | * The following initialization is performed: | |
143 | * | |
144 | * <ul> | |
145 | * <li>Set defaults for binding</li> | |
146 | * <li>Default the model path if not set</li> | |
147 | * </ul> | |
148 | * | |
149 | * @see org.kuali.rice.krad.uif.core.ComponentBase#performInitialization(org.kuali.rice.krad.uif.container.View) | |
150 | */ | |
151 | @Override | |
152 | public void performInitialization(View view) { | |
153 | 0 | super.performInitialization(view); |
154 | ||
155 | 0 | if (bindingInfo != null) { |
156 | 0 | bindingInfo.setDefaults(view, getPropertyName()); |
157 | } | |
158 | 0 | } |
159 | ||
160 | /** | |
161 | * The following actions are performed: | |
162 | * | |
163 | * <ul> | |
164 | * <li>Set the ids for the various attribute components</li> | |
165 | * <li>Sets up the client side validation for constraints on this field. In | |
166 | * addition, it sets up the messages applied to this field</li> | |
167 | * </ul> | |
168 | * | |
169 | * @see org.kuali.rice.krad.uif.core.ComponentBase#performFinalize(org.kuali.rice.krad.uif.container.View, | |
170 | * java.lang.Object, org.kuali.rice.krad.uif.core.Component) | |
171 | */ | |
172 | @Override | |
173 | public void performFinalize(View view, Object model, Component parent) { | |
174 | 0 | super.performFinalize(view, model, parent); |
175 | ||
176 | 0 | setupIds(); |
177 | ||
178 | // Sets message | |
179 | 0 | if (StringUtils.isNotBlank(summary)) { |
180 | 0 | summaryMessageField.setMessageText(summary); |
181 | } | |
182 | ||
183 | // Sets constraints | |
184 | 0 | if (StringUtils.isNotBlank(constraint)) { |
185 | 0 | constraintMessageField.setMessageText(constraint); |
186 | } | |
187 | ||
188 | // Additional and Alternate display value | |
189 | 0 | setAlternateAndAdditionalDisplayValue(view, model); |
190 | ||
191 | // adjust paths on informational property names | |
192 | 0 | List<String> informationalPropertyPaths = new ArrayList<String>(); |
193 | 0 | for (String infoPropertyName : getInformationalDisplayPropertyNames()) { |
194 | 0 | String infoPropertyPath = getBindingInfo().getPropertyAdjustedBindingPath(infoPropertyName); |
195 | 0 | informationalPropertyPaths.add(infoPropertyPath); |
196 | 0 | } |
197 | 0 | this.informationalDisplayPropertyNames = informationalPropertyPaths; |
198 | ||
199 | // adjust the path for hidden fields | |
200 | // TODO: should this check the view#readOnly? | |
201 | 0 | List<String> hiddenPropertyPaths = new ArrayList<String>(); |
202 | 0 | for (String hiddenPropertyName : getHiddenPropertyNames()) { |
203 | 0 | String hiddenPropertyPath = getBindingInfo().getPropertyAdjustedBindingPath(hiddenPropertyName); |
204 | 0 | hiddenPropertyPaths.add(hiddenPropertyPath); |
205 | 0 | } |
206 | 0 | this.hiddenPropertyNames = hiddenPropertyPaths; |
207 | ||
208 | // if read only or the control is not set no need to set client side | |
209 | // validation | |
210 | 0 | if (isReadOnly() || getControl() == null) { |
211 | 0 | return; |
212 | } | |
213 | ||
214 | 0 | setupFieldQuery(); |
215 | ||
216 | // TODO: remove later, this should be done within the service lifecycle | |
217 | 0 | if ((optionsFinder != null) && (control != null) && control instanceof MultiValueControlBase) { |
218 | 0 | MultiValueControlBase multiValueControl = (MultiValueControlBase) control; |
219 | 0 | if ((multiValueControl.getOptions() == null) || multiValueControl.getOptions().isEmpty()) { |
220 | 0 | multiValueControl.setOptions(optionsFinder.getKeyValues()); |
221 | } | |
222 | } | |
223 | ||
224 | 0 | if (view instanceof FormView && ((FormView) view).isValidateClientSide()) { |
225 | 0 | ClientValidationUtils.processAndApplyConstraints(this, view); |
226 | } | |
227 | 0 | } |
228 | ||
229 | /** | |
230 | * Performs setup of the field attribute query and informational display properties. Paths | |
231 | * are adjusted to match the binding for the this field, and the necessary onblur script for | |
232 | * triggering the query client side is constructed | |
233 | */ | |
234 | protected void setupFieldQuery() { | |
235 | 0 | if (getFieldAttributeQuery() != null) { |
236 | // adjust paths on query mappings | |
237 | 0 | getFieldAttributeQuery().updateQueryFieldMapping(getBindingInfo()); |
238 | 0 | getFieldAttributeQuery().updateReturnFieldMapping(getBindingInfo()); |
239 | 0 | getFieldAttributeQuery().updateQueryMethodArgumentFieldList(getBindingInfo()); |
240 | ||
241 | // build onblur script for field query | |
242 | 0 | String script = "executeFieldQuery('" + getControl().getId() + "',"; |
243 | 0 | script += "'" + getId() + "'," + getFieldAttributeQuery().getQueryFieldMappingJsString() + ","; |
244 | 0 | script += getFieldAttributeQuery().getQueryMethodArgumentFieldsJsString() + ","; |
245 | 0 | script += getFieldAttributeQuery().getReturnFieldMappingJsString() + ");"; |
246 | ||
247 | 0 | if (StringUtils.isNotBlank(getControl().getOnBlurScript())) { |
248 | 0 | script = getControl().getOnBlurScript() + script; |
249 | } | |
250 | 0 | getControl().setOnBlurScript(script); |
251 | } | |
252 | 0 | } |
253 | ||
254 | /** | |
255 | * Sets alternate and additional property value for this field. | |
256 | * | |
257 | * <p> | |
258 | * If <code>AttributeSecurity</code> present in this field, make sure the current user has permission to view the | |
259 | * field value. If user doesn't have permission to view the value, mask the value as configured and set it | |
260 | * as alternate value for display. If security doesn't exists for this field but | |
261 | * <code>alternateDisplayPropertyName</code> present, get its value and format it based on that | |
262 | * fields formatting and set for display. | |
263 | * </p> | |
264 | * | |
265 | * <p> | |
266 | * For additional display value, if <code>AttributeSecurity</code> not present, sets the value if | |
267 | * <code>additionalDisplayPropertyName</code> present. If not present, check whether this field is a | |
268 | * <code>KualiCode</code> and get the relationship configured in the datadictionary file and set the name | |
269 | * additional display value which will be displayed along with the code. If additional display property not | |
270 | * present, | |
271 | * check whether this field is has <code>MultiValueControlBase</code>. If yes, get the Label for the value and | |
272 | * set it as additional display value. | |
273 | * </p> | |
274 | * | |
275 | * @param view - the current view instance | |
276 | * @param model - model instance | |
277 | */ | |
278 | protected void setAlternateAndAdditionalDisplayValue(View view, Object model) { | |
279 | 0 | boolean additionalValueSet = false; |
280 | 0 | boolean alternateValueSet = false; |
281 | ||
282 | // check whether field value needs to be masked, and if so apply masking as alternateDisplayValue | |
283 | 0 | if (getAttributeSecurity() != null) { |
284 | //TODO: Check authorization | |
285 | // if (attributeSecurity.isMask() && !boAuthzService.canFullyUnmaskField(user,dataObjectClass, field.getPropertyName(), null)) { | |
286 | 0 | Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath()); |
287 | 0 | alternateDisplayValue = getSecuredFieldValue(attributeSecurity, fieldValue); |
288 | ||
289 | 0 | setReadOnly(true); |
290 | 0 | return; |
291 | } | |
292 | ||
293 | // if not read only, return without trying to set alternate and additional values | |
294 | 0 | if (!isReadOnly()) { |
295 | 0 | return; |
296 | } | |
297 | ||
298 | // if field is not secure, check for alternate and additional display properties | |
299 | 0 | if (StringUtils.isNotBlank(getAlternateDisplayPropertyName())) { |
300 | 0 | String alternateDisplayPropertyPath = |
301 | getBindingInfo().getPropertyAdjustedBindingPath(getAlternateDisplayPropertyName()); | |
302 | ||
303 | 0 | Object alternateFieldValue = ObjectPropertyUtils.getPropertyValue(model, alternateDisplayPropertyPath); |
304 | 0 | if (alternateFieldValue != null) { |
305 | // TODO: format by type | |
306 | 0 | alternateDisplayValue = alternateFieldValue.toString(); |
307 | 0 | alternateValueSet = true; |
308 | } | |
309 | } | |
310 | ||
311 | // perform automatic translation for code references if enabled on view | |
312 | 0 | if (StringUtils.isBlank(getAdditionalDisplayPropertyName()) && view.isTranslateCodes()) { |
313 | // check for any relationship present for this field and it's of type KualiCode | |
314 | 0 | Class<?> parentObjectClass = ViewModelUtils.getParentObjectClassForMetadata(view, model, this); |
315 | 0 | DataObjectRelationship relationship = KRADServiceLocatorWeb.getDataObjectMetaDataService() |
316 | .getDataObjectRelationship(null, parentObjectClass, getBindingInfo().getBindingName(), "", true, | |
317 | false, false); | |
318 | ||
319 | 0 | if (relationship != null && getPropertyName().startsWith(relationship.getParentAttributeName()) && |
320 | KualiCode.class.isAssignableFrom(relationship.getRelatedClass())) { | |
321 | 0 | additionalDisplayPropertyName = |
322 | relationship.getParentAttributeName() + "." + KRADPropertyConstants.NAME; | |
323 | } | |
324 | } | |
325 | ||
326 | // now check for an additional display property and if set get the value | |
327 | 0 | if (StringUtils.isNotBlank(getAdditionalDisplayPropertyName())) { |
328 | 0 | String additionalDisplayPropertyPath = |
329 | getBindingInfo().getPropertyAdjustedBindingPath(getAdditionalDisplayPropertyName()); | |
330 | ||
331 | 0 | Object additionalFieldValue = ObjectPropertyUtils.getPropertyValue(model, additionalDisplayPropertyPath); |
332 | 0 | if (additionalFieldValue != null) { |
333 | // TODO: format by type | |
334 | 0 | additionalDisplayValue = additionalFieldValue.toString(); |
335 | 0 | additionalValueSet = true; |
336 | } | |
337 | } | |
338 | ||
339 | // if alternateValue and additionalValue not set yet check whether the field has multi value control | |
340 | 0 | if (!alternateValueSet && !additionalValueSet && |
341 | (control != null && control instanceof MultiValueControlBase)) { | |
342 | 0 | MultiValueControlBase multiValueControl = (MultiValueControlBase) control; |
343 | 0 | if (multiValueControl.getOptions() != null) { |
344 | 0 | for (KeyValue keyValue : multiValueControl.getOptions()) { |
345 | 0 | Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath()); |
346 | ||
347 | 0 | if (StringUtils.equals((String) fieldValue, keyValue.getKey())) { |
348 | 0 | alternateDisplayValue = keyValue.getValue(); |
349 | 0 | break; |
350 | } | |
351 | 0 | } |
352 | } | |
353 | } | |
354 | 0 | } |
355 | ||
356 | /** | |
357 | * Helper method which returns the masked value based on the <code>AttributeSecurity</code> | |
358 | * | |
359 | * @param attributeSecurity attribute security to check | |
360 | * @param fieldValue field value | |
361 | * @return masked value | |
362 | */ | |
363 | private String getSecuredFieldValue(AttributeSecurity attributeSecurity, Object fieldValue) { | |
364 | 0 | if (attributeSecurity.isMask()) { |
365 | 0 | return attributeSecurity.getMaskFormatter().maskValue(fieldValue); |
366 | 0 | } else if (getAttributeSecurity().isPartialMask()) { |
367 | 0 | return attributeSecurity.getPartialMaskFormatter().maskValue(fieldValue); |
368 | } else { | |
369 | 0 | throw new RuntimeException("Encountered unsupported Attribute Security.."); |
370 | } | |
371 | } | |
372 | ||
373 | /** | |
374 | * Sets the ids on all components the attribute field uses so they will all | |
375 | * contain this attribute's id in their ids. This is useful for jQuery | |
376 | * manipulation. | |
377 | */ | |
378 | private void setupIds() { | |
379 | // update ids so they all match the attribute | |
380 | 0 | if (getControl() != null) { |
381 | 0 | getControl().setId(getId()); |
382 | } | |
383 | ||
384 | 0 | setNestedComponentIdAndSuffix(getErrorsField(), UifConstants.IdSuffixes.ERRORS); |
385 | 0 | setNestedComponentIdAndSuffix(getLabelField(), UifConstants.IdSuffixes.LABEL); |
386 | 0 | setNestedComponentIdAndSuffix(getSummaryMessageField(), UifConstants.IdSuffixes.SUMMARY); |
387 | 0 | setNestedComponentIdAndSuffix(getConstraintMessageField(), UifConstants.IdSuffixes.CONSTRAINT); |
388 | 0 | setNestedComponentIdAndSuffix(getFieldLookup(), UifConstants.IdSuffixes.QUICK_FINDER); |
389 | 0 | setNestedComponentIdAndSuffix(getFieldDirectInquiry(), UifConstants.IdSuffixes.DIRECT_INQUIRY); |
390 | 0 | setNestedComponentIdAndSuffix(getFieldSuggest(), UifConstants.IdSuffixes.SUGGEST); |
391 | ||
392 | 0 | setId(getId() + UifConstants.IdSuffixes.ATTRIBUTE); |
393 | 0 | } |
394 | ||
395 | /** | |
396 | * Helper method for suffixing the ids of the fields nested components | |
397 | * | |
398 | * @param component - component to adjust id for | |
399 | * @param suffix - suffix to append to id | |
400 | */ | |
401 | private void setNestedComponentIdAndSuffix(Component component, String suffix) { | |
402 | 0 | if (component != null) { |
403 | 0 | String fieldId = getId(); |
404 | 0 | fieldId += suffix; |
405 | ||
406 | 0 | component.setId(fieldId); |
407 | } | |
408 | 0 | } |
409 | ||
410 | /** | |
411 | * Defaults the properties of the <code>AttributeField</code> to the | |
412 | * corresponding properties of its <code>AttributeDefinition</code> | |
413 | * retrieved from the dictionary (if such an entry exists). If the field | |
414 | * already contains a value for a property, the definitions value is not | |
415 | * used. | |
416 | * | |
417 | * @param attributeDefinition - AttributeDefinition instance the property values should be | |
418 | * copied from | |
419 | */ | |
420 | public void copyFromAttributeDefinition(AttributeDefinition attributeDefinition) { | |
421 | // label | |
422 | 0 | if (StringUtils.isEmpty(getLabel())) { |
423 | 0 | setLabel(attributeDefinition.getLabel()); |
424 | } | |
425 | ||
426 | // short label | |
427 | 0 | if (StringUtils.isEmpty(getShortLabel())) { |
428 | 0 | setShortLabel(attributeDefinition.getShortLabel()); |
429 | } | |
430 | ||
431 | // max length | |
432 | 0 | if (getMaxLength() == null) { |
433 | 0 | setMaxLength(attributeDefinition.getMaxLength()); |
434 | } | |
435 | ||
436 | // max length | |
437 | 0 | if (getMinLength() == null) { |
438 | 0 | setMinLength(attributeDefinition.getMinLength()); |
439 | } | |
440 | ||
441 | // valid characters | |
442 | 0 | if (getValidCharactersConstraint() == null) { |
443 | 0 | setValidCharactersConstraint(attributeDefinition.getValidCharactersConstraint()); |
444 | } | |
445 | ||
446 | 0 | if (getCaseConstraint() == null) { |
447 | 0 | setCaseConstraint(attributeDefinition.getCaseConstraint()); |
448 | } | |
449 | ||
450 | 0 | if (getDependencyConstraints() == null) { |
451 | 0 | setDependencyConstraints(attributeDefinition.getPrerequisiteConstraints()); |
452 | } | |
453 | ||
454 | 0 | if (getMustOccurConstraints() == null) { |
455 | 0 | setMustOccurConstraints(attributeDefinition.getMustOccurConstraints()); |
456 | } | |
457 | ||
458 | // required | |
459 | 0 | if (getRequired() == null) { |
460 | 0 | setRequired(attributeDefinition.isRequired()); |
461 | ||
462 | //if still null, default to false | |
463 | 0 | if (getRequired() == null) { |
464 | 0 | setRequired(false); |
465 | } | |
466 | } | |
467 | ||
468 | // control | |
469 | 0 | if ((getControl() == null) && (attributeDefinition.getControlField() != null)) { |
470 | 0 | setControl(ComponentUtils.copy(attributeDefinition.getControlField())); |
471 | } | |
472 | ||
473 | // summary | |
474 | 0 | if (StringUtils.isEmpty(getSummary())) { |
475 | 0 | setSummary(attributeDefinition.getSummary()); |
476 | 0 | getSummaryMessageField().setMessageText(attributeDefinition.getSummary()); |
477 | } | |
478 | ||
479 | // description | |
480 | 0 | if (StringUtils.isEmpty(getDescription())) { |
481 | 0 | setDescription(attributeDefinition.getDescription()); |
482 | } | |
483 | ||
484 | // security | |
485 | 0 | if (getAttributeSecurity() == null) { |
486 | 0 | attributeSecurity = attributeDefinition.getAttributeSecurity(); |
487 | } | |
488 | ||
489 | // constraint | |
490 | 0 | if (StringUtils.isEmpty(getConstraint())) { |
491 | 0 | setConstraint(attributeDefinition.getConstraint()); |
492 | 0 | getConstraintMessageField().setMessageText(attributeDefinition.getConstraint()); |
493 | } | |
494 | ||
495 | // options | |
496 | 0 | if (getOptionsFinder() == null) { |
497 | 0 | setOptionsFinder(attributeDefinition.getOptionsFinder()); |
498 | } | |
499 | ||
500 | //alternate property name and binding object | |
501 | 0 | if (getAlternateDisplayPropertyName() == null && |
502 | StringUtils.isNotBlank(attributeDefinition.getAlternateDisplayAttributeName())) { | |
503 | 0 | setAlternateDisplayPropertyName(attributeDefinition.getAlternateDisplayAttributeName()); |
504 | } | |
505 | ||
506 | //additional property display name and binding object | |
507 | 0 | if (getAdditionalDisplayPropertyName() == null && |
508 | StringUtils.isNotBlank(attributeDefinition.getAdditionalDisplayAttributeName())) { | |
509 | 0 | setAdditionalDisplayPropertyName(attributeDefinition.getAdditionalDisplayAttributeName()); |
510 | } | |
511 | ||
512 | 0 | if (getFormatter() == null && StringUtils.isNotBlank(attributeDefinition.getFormatterClass())) { |
513 | 0 | Class clazz = null; |
514 | try { | |
515 | 0 | clazz = Class.forName(attributeDefinition.getFormatterClass()); |
516 | 0 | } catch (ClassNotFoundException e) { |
517 | 0 | throw new RuntimeException("Unable to get class from name: " + attributeDefinition.getFormatterClass(), |
518 | e); | |
519 | 0 | } |
520 | ||
521 | 0 | Formatter formatter = (Formatter) ObjectUtils.newInstance(clazz); |
522 | 0 | setFormatter(formatter); |
523 | } | |
524 | 0 | } |
525 | ||
526 | /** | |
527 | * @see org.kuali.rice.krad.uif.core.ComponentBase#getNestedComponents() | |
528 | */ | |
529 | @Override | |
530 | public List<Component> getNestedComponents() { | |
531 | 0 | List<Component> components = super.getNestedComponents(); |
532 | ||
533 | 0 | components.add(control); |
534 | 0 | components.add(errorsField); |
535 | 0 | components.add(fieldLookup); |
536 | 0 | components.add(fieldInquiry); |
537 | 0 | components.add(fieldDirectInquiry); |
538 | 0 | components.add(fieldSuggest); |
539 | ||
540 | 0 | return components; |
541 | } | |
542 | ||
543 | /** | |
544 | * @see org.kuali.rice.krad.uif.core.DataBinding#getPropertyName() | |
545 | */ | |
546 | public String getPropertyName() { | |
547 | 0 | return this.propertyName; |
548 | } | |
549 | ||
550 | /** | |
551 | * Setter for the component's property name | |
552 | * | |
553 | * @param propertyName | |
554 | */ | |
555 | public void setPropertyName(String propertyName) { | |
556 | 0 | this.propertyName = propertyName; |
557 | 0 | } |
558 | ||
559 | /** | |
560 | * Default value for the model property the field points to | |
561 | * | |
562 | * <p> | |
563 | * When a new <code>View</code> instance is requested, the corresponding | |
564 | * model will be newly created. During this initialization process the value | |
565 | * for the model property will be set to the given default value (if set) | |
566 | * </p> | |
567 | * | |
568 | * @return String default value | |
569 | */ | |
570 | public String getDefaultValue() { | |
571 | 0 | return this.defaultValue; |
572 | } | |
573 | ||
574 | /** | |
575 | * Setter for the fields default value | |
576 | * | |
577 | * @param defaultValue | |
578 | */ | |
579 | public void setDefaultValue(String defaultValue) { | |
580 | 0 | this.defaultValue = defaultValue; |
581 | 0 | } |
582 | ||
583 | /** | |
584 | * Gives Class that should be invoked to produce the default value for the | |
585 | * field | |
586 | * | |
587 | * @return Class<? extends ValueFinder> default value finder class | |
588 | */ | |
589 | public Class<? extends ValueFinder> getDefaultValueFinderClass() { | |
590 | 0 | return this.defaultValueFinderClass; |
591 | } | |
592 | ||
593 | /** | |
594 | * Setter for the default value finder class | |
595 | * | |
596 | * @param defaultValueFinderClass | |
597 | */ | |
598 | public void setDefaultValueFinderClass(Class<? extends ValueFinder> defaultValueFinderClass) { | |
599 | 0 | this.defaultValueFinderClass = defaultValueFinderClass; |
600 | 0 | } |
601 | ||
602 | /** | |
603 | * <code>Formatter</code> instance that should be used when displaying and | |
604 | * accepting the field's value in the user interface | |
605 | * | |
606 | * <p> | |
607 | * Formatters can provide conversion between datatypes in addition to | |
608 | * special string formatting such as currency display | |
609 | * </p> | |
610 | * | |
611 | * @return Formatter instance | |
612 | * @see org.kuali.rice.krad.web.format.Formatter | |
613 | */ | |
614 | public Formatter getFormatter() { | |
615 | 0 | return this.formatter; |
616 | } | |
617 | ||
618 | /** | |
619 | * Setter for the field's formatter | |
620 | * | |
621 | * @param formatter | |
622 | */ | |
623 | public void setFormatter(Formatter formatter) { | |
624 | 0 | this.formatter = formatter; |
625 | 0 | } |
626 | ||
627 | /** | |
628 | * @see org.kuali.rice.krad.uif.core.DataBinding#getBindingInfo() | |
629 | */ | |
630 | public BindingInfo getBindingInfo() { | |
631 | 0 | return this.bindingInfo; |
632 | } | |
633 | ||
634 | /** | |
635 | * Setter for the field's binding info | |
636 | * | |
637 | * @param bindingInfo | |
638 | */ | |
639 | public void setBindingInfo(BindingInfo bindingInfo) { | |
640 | 0 | this.bindingInfo = bindingInfo; |
641 | 0 | } |
642 | ||
643 | /** | |
644 | * <code>Control</code> instance that should be used to input data for the | |
645 | * field | |
646 | * | |
647 | * <p> | |
648 | * When the field is editable, the control will be rendered so the user can | |
649 | * input a value(s). Controls typically are part of a Form and render | |
650 | * standard HTML control elements such as text input, select, and checkbox | |
651 | * </p> | |
652 | * | |
653 | * @return Control instance | |
654 | */ | |
655 | public Control getControl() { | |
656 | 0 | return this.control; |
657 | } | |
658 | ||
659 | /** | |
660 | * Setter for the field's control | |
661 | * | |
662 | * @param control | |
663 | */ | |
664 | public void setControl(Control control) { | |
665 | 0 | this.control = control; |
666 | 0 | } |
667 | ||
668 | public String getErrorMessagePlacement() { | |
669 | 0 | return this.errorMessagePlacement; |
670 | } | |
671 | ||
672 | public void setErrorMessagePlacement(String errorMessagePlacement) { | |
673 | 0 | this.errorMessagePlacement = errorMessagePlacement; |
674 | 0 | } |
675 | ||
676 | /** | |
677 | * Field that contains the messages (errors) for the attribute field. The | |
678 | * <code>ErrorsField</code> holds configuration on associated messages along | |
679 | * with information on rendering the messages in the user interface | |
680 | * | |
681 | * @return ErrorsField instance | |
682 | */ | |
683 | public ErrorsField getErrorsField() { | |
684 | 0 | return this.errorsField; |
685 | } | |
686 | ||
687 | /** | |
688 | * Setter for the attribute field's errors field | |
689 | * | |
690 | * @param errorsField | |
691 | */ | |
692 | public void setErrorsField(ErrorsField errorsField) { | |
693 | 0 | this.errorsField = errorsField; |
694 | 0 | } |
695 | ||
696 | /** | |
697 | * Name of the attribute within the data dictionary the attribute field is | |
698 | * associated with | |
699 | * | |
700 | * <p> | |
701 | * During the initialize phase for the <code>View</code>, properties for | |
702 | * attribute fields are defaulted from a corresponding | |
703 | * <code>AttributeDefinition</code> in the data dictionary. Based on the | |
704 | * propertyName and parent object class the framework attempts will | |
705 | * determine the attribute definition that is associated with the field and | |
706 | * set this property. However this property can also be set in the fields | |
707 | * configuration to use another dictionary attribute. | |
708 | * </p> | |
709 | * <p> | |
710 | * The attribute name is used along with the dictionary object entry to find | |
711 | * the <code>AttributeDefinition</code> | |
712 | * </p> | |
713 | * | |
714 | * @return String attribute name | |
715 | */ | |
716 | public String getDictionaryAttributeName() { | |
717 | 0 | return this.dictionaryAttributeName; |
718 | } | |
719 | ||
720 | /** | |
721 | * Setter for the dictionary attribute name | |
722 | * | |
723 | * @param dictionaryAttributeName | |
724 | */ | |
725 | public void setDictionaryAttributeName(String dictionaryAttributeName) { | |
726 | 0 | this.dictionaryAttributeName = dictionaryAttributeName; |
727 | 0 | } |
728 | ||
729 | /** | |
730 | * Object entry name in the data dictionary the associated attribute is | |
731 | * apart of | |
732 | * | |
733 | * <p> | |
734 | * During the initialize phase for the <code>View</code>, properties for | |
735 | * attribute fields are defaulted from a corresponding | |
736 | * <code>AttributeDefinition</code> in the data dictionary. Based on the | |
737 | * parent object class the framework will determine the object entry for the | |
738 | * associated attribute. However the object entry can be set in the field's | |
739 | * configuration to use another object entry for the attribute | |
740 | * </p> | |
741 | * | |
742 | * <p> | |
743 | * The attribute name is used along with the dictionary object entry to find | |
744 | * the <code>AttributeDefinition</code> | |
745 | * </p> | |
746 | * | |
747 | * @return | |
748 | */ | |
749 | public String getDictionaryObjectEntry() { | |
750 | 0 | return this.dictionaryObjectEntry; |
751 | } | |
752 | ||
753 | /** | |
754 | * Setter for the dictionary object entry | |
755 | * | |
756 | * @param dictionaryObjectEntry | |
757 | */ | |
758 | public void setDictionaryObjectEntry(String dictionaryObjectEntry) { | |
759 | 0 | this.dictionaryObjectEntry = dictionaryObjectEntry; |
760 | 0 | } |
761 | ||
762 | /** | |
763 | * Instance of <code>KeyValluesFinder</code> that should be invoked to | |
764 | * provide a List of values the field can have. Generally used to provide | |
765 | * the options for a multi-value control or to validate the submitted field | |
766 | * value | |
767 | * | |
768 | * @return KeyValuesFinder instance | |
769 | */ | |
770 | public KeyValuesFinder getOptionsFinder() { | |
771 | 0 | return this.optionsFinder; |
772 | } | |
773 | ||
774 | /** | |
775 | * Setter for the field's KeyValuesFinder instance | |
776 | * | |
777 | * @param optionsFinder | |
778 | */ | |
779 | public void setOptionsFinder(KeyValuesFinder optionsFinder) { | |
780 | 0 | this.optionsFinder = optionsFinder; |
781 | 0 | } |
782 | ||
783 | /** | |
784 | * Setter that takes in the class name for the options finder and creates a | |
785 | * new instance to use as the finder for the attribute field | |
786 | * | |
787 | * @param optionsFinderClass | |
788 | */ | |
789 | public void setOptionsFinderClass(Class<? extends KeyValuesFinder> optionsFinderClass) { | |
790 | 0 | this.optionsFinder = ObjectUtils.newInstance(optionsFinderClass); |
791 | 0 | } |
792 | ||
793 | /** | |
794 | * Brief statement of the field (attribute) purpose. Used to display helpful | |
795 | * information to the user on the form | |
796 | * | |
797 | * @return String summary message | |
798 | */ | |
799 | public String getSummary() { | |
800 | 0 | return this.summary; |
801 | } | |
802 | ||
803 | /** | |
804 | * Setter for the summary message | |
805 | * | |
806 | * @param summary | |
807 | */ | |
808 | public void setSummary(String summary) { | |
809 | 0 | this.summary = summary; |
810 | 0 | } |
811 | ||
812 | /** | |
813 | * Full explanation of the field (attribute). Used in help contents | |
814 | * | |
815 | * @return String description message | |
816 | */ | |
817 | public String getDescription() { | |
818 | 0 | return this.description; |
819 | } | |
820 | ||
821 | /** | |
822 | * Setter for the description message | |
823 | * | |
824 | * @param description | |
825 | */ | |
826 | public void setDescription(String description) { | |
827 | 0 | this.description = description; |
828 | 0 | } |
829 | ||
830 | /** | |
831 | * Holds security configuration for the attribute field. This triggers | |
832 | * corresponding permission checks in KIM and can result in an update to the | |
833 | * field state (such as read-only or hidden) and masking of the value | |
834 | * | |
835 | * @return AttributeSecurity instance configured for field or Null if no | |
836 | * restrictions are defined | |
837 | */ | |
838 | public AttributeSecurity getAttributeSecurity() { | |
839 | 0 | return this.attributeSecurity; |
840 | } | |
841 | ||
842 | /** | |
843 | * Setter for the AttributeSecurity instance that defines restrictions for | |
844 | * the field | |
845 | * | |
846 | * @param attributeSecurity | |
847 | */ | |
848 | public void setAttributeSecurity(AttributeSecurity attributeSecurity) { | |
849 | 0 | this.attributeSecurity = attributeSecurity; |
850 | 0 | } |
851 | ||
852 | /** | |
853 | * @see org.kuali.rice.krad.uif.core.ComponentBase#getSupportsOnLoad() | |
854 | */ | |
855 | @Override | |
856 | public boolean getSupportsOnLoad() { | |
857 | 0 | return true; |
858 | } | |
859 | ||
860 | /** | |
861 | * Lookup finder widget for the field | |
862 | * | |
863 | * <p> | |
864 | * The quickfinder widget places a small icon next to the field that allows | |
865 | * the user to bring up a search screen for finding valid field values. The | |
866 | * <code>Widget</code> instance can be configured to point to a certain | |
867 | * <code>LookupView</code>, or the framework will attempt to associate the | |
868 | * field with a lookup based on its metadata (in particular its | |
869 | * relationships in the model) | |
870 | * </p> | |
871 | * | |
872 | * @return QuickFinder lookup widget | |
873 | */ | |
874 | public QuickFinder getFieldLookup() { | |
875 | 0 | return this.fieldLookup; |
876 | } | |
877 | ||
878 | /** | |
879 | * Setter for the lookup widget | |
880 | * | |
881 | * @param fieldLookup | |
882 | */ | |
883 | public void setFieldLookup(QuickFinder fieldLookup) { | |
884 | 0 | this.fieldLookup = fieldLookup; |
885 | 0 | } |
886 | ||
887 | /** | |
888 | * Inquiry widget for the field | |
889 | * | |
890 | * <p> | |
891 | * The inquiry widget will render a link for the field value when read-only | |
892 | * that points to the associated inquiry view for the field. The inquiry can | |
893 | * be configured to point to a certain <code>InquiryView</code>, or the | |
894 | * framework will attempt to associate the field with a inquiry based on its | |
895 | * metadata (in particular its relationships in the model) | |
896 | * </p> | |
897 | * | |
898 | * @return Inquiry field inquiry | |
899 | */ | |
900 | public Inquiry getFieldInquiry() { | |
901 | 0 | return this.fieldInquiry; |
902 | } | |
903 | ||
904 | /** | |
905 | * Setter for the inquiry widget | |
906 | * | |
907 | * @param fieldInquiry | |
908 | */ | |
909 | public void setFieldInquiry(Inquiry fieldInquiry) { | |
910 | 0 | this.fieldInquiry = fieldInquiry; |
911 | 0 | } |
912 | ||
913 | /** | |
914 | * Suggest box widget for the attribute field | |
915 | * | |
916 | * <p> | |
917 | * If enabled (by render flag), as the user inputs data into the | |
918 | * fields control a dynamic query is performed to provide the user | |
919 | * suggestions on values which they can then select | |
920 | * </p> | |
921 | * | |
922 | * <p> | |
923 | * Note the Suggest widget is only valid when using a standard TextControl | |
924 | * </p> | |
925 | * | |
926 | * @return Suggest instance | |
927 | */ | |
928 | public Suggest getFieldSuggest() { | |
929 | 0 | return fieldSuggest; |
930 | } | |
931 | ||
932 | /** | |
933 | * Setter for the fields Suggest widget | |
934 | * | |
935 | * @param fieldSuggest | |
936 | */ | |
937 | public void setFieldSuggest(Suggest fieldSuggest) { | |
938 | 0 | this.fieldSuggest = fieldSuggest; |
939 | 0 | } |
940 | ||
941 | /** | |
942 | * @return the summaryField | |
943 | */ | |
944 | public MessageField getSummaryMessageField() { | |
945 | 0 | return this.summaryMessageField; |
946 | } | |
947 | ||
948 | /** | |
949 | * Sets the summary message field. Developers can use the setSummary method | |
950 | * which would set the summary text. | |
951 | * | |
952 | * @param summary field to set | |
953 | * @see setSummary | |
954 | */ | |
955 | public void setSummaryMessageField(MessageField summaryField) { | |
956 | 0 | this.summaryMessageField = summaryField; |
957 | 0 | } |
958 | ||
959 | /** | |
960 | * Returns the contraint set on the field | |
961 | * | |
962 | * @return the constraint | |
963 | */ | |
964 | public String getConstraint() { | |
965 | 0 | return this.constraint; |
966 | } | |
967 | ||
968 | /** | |
969 | * Sets the constraint text. This text will be displayed below the | |
970 | * component. | |
971 | * | |
972 | * @param constraint for this field | |
973 | */ | |
974 | public void setConstraint(String constraint) { | |
975 | 0 | this.constraint = constraint; |
976 | 0 | } |
977 | ||
978 | /** | |
979 | * Sets the constraint message field. Developers can use the setContraint | |
980 | * method which would set the constraint text. | |
981 | * | |
982 | * @param constraint field to set | |
983 | * @see setContraint | |
984 | */ | |
985 | public void setConstraintMessageField(MessageField constraintMessageField) { | |
986 | 0 | this.constraintMessageField = constraintMessageField; |
987 | 0 | } |
988 | ||
989 | /** | |
990 | * Returns the contraint message field. | |
991 | * | |
992 | * @return constraint Message Field | |
993 | */ | |
994 | public MessageField getConstraintMessageField() { | |
995 | 0 | return this.constraintMessageField; |
996 | } | |
997 | ||
998 | /** | |
999 | * Valid character constraint that defines regular expressions for the valid | |
1000 | * characters for this field | |
1001 | * | |
1002 | * @return the validCharactersConstraint | |
1003 | */ | |
1004 | public ValidCharactersConstraint getValidCharactersConstraint() { | |
1005 | 0 | return this.validCharactersConstraint; |
1006 | } | |
1007 | ||
1008 | /** | |
1009 | * @param validCharactersConstraint the validCharactersConstraint to set | |
1010 | */ | |
1011 | public void setValidCharactersConstraint(ValidCharactersConstraint validCharactersConstraint) { | |
1012 | 0 | this.validCharactersConstraint = validCharactersConstraint; |
1013 | 0 | } |
1014 | ||
1015 | /** | |
1016 | * @return the caseConstraint | |
1017 | */ | |
1018 | public CaseConstraint getCaseConstraint() { | |
1019 | 0 | return this.caseConstraint; |
1020 | } | |
1021 | ||
1022 | /** | |
1023 | * @param caseConstraint the caseConstraint to set | |
1024 | */ | |
1025 | public void setCaseConstraint(CaseConstraint caseConstraint) { | |
1026 | 0 | this.caseConstraint = caseConstraint; |
1027 | 0 | } |
1028 | ||
1029 | /** | |
1030 | * @return the dependencyConstraints | |
1031 | */ | |
1032 | public List<PrerequisiteConstraint> getDependencyConstraints() { | |
1033 | 0 | return this.dependencyConstraints; |
1034 | } | |
1035 | ||
1036 | /** | |
1037 | * @param dependencyConstraints the dependencyConstraints to set | |
1038 | */ | |
1039 | public void setDependencyConstraints(List<PrerequisiteConstraint> dependencyConstraints) { | |
1040 | 0 | this.dependencyConstraints = dependencyConstraints; |
1041 | 0 | } |
1042 | ||
1043 | /** | |
1044 | * @return the mustOccurConstraints | |
1045 | */ | |
1046 | public List<MustOccurConstraint> getMustOccurConstraints() { | |
1047 | 0 | return this.mustOccurConstraints; |
1048 | } | |
1049 | ||
1050 | /** | |
1051 | * @param mustOccurConstraints the mustOccurConstraints to set | |
1052 | */ | |
1053 | public void setMustOccurConstraints(List<MustOccurConstraint> mustOccurConstraints) { | |
1054 | 0 | this.mustOccurConstraints = mustOccurConstraints; |
1055 | 0 | } |
1056 | ||
1057 | /** | |
1058 | * A simple constraint which store the values for required, min/max length, | |
1059 | * and min/max value | |
1060 | * | |
1061 | * @return the simpleConstraint | |
1062 | */ | |
1063 | public SimpleConstraint getSimpleConstraint() { | |
1064 | 0 | return this.simpleConstraint; |
1065 | } | |
1066 | ||
1067 | /** | |
1068 | * When a simple constraint is set on this object ALL simple validation | |
1069 | * constraints set directly will be overridden - recommended to use this or | |
1070 | * the other gets/sets for defining simple constraints, not both | |
1071 | * | |
1072 | * @param simpleConstraint the simpleConstraint to set | |
1073 | */ | |
1074 | public void setSimpleConstraint(SimpleConstraint simpleConstraint) { | |
1075 | 0 | this.simpleConstraint = simpleConstraint; |
1076 | 0 | } |
1077 | ||
1078 | /** | |
1079 | * Maximum number of the characters the attribute value is allowed to have. | |
1080 | * Used to set the maxLength for supporting controls. Note this can be | |
1081 | * smaller or longer than the actual control size | |
1082 | * | |
1083 | * @return Integer max length | |
1084 | */ | |
1085 | public Integer getMaxLength() { | |
1086 | 0 | return simpleConstraint.getMaxLength(); |
1087 | } | |
1088 | ||
1089 | /** | |
1090 | * Setter for attributes max length | |
1091 | * | |
1092 | * @param maxLength | |
1093 | */ | |
1094 | public void setMaxLength(Integer maxLength) { | |
1095 | 0 | simpleConstraint.setMaxLength(maxLength); |
1096 | 0 | } |
1097 | ||
1098 | /** | |
1099 | * @return the minLength | |
1100 | */ | |
1101 | public Integer getMinLength() { | |
1102 | 0 | return simpleConstraint.getMinLength(); |
1103 | } | |
1104 | ||
1105 | /** | |
1106 | * @param minLength the minLength to set | |
1107 | */ | |
1108 | public void setMinLength(Integer minLength) { | |
1109 | 0 | simpleConstraint.setMinLength(minLength); |
1110 | 0 | } |
1111 | ||
1112 | /** | |
1113 | * @see org.kuali.rice.krad.uif.core.ComponentBase#getRequired() | |
1114 | */ | |
1115 | @Override | |
1116 | public Boolean getRequired() { | |
1117 | 0 | return this.simpleConstraint.getRequired(); |
1118 | } | |
1119 | ||
1120 | /** | |
1121 | * @see org.kuali.rice.krad.uif.core.ComponentBase#setRequired(java.lang.Boolean) | |
1122 | */ | |
1123 | @Override | |
1124 | public void setRequired(Boolean required) { | |
1125 | 0 | this.simpleConstraint.setRequired(required); |
1126 | 0 | } |
1127 | ||
1128 | /** | |
1129 | * The exclusiveMin element determines the minimum allowable value for data | |
1130 | * entry editing purposes. Value can be an integer or decimal value such as | |
1131 | * -.001 or 99. | |
1132 | */ | |
1133 | public String getExclusiveMin() { | |
1134 | 0 | return simpleConstraint.getExclusiveMin(); |
1135 | } | |
1136 | ||
1137 | /** | |
1138 | * @param minValue the minValue to set | |
1139 | */ | |
1140 | public void setExclusiveMin(String exclusiveMin) { | |
1141 | 0 | simpleConstraint.setExclusiveMin(exclusiveMin); |
1142 | 0 | } |
1143 | ||
1144 | /** | |
1145 | * The inclusiveMax element determines the maximum allowable value for data | |
1146 | * entry editing purposes. Value can be an integer or decimal value such as | |
1147 | * -.001 or 99. | |
1148 | * | |
1149 | * JSTL: This field is mapped into the field named "exclusiveMax". | |
1150 | */ | |
1151 | public String getInclusiveMax() { | |
1152 | 0 | return simpleConstraint.getInclusiveMax(); |
1153 | } | |
1154 | ||
1155 | /** | |
1156 | * @param maxValue the maxValue to set | |
1157 | */ | |
1158 | public void setInclusiveMax(String inclusiveMax) { | |
1159 | 0 | simpleConstraint.setInclusiveMax(inclusiveMax); |
1160 | 0 | } |
1161 | ||
1162 | /** | |
1163 | * Additional display attribute name, which will be displayed next to the actual field value | |
1164 | * when the field is readonly with hypen inbetween like PropertyValue - AdditionalPropertyValue | |
1165 | * | |
1166 | * @param additionalDisplayPropertyName - Name of the additional display property | |
1167 | */ | |
1168 | public void setAdditionalDisplayPropertyName(String additionalDisplayPropertyName) { | |
1169 | 0 | this.additionalDisplayPropertyName = additionalDisplayPropertyName; |
1170 | 0 | } |
1171 | ||
1172 | /** | |
1173 | * Returns the additional display attribute name to be displayed when the field is readonly | |
1174 | * | |
1175 | * @return Additional Display Attribute Name | |
1176 | */ | |
1177 | public String getAdditionalDisplayPropertyName() { | |
1178 | 0 | return this.additionalDisplayPropertyName; |
1179 | } | |
1180 | ||
1181 | /** | |
1182 | * Sets the alternate display attribute name to be displayed when the field is readonly. | |
1183 | * This properties value will be displayed instead of actual fields value when the field is readonly. | |
1184 | * | |
1185 | * @param alternateDisplayPropertyName - alternate display property name | |
1186 | */ | |
1187 | public void setAlternateDisplayPropertyName(String alternateDisplayPropertyName) { | |
1188 | 0 | this.alternateDisplayPropertyName = alternateDisplayPropertyName; |
1189 | 0 | } |
1190 | ||
1191 | /** | |
1192 | * Returns the alternate display attribute name to be displayed when the field is readonly. | |
1193 | * | |
1194 | * @return alternate Display Property Name | |
1195 | */ | |
1196 | public String getAlternateDisplayPropertyName() { | |
1197 | 0 | return this.alternateDisplayPropertyName; |
1198 | } | |
1199 | ||
1200 | /** | |
1201 | * Returns the alternate display value | |
1202 | * | |
1203 | * @return the alternate display value set for this field | |
1204 | */ | |
1205 | public String getAlternateDisplayValue() { | |
1206 | 0 | return alternateDisplayValue; |
1207 | } | |
1208 | ||
1209 | /** | |
1210 | * Returns the additional display value. | |
1211 | * | |
1212 | * @return the additional display value set for this field | |
1213 | */ | |
1214 | public String getAdditionalDisplayValue() { | |
1215 | 0 | return additionalDisplayValue; |
1216 | } | |
1217 | ||
1218 | /** | |
1219 | * Setter for the direct inquiry widget | |
1220 | * | |
1221 | * @param the <code>DirectInquiry</code> field DirectInquiry to set | |
1222 | */ | |
1223 | public void setFieldDirectInquiry(DirectInquiry fieldDirectInquiry) { | |
1224 | 0 | this.fieldDirectInquiry = fieldDirectInquiry; |
1225 | 0 | } |
1226 | ||
1227 | /** | |
1228 | * DirectInquiry widget for the field | |
1229 | * | |
1230 | * <p> | |
1231 | * The direct inquiry widget will render a button for the field value when | |
1232 | * that field is editable. It points to the associated inquiry view for the | |
1233 | * field. The inquiry can be configured to point to a certain | |
1234 | * <code>InquiryView</code>, or the framework will attempt to associate the | |
1235 | * field with a inquiry based on its metadata (in particular its | |
1236 | * relationships in the model) | |
1237 | * </p> | |
1238 | * | |
1239 | * @return the <code>DirectInquiry</code> field DirectInquiry | |
1240 | */ | |
1241 | public DirectInquiry getFieldDirectInquiry() { | |
1242 | 0 | return fieldDirectInquiry; |
1243 | } | |
1244 | ||
1245 | /** | |
1246 | * List of property names whose values should be displayed read-only under this field | |
1247 | * | |
1248 | * <p> | |
1249 | * In the attribute field template for each information property name given its values is | |
1250 | * outputted read-only. Informational property values can also be updated dynamically with | |
1251 | * the use of field attribute query | |
1252 | * </p> | |
1253 | * | |
1254 | * <p> | |
1255 | * Simple property names can be given if the property has the same binding parent as this | |
1256 | * field, in which case the binding path will be adjusted by the framework. If the property | |
1257 | * names starts with org.kuali.rice.krad.uif.UifConstants#NO_BIND_ADJUST_PREFIX, no binding | |
1258 | * prefix will be added. | |
1259 | * </p> | |
1260 | * | |
1261 | * @return List<String> informational property names | |
1262 | */ | |
1263 | public List<String> getInformationalDisplayPropertyNames() { | |
1264 | 0 | return informationalDisplayPropertyNames; |
1265 | } | |
1266 | ||
1267 | /** | |
1268 | * Setter for the list of informational property names | |
1269 | * | |
1270 | * @param informationalDisplayPropertyNames | |
1271 | */ | |
1272 | public void setInformationalDisplayPropertyNames(List<String> informationalDisplayPropertyNames) { | |
1273 | 0 | this.informationalDisplayPropertyNames = informationalDisplayPropertyNames; |
1274 | 0 | } |
1275 | ||
1276 | /** | |
1277 | * Allows specifying hidden property names without having to specify as a | |
1278 | * field in the group config (that might impact layout) | |
1279 | * | |
1280 | * @return List<String> hidden property names | |
1281 | */ | |
1282 | public List<String> getHiddenPropertyNames() { | |
1283 | 0 | return hiddenPropertyNames; |
1284 | } | |
1285 | ||
1286 | /** | |
1287 | * Setter for the hidden property names | |
1288 | * | |
1289 | * @param hiddenPropertyNames | |
1290 | */ | |
1291 | public void setHiddenPropertyNames(List<String> hiddenPropertyNames) { | |
1292 | 0 | this.hiddenPropertyNames = hiddenPropertyNames; |
1293 | 0 | } |
1294 | ||
1295 | /** | |
1296 | * Attribute query instance configured for this field to dynamically pull information back for | |
1297 | * updates other fields or providing messages | |
1298 | * | |
1299 | * <p> | |
1300 | * If field attribute query is not null, associated event script will be generated to trigger the | |
1301 | * query from the UI. This will invoke the <code>AttributeQueryService</code> to | |
1302 | * execute the query and return an instance of <code>AttributeQueryResult</code> that is then | |
1303 | * read by the script to update the UI. Typically used to update informational property values or | |
1304 | * other field values | |
1305 | * </p> | |
1306 | * | |
1307 | * @return AttributeQuery instance | |
1308 | */ | |
1309 | public AttributeQuery getFieldAttributeQuery() { | |
1310 | 0 | return fieldAttributeQuery; |
1311 | } | |
1312 | ||
1313 | /** | |
1314 | * Setter for this fields query | |
1315 | * | |
1316 | * @param fieldAttributeQuery | |
1317 | */ | |
1318 | public void setFieldAttributeQuery(AttributeQuery fieldAttributeQuery) { | |
1319 | 0 | this.fieldAttributeQuery = fieldAttributeQuery; |
1320 | 0 | } |
1321 | ||
1322 | /** | |
1323 | * Sets HTML escaping for this property value. HTML escaping will be handled in alternate and additional fields | |
1324 | * also. | |
1325 | */ | |
1326 | public void setEscapeHtmlInPropertyValue(boolean escapeHtmlInPropertyValue) { | |
1327 | 0 | this.escapeHtmlInPropertyValue = escapeHtmlInPropertyValue; |
1328 | 0 | } |
1329 | ||
1330 | /** | |
1331 | * Returns true if HTML escape allowed for this field | |
1332 | * | |
1333 | * @return true if escaping allowed | |
1334 | */ | |
1335 | public boolean isEscapeHtmlInPropertyValue() { | |
1336 | 0 | return this.escapeHtmlInPropertyValue; |
1337 | } | |
1338 | } |