Coverage Report - org.kuali.rice.krad.uif.field.InputField
 
Classes in this File Line Coverage Branch Coverage Complexity
InputField
1%
3/185
0%
0/90
1.793
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.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/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.krad.uif.field;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 20  
 import org.kuali.rice.core.api.util.KeyValue;
 21  
 import org.kuali.rice.core.web.format.Formatter;
 22  
 import org.kuali.rice.krad.bo.DataObjectRelationship;
 23  
 import org.kuali.rice.krad.bo.KualiCode;
 24  
 import org.kuali.rice.krad.datadictionary.AttributeDefinition;
 25  
 import org.kuali.rice.krad.datadictionary.AttributeSecurity;
 26  
 import org.kuali.rice.krad.datadictionary.validation.constraint.CaseConstraint;
 27  
 import org.kuali.rice.krad.datadictionary.validation.constraint.MustOccurConstraint;
 28  
 import org.kuali.rice.krad.datadictionary.validation.constraint.PrerequisiteConstraint;
 29  
 import org.kuali.rice.krad.datadictionary.validation.constraint.SimpleConstraint;
 30  
 import org.kuali.rice.krad.datadictionary.validation.constraint.ValidCharactersConstraint;
 31  
 import org.kuali.rice.krad.keyvalues.KeyValuesFinder;
 32  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 33  
 import org.kuali.rice.krad.uif.UifConstants;
 34  
 import org.kuali.rice.krad.uif.control.MultiValueControl;
 35  
 import org.kuali.rice.krad.uif.control.UifKeyValuesFinder;
 36  
 import org.kuali.rice.krad.uif.util.ComponentFactory;
 37  
 import org.kuali.rice.krad.uif.view.FormView;
 38  
 import org.kuali.rice.krad.uif.view.View;
 39  
 import org.kuali.rice.krad.uif.control.Control;
 40  
 import org.kuali.rice.krad.uif.control.MultiValueControlBase;
 41  
 import org.kuali.rice.krad.uif.component.BindingInfo;
 42  
 import org.kuali.rice.krad.uif.component.Component;
 43  
 import org.kuali.rice.krad.uif.component.DataBinding;
 44  
 import org.kuali.rice.krad.uif.util.ClientValidationUtils;
 45  
 import org.kuali.rice.krad.uif.util.ComponentUtils;
 46  
 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
 47  
 import org.kuali.rice.krad.uif.util.ViewModelUtils;
 48  
 import org.kuali.rice.krad.uif.view.ViewModel;
 49  
 import org.kuali.rice.krad.uif.widget.DirectInquiry;
 50  
 import org.kuali.rice.krad.uif.widget.Inquiry;
 51  
 import org.kuali.rice.krad.uif.widget.QuickFinder;
 52  
 import org.kuali.rice.krad.uif.widget.Suggest;
 53  
 import org.kuali.rice.krad.util.KRADPropertyConstants;
 54  
 import org.kuali.rice.krad.util.ObjectUtils;
 55  
 import org.kuali.rice.krad.valuefinder.ValueFinder;
 56  
 
 57  
 import java.util.ArrayList;
 58  
 import java.util.List;
 59  
 
 60  
 /**
 61  
  * Field that encapsulates data input/output captured by an attribute within the
 62  
  * application
 63  
  *
 64  
  * <p>                                                                                                                                    R
 65  
  * The <code>AttributField</code> provides the majority of the data input/output
 66  
  * for the screen. Through these fields the model can be displayed and updated.
 67  
  * For data input, the field contains a <code>Control</code> instance will
 68  
  * render an HTML control element(s). The attribute field also contains a
 69  
  * <code>LabelField</code>, summary, and widgets such as a quickfinder (for
 70  
  * looking up values) and inquiry (for getting more information on the value).
 71  
  * <code>InputField</code> instances can have associated messages (errors)
 72  
  * due to invalid input or business rule failures. Security can also be
 73  
  * configured to restrict who may view the fields value.
 74  
  * </p>
 75  
  *
 76  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 77  
  */
 78  
 public class InputField extends DataField {
 79  
     private static final long serialVersionUID = -3703656713706343840L;
 80  
 
 81  
     // constraint variables
 82  
     private String customValidatorClass;
 83  
     private ValidCharactersConstraint validCharactersConstraint;
 84  
     private CaseConstraint caseConstraint;
 85  
     private List<PrerequisiteConstraint> dependencyConstraints;
 86  
     private List<MustOccurConstraint> mustOccurConstraints;
 87  
     private SimpleConstraint simpleConstraint;
 88  
 
 89  
     // display props
 90  
     private Control control;
 91  
     private KeyValuesFinder optionsFinder;
 92  
     private boolean performUppercase;
 93  
 
 94  
     private String errorMessagePlacement;
 95  
     private ErrorsField errorsField;
 96  
 
 97  
     // messages
 98  
     private String constraintText;
 99  
     private String instructionalText;
 100  
 
 101  
     private MessageField instructionalMessageField;
 102  
     private MessageField constraintMessageField;
 103  
 
 104  
     private AttributeQuery fieldAttributeQuery;
 105  
 
 106  
     // widgets
 107  
     private QuickFinder fieldLookup;
 108  
     private DirectInquiry fieldDirectInquiry;
 109  
     private Suggest fieldSuggest;
 110  
 
 111  
     public InputField() {
 112  2
         super();
 113  
 
 114  2
         simpleConstraint = new SimpleConstraint();
 115  2
     }
 116  
 
 117  
     /**
 118  
      * The following actions are performed:
 119  
      *
 120  
      * <ul>
 121  
      * <li>Set the ids for the various attribute components</li>
 122  
      * <li>Sets up the client side validation for constraints on this field. In
 123  
      * addition, it sets up the messages applied to this field</li>
 124  
      * </ul>
 125  
      *
 126  
      * @see org.kuali.rice.krad.uif.component.ComponentBase#performFinalize(org.kuali.rice.krad.uif.view.View,
 127  
      *      java.lang.Object, org.kuali.rice.krad.uif.component.Component)
 128  
      */
 129  
     @Override
 130  
     public void performFinalize(View view, Object model, Component parent) {
 131  0
         super.performFinalize(view, model, parent);
 132  
 
 133  0
         setupIds();
 134  
 
 135  
         // invoke options finder if options not configured on the control
 136  0
         List<KeyValue> fieldOptions = new ArrayList<KeyValue>();
 137  
 
 138  
         // use options directly configured on the control first
 139  0
         if ((control != null) && control instanceof MultiValueControlBase) {
 140  0
             MultiValueControlBase multiValueControl = (MultiValueControlBase) control;
 141  0
             if ((multiValueControl.getOptions() != null) && !multiValueControl.getOptions().isEmpty()) {
 142  0
                 fieldOptions = multiValueControl.getOptions();
 143  
             }
 144  
         }
 145  
 
 146  
         // if options not configured on the control, invoke configured options finder
 147  0
         if (fieldOptions.isEmpty() && (optionsFinder != null)) {
 148  0
             if (optionsFinder instanceof UifKeyValuesFinder) {
 149  0
                 fieldOptions = ((UifKeyValuesFinder) optionsFinder).getKeyValues((ViewModel) model);
 150  
 
 151  
                 // check if blank option should be added
 152  0
                 if (((UifKeyValuesFinder) optionsFinder).isAddBlankOption()) {
 153  0
                     fieldOptions.add(0, new ConcreteKeyValue("", ""));
 154  
                 }
 155  
             } else {
 156  0
                 fieldOptions = optionsFinder.getKeyValues();
 157  
             }
 158  
 
 159  0
             if ((control != null) && control instanceof MultiValueControlBase) {
 160  0
                ((MultiValueControlBase) control).setOptions(fieldOptions);
 161  
             }
 162  
         }
 163  
 
 164  
         // if read only do key/value translation if necessary (if alternative and additional properties not set)
 165  0
         if (isReadOnly()
 166  
                 && !fieldOptions.isEmpty()
 167  
                 && StringUtils.isBlank(getAlternateDisplayValue())
 168  
                 && StringUtils.isBlank(getAdditionalDisplayValue())
 169  
                 && StringUtils.isBlank(getAlternateDisplayPropertyName())
 170  
                 && StringUtils.isBlank(getAdditionalDisplayPropertyName())) {
 171  
 
 172  0
             Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath());
 173  0
             for (KeyValue keyValue : fieldOptions) {
 174  0
                 if (StringUtils.equals((String) fieldValue, keyValue.getKey())) {
 175  0
                     setAlternateDisplayValue(keyValue.getValue());
 176  0
                     break;
 177  
                 }
 178  
             }
 179  
         }
 180  
 
 181  
         // if read only or the control is null no input can be given so no need to setup validation
 182  0
         if (isReadOnly() || getControl() == null) {
 183  0
             return;
 184  
         }
 185  
 
 186  
         // Sets message
 187  0
         if (StringUtils.isNotBlank(instructionalText)) {
 188  0
             instructionalMessageField.setMessageText(instructionalText);
 189  
         }
 190  
 
 191  
         // Sets constraints
 192  0
         if (StringUtils.isNotBlank(constraintText)) {
 193  0
             constraintMessageField.setMessageText(constraintText);
 194  
         }
 195  
 
 196  
         // adjust paths on PrerequisiteConstraint property names
 197  0
         adjustPrerequisiteConstraintBinding(dependencyConstraints);
 198  
 
 199  
         // adjust paths on MustOccurConstraints property names
 200  0
         adjustMustOccurConstraintBinding(mustOccurConstraints);
 201  
 
 202  
         // adjust paths on CaseConstraint property names
 203  0
         if (caseConstraint != null) {
 204  0
             String propertyName = getBindingInfo().getPropertyAdjustedBindingPath(caseConstraint.getPropertyName());
 205  0
             caseConstraint.setPropertyName(propertyName);
 206  
         }        
 207  
 
 208  0
         setupFieldQuery();
 209  
 
 210  0
         if (view instanceof FormView && ((FormView) view).isValidateClientSide()) {
 211  0
             ClientValidationUtils.processAndApplyConstraints(this, view);
 212  
         }
 213  0
     }
 214  
 
 215  
     protected void adjustMustOccurConstraintBinding(List<MustOccurConstraint> mustOccurConstraints) {
 216  0
         if (mustOccurConstraints != null) {
 217  0
             for (MustOccurConstraint mustOccurConstraint : mustOccurConstraints) {
 218  0
                 adjustPrerequisiteConstraintBinding(mustOccurConstraint.getPrerequisiteConstraints());
 219  0
                 adjustMustOccurConstraintBinding(mustOccurConstraint.getMustOccurConstraints());
 220  
             }
 221  
         }
 222  0
     }
 223  
 
 224  
     protected void adjustPrerequisiteConstraintBinding(List<PrerequisiteConstraint> prerequisiteConstraints) {
 225  0
         if (prerequisiteConstraints != null) {
 226  0
             for (PrerequisiteConstraint prerequisiteConstraint : prerequisiteConstraints) {
 227  0
                 String propertyName = getBindingInfo().getPropertyAdjustedBindingPath(prerequisiteConstraint.getPropertyName());
 228  0
                 prerequisiteConstraint.setPropertyName(propertyName);
 229  0
             }
 230  
         }
 231  0
     }
 232  
 
 233  
     /**
 234  
      * Performs setup of the field attribute query and informational display properties. Paths
 235  
      * are adjusted to match the binding for the this field, and the necessary onblur script for
 236  
      * triggering the query client side is constructed
 237  
      */
 238  
     protected void setupFieldQuery() {
 239  0
         if (getFieldAttributeQuery() != null) {
 240  
             // adjust paths on query mappings
 241  0
             getFieldAttributeQuery().updateQueryFieldMapping(getBindingInfo());
 242  0
             getFieldAttributeQuery().updateReturnFieldMapping(getBindingInfo());
 243  0
             getFieldAttributeQuery().updateQueryMethodArgumentFieldList(getBindingInfo());
 244  
 
 245  
             // build onblur script for field query
 246  0
             String script = "executeFieldQuery('" + getControl().getId() + "',";
 247  0
             script += "'" + getId() + "'," + getFieldAttributeQuery().getQueryFieldMappingJsString() + ",";
 248  0
             script += getFieldAttributeQuery().getQueryMethodArgumentFieldsJsString() + ",";
 249  0
             script += getFieldAttributeQuery().getReturnFieldMappingJsString() + ");";
 250  
 
 251  0
             if (StringUtils.isNotBlank(getControl().getOnBlurScript())) {
 252  0
                 script = getControl().getOnBlurScript() + script;
 253  
             }
 254  0
             getControl().setOnBlurScript(script);
 255  
         }
 256  0
     }
 257  
 
 258  
     /**
 259  
      * Sets the ids on all components the attribute field uses so they will all
 260  
      * contain this attribute's id in their ids. This is useful for jQuery
 261  
      * manipulation.
 262  
      */
 263  
     protected void setupIds() {
 264  
         // update ids so they all match the attribute
 265  0
         if (getControl() != null) {
 266  0
             getControl().setId(getId());
 267  
         }
 268  
 
 269  0
         setNestedComponentIdAndSuffix(getErrorsField(), UifConstants.IdSuffixes.ERRORS);
 270  0
         setNestedComponentIdAndSuffix(getLabelField(), UifConstants.IdSuffixes.LABEL);
 271  0
         setNestedComponentIdAndSuffix(getInstructionalMessageField(), UifConstants.IdSuffixes.INSTRUCTIONAL);
 272  0
         setNestedComponentIdAndSuffix(getConstraintMessageField(), UifConstants.IdSuffixes.CONSTRAINT);
 273  0
         setNestedComponentIdAndSuffix(getFieldLookup(), UifConstants.IdSuffixes.QUICK_FINDER);
 274  0
         setNestedComponentIdAndSuffix(getFieldDirectInquiry(), UifConstants.IdSuffixes.DIRECT_INQUIRY);
 275  0
         setNestedComponentIdAndSuffix(getFieldSuggest(), UifConstants.IdSuffixes.SUGGEST);
 276  
 
 277  0
         setId(getId() + UifConstants.IdSuffixes.ATTRIBUTE);
 278  0
     }
 279  
 
 280  
     /**
 281  
      * Helper method for suffixing the ids of the fields nested components
 282  
      *
 283  
      * @param component - component to adjust id for
 284  
      * @param suffix - suffix to append to id
 285  
      */
 286  
     private void setNestedComponentIdAndSuffix(Component component, String suffix) {
 287  0
         if (component != null) {
 288  0
             String fieldId = getId();
 289  0
             fieldId += suffix;
 290  
 
 291  0
             component.setId(fieldId);
 292  
         }
 293  0
     }
 294  
 
 295  
     /**
 296  
      * Defaults the properties of the <code>InputField</code> to the
 297  
      * corresponding properties of its <code>AttributeDefinition</code>
 298  
      * retrieved from the dictionary (if such an entry exists). If the field
 299  
      * already contains a value for a property, the definitions value is not
 300  
      * used.
 301  
      *
 302  
      * @param view - view instance the field belongs to
 303  
      * @param attributeDefinition - AttributeDefinition instance the property values should be
 304  
      * copied from
 305  
      */
 306  
     public void copyFromAttributeDefinition(View view, AttributeDefinition attributeDefinition) {
 307  0
         super.copyFromAttributeDefinition(view, attributeDefinition);
 308  
 
 309  
         // max length
 310  0
         if (getMaxLength() == null) {
 311  0
             setMaxLength(attributeDefinition.getMaxLength());
 312  
         }
 313  
 
 314  
         // min length
 315  0
         if (getMinLength() == null) {
 316  0
             setMinLength(attributeDefinition.getMinLength());
 317  
         }
 318  
 
 319  
         // valid characters
 320  0
         if (getValidCharactersConstraint() == null) {
 321  0
             setValidCharactersConstraint(attributeDefinition.getValidCharactersConstraint());
 322  
         }
 323  
 
 324  0
         if (getCaseConstraint() == null) {
 325  0
             setCaseConstraint(attributeDefinition.getCaseConstraint());
 326  
         }
 327  
 
 328  0
         if (getDependencyConstraints() == null) {
 329  0
             setDependencyConstraints(attributeDefinition.getPrerequisiteConstraints());
 330  
         }
 331  
 
 332  0
         if (getMustOccurConstraints() == null) {
 333  0
             setMustOccurConstraints(attributeDefinition.getMustOccurConstraints());
 334  
         }
 335  
 
 336  
         // required
 337  0
         if (getRequired() == null) {
 338  0
             setRequired(attributeDefinition.isRequired());
 339  
 
 340  
             //if still null, default to false
 341  0
             if (getRequired() == null) {
 342  0
                 setRequired(false);
 343  
             }
 344  
         }
 345  
 
 346  
         // control
 347  0
         if ((getControl() == null) && (attributeDefinition.getControlField() != null)) {
 348  0
             Control control = attributeDefinition.getControlField();
 349  0
             view.assignComponentIds(control);
 350  
 
 351  0
             setControl(ComponentUtils.copy(control));
 352  
         }
 353  
 
 354  
         // constraint
 355  0
         if (StringUtils.isEmpty(getConstraintText())) {
 356  0
             setConstraintText(attributeDefinition.getConstraintText());
 357  0
             getConstraintMessageField().setMessageText(attributeDefinition.getConstraintText());
 358  
         }
 359  
 
 360  
         // options
 361  0
         if (getOptionsFinder() == null) {
 362  0
             setOptionsFinder(attributeDefinition.getOptionsFinder());
 363  
         }
 364  0
     }
 365  
 
 366  
     /**
 367  
      * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentsForLifecycle()
 368  
      */
 369  
     @Override
 370  
     public List<Component> getComponentsForLifecycle() {
 371  0
         List<Component> components = super.getComponentsForLifecycle();
 372  
 
 373  0
         components.add(control);
 374  0
         components.add(errorsField);
 375  0
         components.add(fieldLookup);
 376  0
         components.add(fieldDirectInquiry);
 377  0
         components.add(fieldSuggest);
 378  
 
 379  0
         return components;
 380  
     }
 381  
 
 382  
     /**
 383  
      * @see DataField#isInputAllowed()
 384  
      */
 385  
     @Override
 386  
     public boolean isInputAllowed() {
 387  0
         return true;
 388  
     }
 389  
 
 390  
     /**
 391  
      * <code>Control</code> instance that should be used to input data for the
 392  
      * field
 393  
      *
 394  
      * <p>
 395  
      * When the field is editable, the control will be rendered so the user can
 396  
      * input a value(s). Controls typically are part of a Form and render
 397  
      * standard HTML control elements such as text input, select, and checkbox
 398  
      * </p>
 399  
      *
 400  
      * @return Control instance
 401  
      */
 402  
     public Control getControl() {
 403  0
         return this.control;
 404  
     }
 405  
 
 406  
     /**
 407  
      * Setter for the field's control
 408  
      *
 409  
      * @param control
 410  
      */
 411  
     public void setControl(Control control) {
 412  0
         this.control = control;
 413  0
     }
 414  
 
 415  
     public String getErrorMessagePlacement() {
 416  0
         return this.errorMessagePlacement;
 417  
     }
 418  
 
 419  
     public void setErrorMessagePlacement(String errorMessagePlacement) {
 420  0
         this.errorMessagePlacement = errorMessagePlacement;
 421  0
     }
 422  
 
 423  
     /**
 424  
      * Field that contains the messages (errors) for the attribute field. The
 425  
      * <code>ErrorsField</code> holds configuration on associated messages along
 426  
      * with information on rendering the messages in the user interface
 427  
      *
 428  
      * @return ErrorsField instance
 429  
      */
 430  
     public ErrorsField getErrorsField() {
 431  0
         return this.errorsField;
 432  
     }
 433  
 
 434  
     /**
 435  
      * Setter for the attribute field's errors field
 436  
      *
 437  
      * @param errorsField
 438  
      */
 439  
     public void setErrorsField(ErrorsField errorsField) {
 440  0
         this.errorsField = errorsField;
 441  0
     }
 442  
 
 443  
     /**
 444  
      * Instance of <code>KeyValluesFinder</code> that should be invoked to
 445  
      * provide a List of values the field can have. Generally used to provide
 446  
      * the options for a multi-value control or to validate the submitted field
 447  
      * value
 448  
      *
 449  
      * @return KeyValuesFinder instance
 450  
      */
 451  
     public KeyValuesFinder getOptionsFinder() {
 452  0
         return this.optionsFinder;
 453  
     }
 454  
 
 455  
     /**
 456  
      * Setter for the field's KeyValuesFinder instance
 457  
      *
 458  
      * @param optionsFinder
 459  
      */
 460  
     public void setOptionsFinder(KeyValuesFinder optionsFinder) {
 461  0
         this.optionsFinder = optionsFinder;
 462  0
     }
 463  
 
 464  
     /**
 465  
      * Setter that takes in the class name for the options finder and creates a
 466  
      * new instance to use as the finder for the attribute field
 467  
      *
 468  
      * @param optionsFinderClass
 469  
      */
 470  
     public void setOptionsFinderClass(Class<? extends KeyValuesFinder> optionsFinderClass) {
 471  0
         this.optionsFinder = ObjectUtils.newInstance(optionsFinderClass);
 472  0
     }
 473  
 
 474  
     /**
 475  
      * Text explaining how to use the field, including things like what values should be selected
 476  
      * in certain cases and so on (instructions)
 477  
      *
 478  
      * @return String instructional message
 479  
      */
 480  
     public String getInstructionalText() {
 481  0
         return this.instructionalText;
 482  
     }
 483  
 
 484  
     /**
 485  
      * Setter for the instructional message
 486  
      *
 487  
      * @param instructionalText
 488  
      */
 489  
     public void setInstructionalText(String instructionalText) {
 490  0
         this.instructionalText = instructionalText;
 491  0
     }
 492  
 
 493  
     /**
 494  
      * @see org.kuali.rice.krad.uif.component.ComponentBase#getSupportsOnLoad()
 495  
      */
 496  
     @Override
 497  
     public boolean getSupportsOnLoad() {
 498  0
         return true;
 499  
     }
 500  
 
 501  
     /**
 502  
      * Lookup finder widget for the field
 503  
      *
 504  
      * <p>
 505  
      * The quickfinder widget places a small icon next to the field that allows
 506  
      * the user to bring up a search screen for finding valid field values. The
 507  
      * <code>Widget</code> instance can be configured to point to a certain
 508  
      * <code>LookupView</code>, or the framework will attempt to associate the
 509  
      * field with a lookup based on its metadata (in particular its
 510  
      * relationships in the model)
 511  
      * </p>
 512  
      *
 513  
      * @return QuickFinder lookup widget
 514  
      */
 515  
     public QuickFinder getFieldLookup() {
 516  0
         return this.fieldLookup;
 517  
     }
 518  
 
 519  
     /**
 520  
      * Setter for the lookup widget
 521  
      *
 522  
      * @param fieldLookup
 523  
      */
 524  
     public void setFieldLookup(QuickFinder fieldLookup) {
 525  0
         this.fieldLookup = fieldLookup;
 526  0
     }
 527  
 
 528  
     /**
 529  
      * Suggest box widget for the attribute field
 530  
      *
 531  
      * <p>
 532  
      * If enabled (by render flag), as the user inputs data into the
 533  
      * fields control a dynamic query is performed to provide the user
 534  
      * suggestions on values which they can then select
 535  
      * </p>
 536  
      *
 537  
      * <p>
 538  
      * Note the Suggest widget is only valid when using a standard TextControl
 539  
      * </p>
 540  
      *
 541  
      * @return Suggest instance
 542  
      */
 543  
     public Suggest getFieldSuggest() {
 544  0
         return fieldSuggest;
 545  
     }
 546  
 
 547  
     /**
 548  
      * Setter for the fields Suggest widget
 549  
      *
 550  
      * @param fieldSuggest
 551  
      */
 552  
     public void setFieldSuggest(Suggest fieldSuggest) {
 553  0
         this.fieldSuggest = fieldSuggest;
 554  0
     }
 555  
 
 556  
     /**
 557  
      * Message field that displays instructional text
 558  
      *
 559  
      * <p>
 560  
      * This message field can be configured to for adjusting how the instructional text will display. Generally
 561  
      * the styleClasses property will be of most interest
 562  
      * </p>
 563  
      *
 564  
      * @return MessageField instructional message field
 565  
      */
 566  
     public MessageField getInstructionalMessageField() {
 567  0
         return this.instructionalMessageField;
 568  
     }
 569  
 
 570  
     /**
 571  
      * Setter for the instructional text message field
 572  
      *
 573  
      * <p>
 574  
      * Note this is the setter for the field that will render the instructional text. The actual text can be
 575  
      * set on the field but can also be set using {@link #setInstructionalText(String)}
 576  
      * </p>
 577  
      *
 578  
      * @param instructionalMessageField
 579  
      */
 580  
     public void setInstructionalMessageField(MessageField instructionalMessageField) {
 581  0
         this.instructionalMessageField = instructionalMessageField;
 582  0
     }
 583  
 
 584  
     /**
 585  
      * Text that display a restriction on the value a field can hold
 586  
      *
 587  
      * <p>
 588  
      * For example when the value must be a valid format (phone number, email), certain length, min/max value and
 589  
      * so on this text can be used to indicate the constraint to the user. Generally displays with the control so
 590  
      * it is visible when the user tabs to the field
 591  
      * </p>
 592  
      *
 593  
      * @return String text to display for the constraint message
 594  
      */
 595  
     public String getConstraintText() {
 596  0
         return this.constraintText;
 597  
     }
 598  
 
 599  
     /**
 600  
      * Setter for the constraint message text
 601  
      *
 602  
      * @param constraintText
 603  
      */
 604  
     public void setConstraintText(String constraintText) {
 605  0
         this.constraintText = constraintText;
 606  0
     }
 607  
 
 608  
     /**
 609  
      * Message field that displays constraint text
 610  
      *
 611  
      * <p>
 612  
      * This message field can be configured to for adjusting how the constrain text will display. Generally
 613  
      * the styleClasses property will be of most interest
 614  
      * </p>
 615  
      *
 616  
      * @return MessageField constraint message field
 617  
      */
 618  
     public MessageField getConstraintMessageField() {
 619  0
         return this.constraintMessageField;
 620  
     }
 621  
 
 622  
     /**
 623  
      * Setter for the constraint text message field
 624  
      *
 625  
      * <p>
 626  
      * Note this is the setter for the field that will render the constraint text. The actual text can be
 627  
      * set on the field but can also be set using {@link #setConstraintText(String)}
 628  
      * </p>
 629  
      *
 630  
      * @param constraintMessageField
 631  
      */
 632  
     public void setConstraintMessageField(MessageField constraintMessageField) {
 633  0
         this.constraintMessageField = constraintMessageField;
 634  0
     }
 635  
 
 636  
     /**
 637  
      * Valid character constraint that defines regular expressions for the valid
 638  
      * characters for this field
 639  
      *
 640  
      * @return the validCharactersConstraint
 641  
      */
 642  
     public ValidCharactersConstraint getValidCharactersConstraint() {
 643  0
         return this.validCharactersConstraint;
 644  
     }
 645  
 
 646  
     /**
 647  
      * @param validCharactersConstraint the validCharactersConstraint to set
 648  
      */
 649  
     public void setValidCharactersConstraint(ValidCharactersConstraint validCharactersConstraint) {
 650  0
         this.validCharactersConstraint = validCharactersConstraint;
 651  0
     }
 652  
 
 653  
     /**
 654  
      * @return the caseConstraint
 655  
      */
 656  
     public CaseConstraint getCaseConstraint() {
 657  0
         return this.caseConstraint;
 658  
     }
 659  
 
 660  
     /**
 661  
      * @param caseConstraint the caseConstraint to set
 662  
      */
 663  
     public void setCaseConstraint(CaseConstraint caseConstraint) {
 664  0
         this.caseConstraint = caseConstraint;
 665  0
     }
 666  
 
 667  
     /**
 668  
      * @return the dependencyConstraints
 669  
      */
 670  
     public List<PrerequisiteConstraint> getDependencyConstraints() {
 671  0
         return this.dependencyConstraints;
 672  
     }
 673  
 
 674  
     /**
 675  
      * @param dependencyConstraints the dependencyConstraints to set
 676  
      */
 677  
     public void setDependencyConstraints(List<PrerequisiteConstraint> dependencyConstraints) {
 678  0
         this.dependencyConstraints = dependencyConstraints;
 679  0
     }
 680  
 
 681  
     /**
 682  
      * @return the mustOccurConstraints
 683  
      */
 684  
     public List<MustOccurConstraint> getMustOccurConstraints() {
 685  0
         return this.mustOccurConstraints;
 686  
     }
 687  
 
 688  
     /**
 689  
      * @param mustOccurConstraints the mustOccurConstraints to set
 690  
      */
 691  
     public void setMustOccurConstraints(List<MustOccurConstraint> mustOccurConstraints) {
 692  0
         this.mustOccurConstraints = mustOccurConstraints;
 693  0
     }
 694  
 
 695  
     /**
 696  
      * A simple constraint which store the values for required, min/max length,
 697  
      * and min/max value
 698  
      *
 699  
      * @return the simpleConstraint
 700  
      */
 701  
     public SimpleConstraint getSimpleConstraint() {
 702  0
         return this.simpleConstraint;
 703  
     }
 704  
 
 705  
     /**
 706  
      * When a simple constraint is set on this object ALL simple validation
 707  
      * constraints set directly will be overridden - recommended to use this or
 708  
      * the other gets/sets for defining simple constraints, not both
 709  
      *
 710  
      * @param simpleConstraint the simpleConstraint to set
 711  
      */
 712  
     public void setSimpleConstraint(SimpleConstraint simpleConstraint) {
 713  0
         this.simpleConstraint = simpleConstraint;
 714  0
     }
 715  
 
 716  
     /**
 717  
      * Maximum number of the characters the attribute value is allowed to have.
 718  
      * Used to set the maxLength for supporting controls. Note this can be
 719  
      * smaller or longer than the actual control size
 720  
      *
 721  
      * @return Integer max length
 722  
      */
 723  
     public Integer getMaxLength() {
 724  0
         return simpleConstraint.getMaxLength();
 725  
     }
 726  
 
 727  
     /**
 728  
      * Setter for attributes max length
 729  
      *
 730  
      * @param maxLength
 731  
      */
 732  
     public void setMaxLength(Integer maxLength) {
 733  0
         simpleConstraint.setMaxLength(maxLength);
 734  0
     }
 735  
 
 736  
     /**
 737  
      * @return the minLength
 738  
      */
 739  
     public Integer getMinLength() {
 740  0
         return simpleConstraint.getMinLength();
 741  
     }
 742  
 
 743  
     /**
 744  
      * @param minLength the minLength to set
 745  
      */
 746  
     public void setMinLength(Integer minLength) {
 747  0
         simpleConstraint.setMinLength(minLength);
 748  0
     }
 749  
 
 750  
     /**
 751  
      * @see org.kuali.rice.krad.uif.component.ComponentBase#getRequired()
 752  
      */
 753  
     @Override
 754  
     public Boolean getRequired() {
 755  0
         return this.simpleConstraint.getRequired();
 756  
     }
 757  
 
 758  
     /**
 759  
      * @see org.kuali.rice.krad.uif.component.ComponentBase#setRequired(java.lang.Boolean)
 760  
      */
 761  
     @Override
 762  
     public void setRequired(Boolean required) {
 763  0
         this.simpleConstraint.setRequired(required);
 764  0
     }
 765  
 
 766  
     /**
 767  
      * The exclusiveMin element determines the minimum allowable value for data
 768  
      * entry editing purposes. Value can be an integer or decimal value such as
 769  
      * -.001 or 99.
 770  
      */
 771  
     public String getExclusiveMin() {
 772  0
         return simpleConstraint.getExclusiveMin();
 773  
     }
 774  
 
 775  
     /**
 776  
      * @param exclusiveMin the minValue to set
 777  
      */
 778  
     public void setExclusiveMin(String exclusiveMin) {
 779  0
         simpleConstraint.setExclusiveMin(exclusiveMin);
 780  0
     }
 781  
 
 782  
     /**
 783  
      * The inclusiveMax element determines the maximum allowable value for data
 784  
      * entry editing purposes. Value can be an integer or decimal value such as
 785  
      * -.001 or 99.
 786  
      */
 787  
     public String getInclusiveMax() {
 788  0
         return simpleConstraint.getInclusiveMax();
 789  
     }
 790  
 
 791  
     /**
 792  
      * @param inclusiveMax the maxValue to set
 793  
      */
 794  
     public void setInclusiveMax(String inclusiveMax) {
 795  0
         simpleConstraint.setInclusiveMax(inclusiveMax);
 796  0
     }
 797  
 
 798  
     /**
 799  
      * Setter for the direct inquiry widget
 800  
      *
 801  
      * @param fieldDirectInquiry - field DirectInquiry to set
 802  
      */
 803  
     public void setFieldDirectInquiry(DirectInquiry fieldDirectInquiry) {
 804  0
         this.fieldDirectInquiry = fieldDirectInquiry;
 805  0
     }
 806  
 
 807  
     /**
 808  
      * DirectInquiry widget for the field
 809  
      *
 810  
      * <p>
 811  
      * The direct inquiry widget will render a button for the field value when
 812  
      * that field is editable. It points to the associated inquiry view for the
 813  
      * field. The inquiry can be configured to point to a certain
 814  
      * <code>InquiryView</code>, or the framework will attempt to associate the
 815  
      * field with a inquiry based on its metadata (in particular its
 816  
      * relationships in the model)
 817  
      * </p>
 818  
      *
 819  
      * @return the <code>DirectInquiry</code> field DirectInquiry
 820  
      */
 821  
     public DirectInquiry getFieldDirectInquiry() {
 822  0
         return fieldDirectInquiry;
 823  
     }
 824  
 
 825  
     /**
 826  
      * Attribute query instance configured for this field to dynamically pull information back for
 827  
      * updates other fields or providing messages
 828  
      *
 829  
      * <p>
 830  
      * If field attribute query is not null, associated event script will be generated to trigger the
 831  
      * query from the UI. This will invoke the <code>AttributeQueryService</code> to
 832  
      * execute the query and return an instance of <code>AttributeQueryResult</code> that is then
 833  
      * read by the script to update the UI. Typically used to update informational property values or
 834  
      * other field values
 835  
      * </p>
 836  
      *
 837  
      * @return AttributeQuery instance
 838  
      */
 839  
     public AttributeQuery getFieldAttributeQuery() {
 840  0
         return fieldAttributeQuery;
 841  
     }
 842  
 
 843  
     /**
 844  
      * Setter for this fields query
 845  
      *
 846  
      * @param fieldAttributeQuery
 847  
      */
 848  
     public void setFieldAttributeQuery(AttributeQuery fieldAttributeQuery) {
 849  0
         this.fieldAttributeQuery = fieldAttributeQuery;
 850  0
     }
 851  
 
 852  
     /**
 853  
      * Perform uppercase flag for this field to force input to uppercase.
 854  
      *
 855  
      * <p>
 856  
      * It this flag is set to true the 'text-transform' style on the field will be set to 'uppercase'
 857  
      * which will automatically change any text input into the field to uppercase.
 858  
      * </p>
 859  
      *
 860  
      * @return performUppercase flag
 861  
      */
 862  
     public boolean isPerformUppercase() {
 863  0
         return performUppercase;
 864  
     }
 865  
 
 866  
     /**
 867  
      * Setter for this fields performUppercase flag
 868  
      *
 869  
      * @param performUppercase flag
 870  
      */
 871  
     public void setPerformUppercase(boolean performUppercase) {
 872  0
         this.performUppercase = performUppercase;
 873  0
     }
 874  
 }