Coverage Report - org.kuali.rice.krad.uif.field.ErrorsField
 
Classes in this File Line Coverage Branch Coverage Complexity
ErrorsField
0%
0/181
0%
0/90
1.865
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl1.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.krad.uif.field;
 17  
 
 18  
 import java.text.MessageFormat;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Arrays;
 21  
 import java.util.List;
 22  
 
 23  
 import org.apache.commons.lang.StringUtils;
 24  
 import org.kuali.rice.core.api.config.property.ConfigurationService;
 25  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 26  
 import org.kuali.rice.krad.uif.container.ContainerBase;
 27  
 import org.kuali.rice.krad.uif.container.PageGroup;
 28  
 import org.kuali.rice.krad.uif.container.View;
 29  
 import org.kuali.rice.krad.uif.core.Component;
 30  
 import org.kuali.rice.krad.util.ErrorMessage;
 31  
 import org.kuali.rice.krad.util.GlobalVariables;
 32  
 import org.kuali.rice.krad.util.MessageMap;
 33  
 import org.springframework.util.AutoPopulatingList;
 34  
 
 35  
 /**
 36  
  * Field that displays error, warning, and info messages for the keys that are
 37  
  * matched. By default, an ErrorsField will match on id and bindingPath (if this
 38  
  * ErrorsField is for an AttributeField), but can be set to match on
 39  
  * additionalKeys and nested components keys (of the its parentComponent).
 40  
  * 
 41  
  * In addition, there are a variety of options which can be toggled to effect
 42  
  * the display of these messages during both client and server side validation
 43  
  * display. See documentation on each get method for more details on the effect
 44  
  * of each option.
 45  
  * 
 46  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 47  
  */
 48  
 public class ErrorsField extends FieldBase {
 49  
         private static final long serialVersionUID = 780940788435330077L;
 50  
 
 51  
         private List<String> additionalKeysToMatch;
 52  
 
 53  
         // Title variables
 54  
         private String errorTitle;
 55  
         private String warningTitle;
 56  
         private String infoTitle;
 57  
 
 58  
         private boolean displayErrorTitle;
 59  
         private boolean displayWarningTitle;
 60  
         private boolean displayInfoTitle;
 61  
 
 62  
         // Field variables
 63  
         private boolean highlightOnError;
 64  
         private boolean displayFieldErrorIcon;
 65  
 
 66  
         // Message construction variables
 67  
         private boolean displayFieldLabelWithMessages;
 68  
         private boolean combineMessages;
 69  
 
 70  
         // Message display flags
 71  
         private boolean displayNestedMessages;
 72  
         private boolean allowMessageRepeat;
 73  
 
 74  
         private boolean displayMessages;
 75  
         private boolean displayErrorMessages;
 76  
         private boolean displayInfoMessages;
 77  
         private boolean displayWarningMessages;
 78  
         private boolean displayCounts;
 79  
         private boolean alternateContainer;
 80  
 
 81  
         // Error messages
 82  
         private List<String> errors;
 83  
         private List<String> warnings;
 84  
         private List<String> infos;
 85  
 
 86  
         // Counts
 87  
         private int errorCount;
 88  
         private int warningCount;
 89  
         private int infoCount;
 90  
 
 91  
         // internal
 92  
         private int tempCount;
 93  
 
 94  
         // not used
 95  
         private boolean displayLockMessages;
 96  
 
 97  
         public ErrorsField() {
 98  0
                 super();
 99  0
         }
 100  
 
 101  
         /**
 102  
          * PerformFinalize will generate the messages and counts used by the
 103  
          * errorsField based on the keys that were matched from the MessageMap for
 104  
          * this ErrorsField. It will also set up nestedComponents of its
 105  
          * parentComponent correctly based on the flags that were chosen for this
 106  
          * ErrorsField.
 107  
          * 
 108  
          * @see org.kuali.rice.krad.uif.field.FieldBase#performFinalize(org.kuali.rice.krad.uif.container.View,
 109  
          *      java.lang.Object, org.kuali.rice.krad.uif.core.Component)
 110  
          */
 111  
         @Override
 112  
         public void performFinalize(View view, Object model, Component parent) {
 113  0
                 super.performFinalize(view, model, parent);
 114  
 
 115  0
                 List<String> masterKeyList = getKeys(parent);
 116  0
                 errors = new ArrayList<String>();
 117  0
                 warnings = new ArrayList<String>();
 118  0
                 infos = new ArrayList<String>();
 119  0
                 errorCount = 0;
 120  0
                 warningCount = 0;
 121  0
                 infoCount = 0;
 122  0
                 MessageMap messageMap = GlobalVariables.getMessageMap();
 123  
 
 124  0
                 if (!displayFieldLabelWithMessages) {
 125  0
                         this.addStyleClass("noLabels");
 126  
                 }
 127  0
                 if (!highlightOnError) {
 128  0
                         this.addStyleClass("noHighlight");
 129  
                 }
 130  0
                 if (displayFieldErrorIcon) {
 131  0
                         this.addStyleClass("addFieldIcon");
 132  
                 }
 133  
 
 134  0
                 if (displayMessages) {
 135  0
                         if (displayNestedMessages) {
 136  0
                                 this.addNestedKeys(masterKeyList, parent);
 137  
                         }
 138  
 
 139  0
                         for (String key : masterKeyList) {
 140  0
                                 if (displayErrorMessages) {
 141  0
                                         errors.addAll(getMessages(view, key,
 142  
                                                         messageMap.getErrorMessagesForProperty(key, true)));
 143  0
                                         errorCount = errorCount + tempCount;
 144  
                                 }
 145  0
                                 if (displayWarningMessages) {
 146  0
                                         warnings.addAll(getMessages(view, key,
 147  
                                                         messageMap.getWarningMessagesForProperty(key, true)));
 148  0
                                         warningCount = warningCount + tempCount;
 149  
                                 }
 150  0
                                 if (displayInfoMessages) {
 151  0
                                         infos.addAll(getMessages(view, key,
 152  
                                                         messageMap.getInfoMessagesForProperty(key, true)));
 153  0
                                         infoCount = infoCount + tempCount;
 154  
                                 }
 155  
                         }
 156  0
                 } else if (displayFieldErrorIcon) {
 157  
                         // Checks to see if any errors exist for this field, if they do set
 158  
                         // errorCount as positive
 159  
                         // so the jsp will call the corresponding js to show the icon
 160  
                         // messages do not need to be generated because they are not being shown
 161  0
                         for (String key : masterKeyList) {
 162  0
                                 if (!messageMap.getErrorMessagesForProperty(key, true)
 163  
                                                 .isEmpty()) {
 164  0
                                         errorCount = 1;
 165  0
                                         break;
 166  
                                 }
 167  
                         }
 168  
                 }
 169  
                 
 170  
                 //Check for errors that are not matched on the page(only applies when parent is page)
 171  0
                 if(parent instanceof PageGroup){
 172  0
                         if(errorCount < messageMap.getErrorCount()){
 173  0
                                 List<String> diff = messageMap.getPropertiesWithErrors();
 174  0
                                 diff.removeAll(masterKeyList);
 175  0
                                 for (String key : diff) {
 176  0
                                     errors.addAll(getMessages(view, key,
 177  
                             messageMap.getErrorMessagesForProperty(key, true)));
 178  0
                                     errorCount = errorCount+ tempCount;
 179  
                                 }
 180  
                                 
 181  
                         }
 182  0
                         if(warningCount < messageMap.getWarningCount()){
 183  0
                                 List<String> diff = messageMap.getPropertiesWithWarnings();
 184  0
                                 diff.removeAll(masterKeyList);
 185  0
                                 for (String key : diff) {
 186  0
                                     warnings.addAll(getMessages(view, key,
 187  
                             messageMap.getWarningMessagesForProperty(key, true)));
 188  0
                     warningCount = warningCount + tempCount;
 189  
                 }
 190  
                         }
 191  0
                         if(infoCount < messageMap.getInfoCount()){
 192  0
                                 List<String> diff = messageMap.getPropertiesWithInfo();
 193  0
                                 diff.removeAll(masterKeyList);
 194  0
                 for (String key : diff) {
 195  0
                     infos.addAll(getMessages(view, key,
 196  
                             messageMap.getInfoMessagesForProperty(key, true)));
 197  0
                     infoCount = infoCount + tempCount;
 198  
                 }
 199  
                         }
 200  
                 }
 201  
                 
 202  
                 // dont display anything if there are no messages
 203  0
                 if (errorCount + warningCount + infoCount == 0 || !displayMessages) {
 204  0
                         this.setStyle("display: none;");
 205  
                 } else {
 206  0
                         this.setStyle("display: visible");
 207  
                 }
 208  0
         }
 209  
 
 210  
         /**
 211  
          * Gets all the messages from the list of lists passed in (which are
 212  
          * lists of ErrorMessages associated to the key) and uses the configuration
 213  
          * service to get the message String associated. This will also combine
 214  
          * error messages per a field if that option is turned on. If
 215  
          * displayFieldLabelWithMessages is turned on, it will also find the label
 216  
          * by key passed in.
 217  
          * 
 218  
          * @param view
 219  
          * @param key
 220  
          * @param lists
 221  
          * @return
 222  
          */
 223  
         private List<String> getMessages(View view, String key,
 224  
                         List<AutoPopulatingList<ErrorMessage>> lists) {
 225  0
                 List<String> result = new ArrayList<String>();
 226  0
                 tempCount = 0;
 227  0
                 for (List<ErrorMessage> errorList : lists) {
 228  0
                         if (errorList != null && StringUtils.isNotBlank(key)) {
 229  0
                                 ConfigurationService configService = KRADServiceLocator
 230  
                                                 .getKualiConfigurationService();
 231  0
                                 String comboMessage = "";
 232  0
                                 String label = "";
 233  
 
 234  0
                                 for (ErrorMessage e : errorList) {
 235  0
                                         tempCount++;
 236  0
                                         String message = configService.getPropertyString(e
 237  
                                                         .getErrorKey());
 238  0
                                         if (e.getMessageParameters() != null) {
 239  0
                                                 message = message.replace("'", "''");
 240  0
                                                 message = MessageFormat.format(message,
 241  
                                                                 (Object[]) e.getMessageParameters());
 242  
                                         }
 243  0
                                         if (displayFieldLabelWithMessages) {
 244  0
                                                 AttributeField field = view.getViewIndex()
 245  
                                                                 .getAttributeFieldByPath(key);
 246  0
                                                 if (field != null && field.getLabel() != null) {
 247  0
                                                         label = field.getLabel();
 248  
                                                 }
 249  
                                                 else{
 250  0
                                                     label = key;
 251  
                                                 }
 252  
                                         }
 253  
 
 254  
                                         // adding them to combo string instead of the list
 255  0
                                         if (combineMessages) {
 256  0
                                                 if (comboMessage.isEmpty()) {
 257  0
                                                         comboMessage = message;
 258  
                                                 } else {
 259  0
                                                         comboMessage = comboMessage + ", " + message;
 260  
                                                 }
 261  
                                         } else {
 262  
                                                 // add it directly to the list - non combined messages
 263  0
                                                 if (StringUtils.isNotEmpty(label)) {
 264  0
                                                         result.add(label + " - " + message);
 265  
                                                 } else {
 266  0
                                                         result.add(message);
 267  
                                                 }
 268  
 
 269  
                                         }
 270  0
                                 }
 271  
                                 // add the single combo string to the returned list
 272  
                                 // combineMessages will also be checked in the template to
 273  
                                 // further
 274  
                                 // combine them
 275  0
                                 if (StringUtils.isNotEmpty(comboMessage)) {
 276  0
                                         if (StringUtils.isNotEmpty(label)) {
 277  0
                                                 result.add(label + " - " + comboMessage);
 278  
                                         } else {
 279  0
                                                 result.add(comboMessage);
 280  
                                         }
 281  
                                 }
 282  0
                         }
 283  
                 }
 284  
 
 285  0
                 return result;
 286  
         }
 287  
 
 288  
         /**
 289  
          * Gets all the keys associated to this ErrorsField. This includes the id of
 290  
          * the parent component, additional keys to match, and the bindingPath if
 291  
          * this is an ErrorsField for an AttributeField. These are the keys that are
 292  
          * used to match errors with their component and display them as part of its
 293  
          * ErrorsField.
 294  
          * 
 295  
          * @return
 296  
          */
 297  
         protected List<String> getKeys(Component parent) {
 298  0
                 List<String> keyList = new ArrayList<String>();
 299  0
                 if (additionalKeysToMatch != null) {
 300  0
                         keyList.addAll(additionalKeysToMatch);
 301  
                 }
 302  0
                 if (StringUtils.isNotBlank(parent.getId())) {
 303  0
                         keyList.add(parent.getId());
 304  
                 }
 305  0
                 if (parent instanceof AttributeField) {
 306  0
                         if (((AttributeField) parent).getBindingInfo() != null
 307  
                                         && StringUtils.isNotEmpty(((AttributeField) parent)
 308  
                                                         .getBindingInfo().getBindingPath())) {
 309  0
                                 keyList.add(((AttributeField) parent).getBindingInfo()
 310  
                                                 .getBindingPath());
 311  
                         }
 312  
                 }
 313  
                 // Will there be additional components to check beyond AttributeField?
 314  
 
 315  0
                 return keyList;
 316  
         }
 317  
 
 318  
         /**
 319  
          * Adds all the nestedKeys of this component by calling getKeys on each of
 320  
          * its nestedComponents' ErrorsFields and adding them to the list. If
 321  
          * allowMessageRepeat is false, it will also turn off error display for its
 322  
          * parent's nestedComponents' ErrorsFields.
 323  
          * 
 324  
          * @param keyList
 325  
          * @param component
 326  
          */
 327  
         private void addNestedKeys(List<String> keyList, Component component) {
 328  0
                 for (Component c : component.getNestedComponents()) {
 329  0
                         ErrorsField ef = null;
 330  0
                         if (c instanceof AttributeField) {
 331  0
                                 ef = ((AttributeField) c).getErrorsField();
 332  0
                         } else if (c instanceof ContainerBase) {
 333  0
                                 ef = ((ContainerBase) c).getErrorsField();
 334  
                         }
 335  0
                         if (ef != null) {
 336  0
                                 if (!allowMessageRepeat) {
 337  0
                                         ef.setDisplayMessages(false);
 338  
                                 }
 339  0
                                 keyList.addAll(ef.getKeys(c));
 340  0
                                 addNestedKeys(keyList, c);
 341  
                         }
 342  0
                 }
 343  0
         }
 344  
 
 345  
         /**
 346  
          * ErrorTitle is the title that will be shown before any error
 347  
          * messages/error counts are displayed
 348  
          * 
 349  
          * @return
 350  
          */
 351  
         public String getErrorTitle() {
 352  0
                 return this.errorTitle;
 353  
         }
 354  
 
 355  
         public void setErrorTitle(String errorTitle) {
 356  0
                 this.errorTitle = errorTitle;
 357  0
         }
 358  
 
 359  
         /**
 360  
          * WarningTitle is the title that will be shown before any warning
 361  
          * messages/warning counts are displayed
 362  
          * 
 363  
          * @return
 364  
          */
 365  
         public String getWarningTitle() {
 366  0
                 return this.warningTitle;
 367  
         }
 368  
 
 369  
         public void setWarningTitle(String warningTitle) {
 370  0
                 this.warningTitle = warningTitle;
 371  0
         }
 372  
 
 373  
         /**
 374  
          * InfoTitle is the title that will be shown before any info messages/info
 375  
          * counts are displayed
 376  
          * 
 377  
          * @return
 378  
          */
 379  
         public String getInfoTitle() {
 380  0
                 return this.infoTitle;
 381  
         }
 382  
 
 383  
         public void setInfoTitle(String infoTitle) {
 384  0
                 this.infoTitle = infoTitle;
 385  0
         }
 386  
 
 387  
         /**
 388  
          * If displayErrorMessages is true, error messages will be displayed,
 389  
          * otherwise they will not. Unlike many of the options contained on
 390  
          * ErrorsField, this will not effect client side validations; ie this will
 391  
          * not turn off errorMessage display for client side validation, as it may
 392  
          * prevent a user from completing a form. To turn off client side validation
 393  
          * AND its messaging use the applyClientSide flag on the Constraint itself.
 394  
          * 
 395  
          * TODO this may be changed to: if this is set on a field it will attempt
 396  
          * show client side validation errors in the closest parent container error
 397  
          * container
 398  
          * 
 399  
          * @return
 400  
          */
 401  
         public boolean isDisplayErrorMessages() {
 402  0
                 return this.displayErrorMessages;
 403  
         }
 404  
 
 405  
         public void setDisplayErrorMessages(boolean displayErrorMessages) {
 406  0
                 this.displayErrorMessages = displayErrorMessages;
 407  0
         }
 408  
 
 409  
         /**
 410  
          * If displayInfoMessages is true, info messages will be displayed,
 411  
          * otherwise they will not. Client side validation has no concept of warning
 412  
          * or info messages, so this will not effect client side functionality.
 413  
          * 
 414  
          * @return
 415  
          */
 416  
         public boolean isDisplayInfoMessages() {
 417  0
                 return this.displayInfoMessages;
 418  
         }
 419  
 
 420  
         public void setDisplayInfoMessages(boolean displayInfoMessages) {
 421  0
                 this.displayInfoMessages = displayInfoMessages;
 422  0
         }
 423  
 
 424  
         public boolean isDisplayLockMessages() {
 425  0
                 return this.displayLockMessages;
 426  
         }
 427  
 
 428  
         /**
 429  
          * This has no use - needs to be removed(?)
 430  
          * 
 431  
          * @param displayLockMessages
 432  
          */
 433  
         public void setDisplayLockMessages(boolean displayLockMessages) {
 434  0
                 this.displayLockMessages = displayLockMessages;
 435  0
         }
 436  
 
 437  
         /**
 438  
          * If displayWarningMessages is true, warning messages will be displayed,
 439  
          * otherwise they will not. Client side validation has no concept of warning
 440  
          * or info messages, so this will not effect client side functionality.
 441  
          * 
 442  
          * @return
 443  
          */
 444  
         public boolean isDisplayWarningMessages() {
 445  0
                 return this.displayWarningMessages;
 446  
         }
 447  
 
 448  
         public void setDisplayWarningMessages(boolean displayWarningMessages) {
 449  0
                 this.displayWarningMessages = displayWarningMessages;
 450  0
         }
 451  
 
 452  
         /**
 453  
          * AdditionalKeysToMatch is an additional list of keys outside of the
 454  
          * default keys that will be matched when messages are returned after a form
 455  
          * is submitted. These keys are only used for displaying messages generated
 456  
          * by the server and have no effect on client side validation error display.
 457  
          * 
 458  
          * @return the additionalKeysToMatch
 459  
          */
 460  
         public List<String> getAdditionalKeysToMatch() {
 461  0
                 return this.additionalKeysToMatch;
 462  
         }
 463  
         
 464  
     /**
 465  
      * Convenience setter for additional keys to match that takes a string argument and
 466  
      * splits on comma to build the list
 467  
      * 
 468  
      * @param additionalKeysToMatch String to parse
 469  
      */
 470  
     public void setAdditionalKeysToMatch(String additionalKeysToMatch) {
 471  0
         if (StringUtils.isNotBlank(additionalKeysToMatch)) {
 472  0
             this.additionalKeysToMatch = Arrays.asList(StringUtils.split(additionalKeysToMatch, ","));
 473  
         }
 474  0
     }
 475  
 
 476  
         /**
 477  
          * @param additionalKeysToMatch
 478  
          *            the additionalKeysToMatch to set
 479  
          */
 480  
         public void setAdditionalKeysToMatch(List<String> additionalKeysToMatch) {
 481  0
                 this.additionalKeysToMatch = additionalKeysToMatch;
 482  0
         }
 483  
 
 484  
         /**
 485  
          * If true, the errorTitle set on this ErrorsField will be displayed along
 486  
          * with the error messages. Otherwise, the title will not be displayed.
 487  
          * 
 488  
          * @return the displayErrorTitle
 489  
          */
 490  
         public boolean isDisplayErrorTitle() {
 491  0
                 return this.displayErrorTitle;
 492  
         }
 493  
 
 494  
         /**
 495  
          * @param displayErrorTitle
 496  
          *            the displayErrorTitle to set
 497  
          */
 498  
         public void setDisplayErrorTitle(boolean displayErrorTitle) {
 499  0
                 this.displayErrorTitle = displayErrorTitle;
 500  0
         }
 501  
 
 502  
         /**
 503  
          * If true, the warningTitle set on this ErrorsField will be displayed along
 504  
          * with the warning messages. Otherwise, the title will not be displayed.
 505  
          * 
 506  
          * @return the displayWarningTitle
 507  
          */
 508  
         public boolean isDisplayWarningTitle() {
 509  0
                 return this.displayWarningTitle;
 510  
         }
 511  
 
 512  
         /**
 513  
          * @param displayWarningTitle
 514  
          *            the displayWarningTitle to set
 515  
          */
 516  
         public void setDisplayWarningTitle(boolean displayWarningTitle) {
 517  0
                 this.displayWarningTitle = displayWarningTitle;
 518  0
         }
 519  
 
 520  
         /**
 521  
          * If true, the infoTitle set on this ErrorsField will be displayed along
 522  
          * with the info messages. Otherwise, the title will not be displayed.
 523  
          * 
 524  
          * @return the displayInfoTitle
 525  
          */
 526  
         public boolean isDisplayInfoTitle() {
 527  0
                 return this.displayInfoTitle;
 528  
         }
 529  
 
 530  
         /**
 531  
          * @param displayInfoTitle
 532  
          *            the displayInfoTitle to set
 533  
          */
 534  
         public void setDisplayInfoTitle(boolean displayInfoTitle) {
 535  0
                 this.displayInfoTitle = displayInfoTitle;
 536  0
         }
 537  
 
 538  
         /**
 539  
          * If true, the error messages will display the an AttributeField's title
 540  
          * alongside the error, warning, and info messages related to it. This
 541  
          * setting has no effect on messages which do not relate directly to a
 542  
          * single AttributeField.
 543  
          * 
 544  
          * @return the displayFieldLabelWithMessages
 545  
          */
 546  
         public boolean isDisplayFieldLabelWithMessages() {
 547  0
                 return this.displayFieldLabelWithMessages;
 548  
         }
 549  
 
 550  
         /**
 551  
          * @param displayFieldLabelWithMessages
 552  
          *            the displayFieldLabelWithMessages to set
 553  
          */
 554  
         public void setDisplayFieldLabelWithMessages(
 555  
                         boolean displayFieldLabelWithMessages) {
 556  0
                 this.displayFieldLabelWithMessages = displayFieldLabelWithMessages;
 557  0
         }
 558  
 
 559  
         /**
 560  
          * If true, error, warning, and info messages will be displayed (provided
 561  
          * they are also set to display). Otherwise, no messages for this
 562  
          * ErrorsField container will be displayed (including ones set to display).
 563  
          * This is a global display on/off switch for all messages.
 564  
          * 
 565  
          * @return the displayMessages
 566  
          */
 567  
         public boolean isDisplayMessages() {
 568  0
                 return this.displayMessages;
 569  
         }
 570  
 
 571  
         /**
 572  
          * @param displayMessages
 573  
          *            the displayMessages to set
 574  
          */
 575  
         public void setDisplayMessages(boolean displayMessages) {
 576  0
                 this.displayMessages = displayMessages;
 577  0
         }
 578  
 
 579  
         /**
 580  
          * If true, this ErrorsField will show messages related to the nested
 581  
          * components of its parent component, and not just those related only to
 582  
          * its parent component. Otherwise, it will be up to the individual
 583  
          * components to display their messages, if any, in their ErrorsField.
 584  
          * 
 585  
          * @return the displayNestedMessages
 586  
          */
 587  
         public boolean isDisplayNestedMessages() {
 588  0
                 return this.displayNestedMessages;
 589  
         }
 590  
 
 591  
         /**
 592  
          * @param displayNestedMessages
 593  
          *            the displayNestedMessages to set
 594  
          */
 595  
         public void setDisplayNestedMessages(boolean displayNestedMessages) {
 596  0
                 this.displayNestedMessages = displayNestedMessages;
 597  0
         }
 598  
 
 599  
         /**
 600  
          * Combines the messages for a single key into one concatenated message per
 601  
          * key being matched, seperated by a comma
 602  
          * 
 603  
          * @return the combineMessages
 604  
          */
 605  
         public boolean isCombineMessages() {
 606  0
                 return this.combineMessages;
 607  
         }
 608  
 
 609  
         /**
 610  
          * @param combineMessages
 611  
          *            the combineMessages to set
 612  
          */
 613  
         public void setCombineMessages(boolean combineMessages) {
 614  0
                 this.combineMessages = combineMessages;
 615  0
         }
 616  
 
 617  
         /**
 618  
          * If true, when this is set on an ErrorsField whose parentComponent has
 619  
          * nested Containers or AttributeFields, it will allow those fields to also
 620  
          * show their ErrorsField messages. Otherwise, it will turn off the the
 621  
          * display of those messages. This can be used to avoid repeating
 622  
          * information to the user per field, if errors are already being displayed
 623  
          * at the parent's level. This flag has no effect if displayNestedMessages
 624  
          * is false on this ErrorsField.
 625  
          * 
 626  
          * @return the allowMessageRepeat
 627  
          */
 628  
         public boolean isAllowMessageRepeat() {
 629  0
                 return this.allowMessageRepeat;
 630  
         }
 631  
 
 632  
         /**
 633  
          * 
 634  
          * @param allowMessageRepeat
 635  
          *            the allowMessageRepeat to set
 636  
          */
 637  
         public void setAllowMessageRepeat(boolean allowMessageRepeat) {
 638  0
                 this.allowMessageRepeat = allowMessageRepeat;
 639  0
         }
 640  
 
 641  
         /**
 642  
          * displayCounts is true if the counts of errors, warning, and info messages
 643  
          * within this ErrorsField should be displayed (includes count of nested
 644  
          * messages if displayNestedMessages is true).
 645  
          * 
 646  
          * @return
 647  
          */
 648  
         public boolean isDisplayCounts() {
 649  0
                 return this.displayCounts;
 650  
         }
 651  
 
 652  
         /**
 653  
          * @param displayCounts
 654  
          *            the displayCounts to set
 655  
          */
 656  
         public void setDisplayCounts(boolean displayCounts) {
 657  0
                 this.displayCounts = displayCounts;
 658  0
         }
 659  
 
 660  
         /**
 661  
          * The list of error messages found for the keys that were matched on this
 662  
          * ErrorsField This is generated and cannot be set
 663  
          * 
 664  
          * @return the errors
 665  
          */
 666  
         public List<String> getErrors() {
 667  0
                 return this.errors;
 668  
         }
 669  
 
 670  
         /**
 671  
          * The list of warning messages found for the keys that were matched on this
 672  
          * ErrorsField This is generated and cannot be set
 673  
          * 
 674  
          * @return the warnings
 675  
          */
 676  
         public List<String> getWarnings() {
 677  0
                 return this.warnings;
 678  
         }
 679  
 
 680  
         /**
 681  
          * The list of info messages found for the keys that were matched on this
 682  
          * ErrorsField This is generated and cannot be set
 683  
          * 
 684  
          * @return the infos
 685  
          */
 686  
         public List<String> getInfos() {
 687  0
                 return this.infos;
 688  
         }
 689  
 
 690  
         /**
 691  
          * The count of error messages found for the keys that were matched on this
 692  
          * ErrorsField This is generated and cannot be set
 693  
          * 
 694  
          * @return the errorCount
 695  
          */
 696  
         public int getErrorCount() {
 697  0
                 return this.errorCount;
 698  
         }
 699  
 
 700  
         /**
 701  
          * The count of warning messages found for the keys that were matched on
 702  
          * this ErrorsField This is generated and cannot be set
 703  
          * 
 704  
          * @return the warningCount
 705  
          */
 706  
         public int getWarningCount() {
 707  0
                 return this.warningCount;
 708  
         }
 709  
 
 710  
         /**
 711  
          * The count of info messages found for the keys that were matched on this
 712  
          * ErrorsField This is generated and cannot be set
 713  
          * 
 714  
          * @return the infoCount
 715  
          */
 716  
         public int getInfoCount() {
 717  0
                 return this.infoCount;
 718  
         }
 719  
 
 720  
         /**
 721  
          * If this is true, the display of messages is being handled by another
 722  
          * container. The ErrorsField html generated by the jsp will still be used,
 723  
          * but it will be placed in different location within the page than the
 724  
          * default to accommodate an alternate layout. This flag is used by
 725  
          * BoxLayoutManager.
 726  
          * 
 727  
          * This flag only applies to ErrorsFields whose parentComponents are
 728  
          * AttributeFields.
 729  
          * 
 730  
          * @return the alternateContainer
 731  
          */
 732  
         public boolean isAlternateContainer() {
 733  0
                 return this.alternateContainer;
 734  
         }
 735  
 
 736  
         /**
 737  
          * @param alternateContainer
 738  
          *            the alternateContainer to set
 739  
          */
 740  
         public void setAlternateContainer(boolean alternateContainer) {
 741  0
                 this.alternateContainer = alternateContainer;
 742  0
         }
 743  
 
 744  
         /**
 745  
          * If true, displays an icon next to each field that has an error (default
 746  
          * KNS look). Otherwise, this icon will not be displayed. Note that any icon
 747  
          * set through css for the message containers will still appear and this
 748  
          * only relates to the icon directly to the right of an input field.
 749  
          * 
 750  
          * This flag should only be set on AttributeField ErrorsFields.
 751  
          * 
 752  
          * @return the displayFieldErrorIcon
 753  
          */
 754  
         public boolean isDisplayFieldErrorIcon() {
 755  0
                 return this.displayFieldErrorIcon;
 756  
         }
 757  
 
 758  
         /**
 759  
          * @param displayFieldErrorIcon
 760  
          *            the displayFieldErrorIcon to set
 761  
          */
 762  
         public void setDisplayFieldErrorIcon(boolean displayFieldErrorIcon) {
 763  0
                 this.displayFieldErrorIcon = displayFieldErrorIcon;
 764  0
         }
 765  
 
 766  
         /**
 767  
          * If true, highlights the parentComponent's container when it has an
 768  
          * error/warning/info. Otherwise, this highlighting will not be displayed.
 769  
          * Note that the css can be changed per a type of highlighting, if showing a
 770  
          * different color or no color per type of message is desired.
 771  
          * 
 772  
          * @return the highlightOnError
 773  
          */
 774  
         public void setHighlightOnError(boolean highlightOnError) {
 775  0
                 this.highlightOnError = highlightOnError;
 776  0
         }
 777  
 
 778  
         /**
 779  
          * @return the highlightOnError
 780  
          */
 781  
         public boolean isHighlightOnError() {
 782  0
                 return highlightOnError;
 783  
         }
 784  
 
 785  
 }