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