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