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