org.kuali.rice.krad.uif.field
Class ErrorsField

java.lang.Object
  extended by org.kuali.rice.krad.uif.component.ConfigurableBase
      extended by org.kuali.rice.krad.uif.component.ComponentBase
          extended by org.kuali.rice.krad.uif.field.FieldBase
              extended by org.kuali.rice.krad.uif.field.ErrorsField
All Implemented Interfaces:
Serializable, Component, Configurable, ScriptEventSupport, Field, org.springframework.core.Ordered

public class ErrorsField
extends FieldBase

Field that displays error, warning, and info messages for the keys that are matched. By default, an ErrorsField will match on id and bindingPath (if this ErrorsField is for an InputField), but can be set to match on additionalKeys and nested components keys (of the its parentComponent). In addition, there are a variety of options which can be toggled to effect the display of these messages during both client and server side validation display. See documentation on each get method for more details on the effect of each option.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.kuali.rice.krad.uif.component.Ordered
INITIAL_ORDER_VALUE
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
ErrorsField()
           
 
Method Summary
 void generateMessages(boolean reset, View view, Object model, Component parent)
           
 List<String> getAdditionalKeysToMatch()
          AdditionalKeysToMatch is an additional list of keys outside of the default keys that will be matched when messages are returned after a form is submitted.
 int getErrorCount()
          The count of error messages found for the keys that were matched on this ErrorsField This is generated and cannot be set
 List<String> getErrors()
          The list of error messages found for the keys that were matched on this ErrorsField This is generated and cannot be set
 String getErrorTitle()
          ErrorTitle is the title that will be shown before any error messages/error counts are displayed
 String getGrowlScript()
           
 int getInfoCount()
          The count of info messages found for the keys that were matched on this ErrorsField This is generated and cannot be set
 List<String> getInfos()
          The list of info messages found for the keys that were matched on this ErrorsField This is generated and cannot be set
 String getInfoTitle()
          InfoTitle is the title that will be shown before any info messages/info counts are displayed
protected  List<String> getKeys(Component parent)
          Gets all the keys associated to this ErrorsField.
 int getWarningCount()
          The count of warning messages found for the keys that were matched on this ErrorsField This is generated and cannot be set
 List<String> getWarnings()
          The list of warning messages found for the keys that were matched on this ErrorsField This is generated and cannot be set
 String getWarningTitle()
          WarningTitle is the title that will be shown before any warning messages/warning counts are displayed
 boolean isAllowMessageRepeat()
          If true, when this is set on an ErrorsField whose parentComponent has nested Containers or AttributeFields, it will allow those fields to also show their ErrorsField messages.
 boolean isAlternateContainer()
          If this is true, the display of messages is being handled by another container.
 boolean isCombineMessages()
          Combines the messages for a single key into one concatenated message per key being matched, seperated by a comma
 boolean isDisplayCounts()
          displayCounts is true if the counts of errors, warning, and info messages within this ErrorsField should be displayed (includes count of nested messages if displayNestedMessages is true).
 boolean isDisplayErrorMessages()
          If displayErrorMessages is true, error messages will be displayed, otherwise they will not.
 boolean isDisplayErrorTitle()
          If true, the errorTitle set on this ErrorsField will be displayed along with the error messages.
 boolean isDisplayFieldErrorIcon()
          If true, displays an icon next to each field that has an error (default KNS look).
 boolean isDisplayFieldLabelWithMessages()
          If true, the error messages will display the an InputField's title alongside the error, warning, and info messages related to it.
 boolean isDisplayInfoMessages()
          If displayInfoMessages is true, info messages will be displayed, otherwise they will not.
 boolean isDisplayInfoTitle()
          If true, the infoTitle set on this ErrorsField will be displayed along with the info messages.
 boolean isDisplayLockMessages()
           
 boolean isDisplayMessages()
          If true, error, warning, and info messages will be displayed (provided they are also set to display).
 boolean isDisplayNestedMessages()
          If true, this ErrorsField will show messages related to the nested components of its parent component, and not just those related only to its parent component.
 boolean isDisplayWarningMessages()
          If displayWarningMessages is true, warning messages will be displayed, otherwise they will not.
 boolean isDisplayWarningTitle()
          If true, the warningTitle set on this ErrorsField will be displayed along with the warning messages.
 boolean isFireGrowlsForMessages()
           
 boolean isHighlightOnError()
           
 void performFinalize(View view, Object model, Component parent)
          PerformFinalize will generate the messages and counts used by the errorsField based on the keys that were matched from the MessageMap for this ErrorsField.
 void setAdditionalKeysToMatch(List<String> additionalKeysToMatch)
           
 void setAdditionalKeysToMatch(String additionalKeysToMatch)
          Convenience setter for additional keys to match that takes a string argument and splits on comma to build the list
 void setAllowMessageRepeat(boolean allowMessageRepeat)
           
 void setAlternateContainer(boolean alternateContainer)
           
 void setCombineMessages(boolean combineMessages)
           
 void setDisplayCounts(boolean displayCounts)
           
 void setDisplayErrorMessages(boolean displayErrorMessages)
           
 void setDisplayErrorTitle(boolean displayErrorTitle)
           
 void setDisplayFieldErrorIcon(boolean displayFieldErrorIcon)
           
 void setDisplayFieldLabelWithMessages(boolean displayFieldLabelWithMessages)
           
 void setDisplayInfoMessages(boolean displayInfoMessages)
           
 void setDisplayInfoTitle(boolean displayInfoTitle)
           
 void setDisplayLockMessages(boolean displayLockMessages)
          This has no use - needs to be removed(?)
 void setDisplayMessages(boolean displayMessages)
           
 void setDisplayNestedMessages(boolean displayNestedMessages)
           
 void setDisplayWarningMessages(boolean displayWarningMessages)
           
 void setDisplayWarningTitle(boolean displayWarningTitle)
           
 void setErrorTitle(String errorTitle)
           
 void setFireGrowlsForMessages(boolean fireGrowlsForMessages)
           
 void setHighlightOnError(boolean highlightOnError)
          If true, highlights the parentComponent's container when it has an error/warning/info.
 void setInfoTitle(String infoTitle)
           
 void setWarningTitle(String warningTitle)
           
 
Methods inherited from class org.kuali.rice.krad.uif.field.FieldBase
getComponentSecurity, getComponentSecurityClass, getComponentsForLifecycle, getComponentTypeName, getLabel, getLabelField, getLabelPlacement, getShortLabel, isLabelFieldRendered, performInitialization, setComponentSecurity, setLabel, setLabelField, setLabelFieldRendered, setLabelPlacement, setShortLabel, setShowLabel
 
Methods inherited from class org.kuali.rice.krad.uif.component.ComponentBase
addStyleClass, appendToStyle, getAlign, getColSpan, getComponentModifiers, getComponentOptions, getComponentOptionsJSString, getComponentPrototypes, getConditionalRefresh, getConditionalRefreshConditionJs, getConditionalRefreshControlNames, getContext, getEventCode, getFactoryId, getFinalizeMethodAdditionalArguments, getFinalizeMethodInvoker, getFinalizeMethodToCall, getId, getOnBlurScript, getOnChangeScript, getOnClickScript, getOnCloseScript, getOnDblClickScript, getOnDocumentReadyScript, getOnFocusScript, getOnKeyDownScript, getOnKeyPressScript, getOnKeyUpScript, getOnLoadScript, getOnMouseDownScript, getOnMouseMoveScript, getOnMouseOutScript, getOnMouseOverScript, getOnMouseUpScript, getOnSubmitScript, getOnUnloadScript, getOrder, getProgressiveDisclosureConditionJs, getProgressiveDisclosureControlNames, getProgressiveRender, getPropertyReplacerComponents, getPropertyReplacers, getRefreshDiscloseMethodToCall, getRefreshWhenChanged, getRefreshWhenChangedControlNames, getRenderOutput, getRequired, getRowSpan, getStyle, getStyleClasses, getStyleClassesAsString, getSupportsOnBlur, getSupportsOnChange, getSupportsOnClick, getSupportsOnClose, getSupportsOnDblClick, getSupportsOnDocumentReady, getSupportsOnFocus, getSupportsOnKeyDown, getSupportsOnKeyPress, getSupportsOnKeyUp, getSupportsOnLoad, getSupportsOnMouseDown, getSupportsOnMouseMove, getSupportsOnMouseOut, getSupportsOnMouseOver, getSupportsOnMouseUp, getSupportsOnSubmit, getSupportsOnUnload, getTemplate, getTitle, getValign, getWidth, isHidden, isPersistInSession, isProgressiveRenderAndRefresh, isProgressiveRenderViaAJAX, isReadOnly, isRefresh, isRefreshedByAction, isRender, isResetDataOnRefresh, isSelfRendered, isSkipInTabOrder, performApplyModel, pushAllToContext, pushObjectToContext, pushToPropertyReplacerContext, setAlign, setColSpan, setComponentModifiers, setComponentOptions, setComponentOptionsJSString, setConditionalRefresh, setContext, setFactoryId, setFinalizeMethodAdditionalArguments, setFinalizeMethodInvoker, setFinalizeMethodToCall, setHidden, setId, setOnBlurScript, setOnChangeScript, setOnClickScript, setOnCloseScript, setOnDblClickScript, setOnDocumentReadyScript, setOnFocusScript, setOnKeyDownScript, setOnKeyPressScript, setOnKeyUpScript, setOnLoadScript, setOnMouseDownScript, setOnMouseMoveScript, setOnMouseOutScript, setOnMouseOverScript, setOnMouseUpScript, setOnSubmitScript, setOnUnloadScript, setOrder, setPersistInSession, setProgressiveRender, setProgressiveRenderAndRefresh, setProgressiveRenderViaAJAX, setPropertyReplacers, setReadOnly, setRefresh, setRefreshDiscloseMethodToCall, setRefreshedByAction, setRefreshWhenChanged, setRender, setRenderOutput, setRequired, setResetDataOnRefresh, setRowSpan, setSelfRendered, setSkipInTabOrder, setStyle, setStyleClasses, setTemplate, setTitle, setValign, setWidth
 
Methods inherited from class org.kuali.rice.krad.uif.component.ConfigurableBase
getPropertyExpression, getPropertyExpressions, setPropertyExpressions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.uif.component.Component
addStyleClass, appendToStyle, getColSpan, getComponentModifiers, getComponentOptions, getComponentOptionsJSString, getComponentPrototypes, getConditionalRefresh, getConditionalRefreshConditionJs, getConditionalRefreshControlNames, getContext, getFactoryId, getFinalizeMethodAdditionalArguments, getFinalizeMethodInvoker, getFinalizeMethodToCall, getId, getOrder, getProgressiveDisclosureConditionJs, getProgressiveDisclosureControlNames, getProgressiveRender, getPropertyReplacerComponents, getPropertyReplacers, getRefreshWhenChanged, getRefreshWhenChangedControlNames, getRenderOutput, getRequired, getRowSpan, getStyle, getStyleClasses, getTemplate, getTitle, isHidden, isPersistInSession, isProgressiveRenderAndRefresh, isProgressiveRenderViaAJAX, isReadOnly, isRefresh, isRefreshedByAction, isRender, isResetDataOnRefresh, isSelfRendered, performApplyModel, pushAllToContext, pushObjectToContext, setColSpan, setComponentModifiers, setComponentOptions, setComponentOptionsJSString, setConditionalRefresh, setContext, setFactoryId, setHidden, setId, setOrder, setPersistInSession, setProgressiveRender, setProgressiveRenderAndRefresh, setProgressiveRenderViaAJAX, setPropertyReplacers, setReadOnly, setRefresh, setRefreshedByAction, setRefreshWhenChanged, setRender, setRenderOutput, setRequired, setResetDataOnRefresh, setRowSpan, setSelfRendered, setStyle, setStyleClasses, setTemplate, setTitle
 
Methods inherited from interface org.kuali.rice.krad.uif.component.Configurable
getPropertyExpression, getPropertyExpressions, setPropertyExpressions
 
Methods inherited from interface org.kuali.rice.krad.uif.component.ScriptEventSupport
getOnBlurScript, getOnChangeScript, getOnClickScript, getOnCloseScript, getOnDblClickScript, getOnDocumentReadyScript, getOnFocusScript, getOnKeyDownScript, getOnKeyPressScript, getOnKeyUpScript, getOnLoadScript, getOnMouseDownScript, getOnMouseMoveScript, getOnMouseOutScript, getOnMouseOverScript, getOnMouseUpScript, getOnSubmitScript, getOnUnloadScript, getSupportsOnBlur, getSupportsOnChange, getSupportsOnClick, getSupportsOnClose, getSupportsOnDblClick, getSupportsOnDocumentReady, getSupportsOnFocus, getSupportsOnKeyDown, getSupportsOnKeyPress, getSupportsOnKeyUp, getSupportsOnLoad, getSupportsOnMouseDown, getSupportsOnMouseMove, getSupportsOnMouseOut, getSupportsOnMouseOver, getSupportsOnMouseUp, getSupportsOnSubmit, getSupportsOnUnload, setOnBlurScript, setOnDocumentReadyScript, setOnLoadScript
 

Constructor Detail

ErrorsField

public ErrorsField()
Method Detail

performFinalize

public void performFinalize(View view,
                            Object model,
                            Component parent)
PerformFinalize will generate the messages and counts used by the errorsField based on the keys that were matched from the MessageMap for this ErrorsField. It will also set up nestedComponents of its parentComponent correctly based on the flags that were chosen for this ErrorsField.

Specified by:
performFinalize in interface Component
Overrides:
performFinalize in class FieldBase
Parameters:
view - - view instance that should be finalized for rendering
model - - top level object containing the data
parent - - parent component
See Also:
FieldBase.performFinalize(org.kuali.rice.krad.uif.view.View, java.lang.Object, org.kuali.rice.krad.uif.component.Component)

generateMessages

public void generateMessages(boolean reset,
                             View view,
                             Object model,
                             Component parent)

getKeys

protected List<String> getKeys(Component parent)
Gets all the keys associated to this ErrorsField. This includes the id of the parent component, additional keys to match, and the bindingPath if this is an ErrorsField for an InputField. These are the keys that are used to match errors with their component and display them as part of its ErrorsField.

Returns:

getErrorTitle

public String getErrorTitle()
ErrorTitle is the title that will be shown before any error messages/error counts are displayed

Returns:

setErrorTitle

public void setErrorTitle(String errorTitle)

getWarningTitle

public String getWarningTitle()
WarningTitle is the title that will be shown before any warning messages/warning counts are displayed

Returns:

setWarningTitle

public void setWarningTitle(String warningTitle)

getInfoTitle

public String getInfoTitle()
InfoTitle is the title that will be shown before any info messages/info counts are displayed

Returns:

setInfoTitle

public void setInfoTitle(String infoTitle)

isDisplayErrorMessages

public boolean isDisplayErrorMessages()
If displayErrorMessages is true, error messages will be displayed, otherwise they will not. Unlike many of the options contained on ErrorsField, this will not effect client side validations; ie this will not turn off errorMessage display for client side validation, as it may prevent a user from completing a form. To turn off client side validation AND its messaging use the applyClientSide flag on the Constraint itself. TODO this may be changed to: if this is set on a field it will attempt show client side validation errors in the closest parent container error container

Returns:

setDisplayErrorMessages

public void setDisplayErrorMessages(boolean displayErrorMessages)

isDisplayInfoMessages

public boolean isDisplayInfoMessages()
If displayInfoMessages is true, info messages will be displayed, otherwise they will not. Client side validation has no concept of warning or info messages, so this will not effect client side functionality.

Returns:

setDisplayInfoMessages

public void setDisplayInfoMessages(boolean displayInfoMessages)

isDisplayLockMessages

public boolean isDisplayLockMessages()

setDisplayLockMessages

public void setDisplayLockMessages(boolean displayLockMessages)
This has no use - needs to be removed(?)

Parameters:
displayLockMessages -

isDisplayWarningMessages

public boolean isDisplayWarningMessages()
If displayWarningMessages is true, warning messages will be displayed, otherwise they will not. Client side validation has no concept of warning or info messages, so this will not effect client side functionality.

Returns:

setDisplayWarningMessages

public void setDisplayWarningMessages(boolean displayWarningMessages)

getAdditionalKeysToMatch

public List<String> getAdditionalKeysToMatch()
AdditionalKeysToMatch is an additional list of keys outside of the default keys that will be matched when messages are returned after a form is submitted. These keys are only used for displaying messages generated by the server and have no effect on client side validation error display.

Returns:
the additionalKeysToMatch

setAdditionalKeysToMatch

public void setAdditionalKeysToMatch(String additionalKeysToMatch)
Convenience setter for additional keys to match that takes a string argument and splits on comma to build the list

Parameters:
additionalKeysToMatch - String to parse

setAdditionalKeysToMatch

public void setAdditionalKeysToMatch(List<String> additionalKeysToMatch)
Parameters:
additionalKeysToMatch - the additionalKeysToMatch to set

isDisplayErrorTitle

public boolean isDisplayErrorTitle()
If true, the errorTitle set on this ErrorsField will be displayed along with the error messages. Otherwise, the title will not be displayed.

Returns:
the displayErrorTitle

setDisplayErrorTitle

public void setDisplayErrorTitle(boolean displayErrorTitle)
Parameters:
displayErrorTitle - the displayErrorTitle to set

isDisplayWarningTitle

public boolean isDisplayWarningTitle()
If true, the warningTitle set on this ErrorsField will be displayed along with the warning messages. Otherwise, the title will not be displayed.

Returns:
the displayWarningTitle

setDisplayWarningTitle

public void setDisplayWarningTitle(boolean displayWarningTitle)
Parameters:
displayWarningTitle - the displayWarningTitle to set

isDisplayInfoTitle

public boolean isDisplayInfoTitle()
If true, the infoTitle set on this ErrorsField will be displayed along with the info messages. Otherwise, the title will not be displayed.

Returns:
the displayInfoTitle

setDisplayInfoTitle

public void setDisplayInfoTitle(boolean displayInfoTitle)
Parameters:
displayInfoTitle - the displayInfoTitle to set

isDisplayFieldLabelWithMessages

public boolean isDisplayFieldLabelWithMessages()
If true, the error messages will display the an InputField's title alongside the error, warning, and info messages related to it. This setting has no effect on messages which do not relate directly to a single InputField.

Returns:
the displayFieldLabelWithMessages

setDisplayFieldLabelWithMessages

public void setDisplayFieldLabelWithMessages(boolean displayFieldLabelWithMessages)
Parameters:
displayFieldLabelWithMessages - the displayFieldLabelWithMessages to set

isDisplayMessages

public boolean isDisplayMessages()
If true, error, warning, and info messages will be displayed (provided they are also set to display). Otherwise, no messages for this ErrorsField container will be displayed (including ones set to display). This is a global display on/off switch for all messages.

Returns:
the displayMessages

setDisplayMessages

public void setDisplayMessages(boolean displayMessages)
Parameters:
displayMessages - the displayMessages to set

isDisplayNestedMessages

public boolean isDisplayNestedMessages()
If true, this ErrorsField will show messages related to the nested components of its parent component, and not just those related only to its parent component. Otherwise, it will be up to the individual components to display their messages, if any, in their ErrorsField.

Returns:
the displayNestedMessages

setDisplayNestedMessages

public void setDisplayNestedMessages(boolean displayNestedMessages)
Parameters:
displayNestedMessages - the displayNestedMessages to set

isCombineMessages

public boolean isCombineMessages()
Combines the messages for a single key into one concatenated message per key being matched, seperated by a comma

Returns:
the combineMessages

setCombineMessages

public void setCombineMessages(boolean combineMessages)
Parameters:
combineMessages - the combineMessages to set

isAllowMessageRepeat

public boolean isAllowMessageRepeat()
If true, when this is set on an ErrorsField whose parentComponent has nested Containers or AttributeFields, it will allow those fields to also show their ErrorsField messages. Otherwise, it will turn off the the display of those messages. This can be used to avoid repeating information to the user per field, if errors are already being displayed at the parent's level. This flag has no effect if displayNestedMessages is false on this ErrorsField.

Returns:
the allowMessageRepeat

setAllowMessageRepeat

public void setAllowMessageRepeat(boolean allowMessageRepeat)
Parameters:
allowMessageRepeat - the allowMessageRepeat to set

isDisplayCounts

public boolean isDisplayCounts()
displayCounts is true if the counts of errors, warning, and info messages within this ErrorsField should be displayed (includes count of nested messages if displayNestedMessages is true).

Returns:

setDisplayCounts

public void setDisplayCounts(boolean displayCounts)
Parameters:
displayCounts - the displayCounts to set

getErrors

public List<String> getErrors()
The list of error messages found for the keys that were matched on this ErrorsField This is generated and cannot be set

Returns:
the errors

getWarnings

public List<String> getWarnings()
The list of warning messages found for the keys that were matched on this ErrorsField This is generated and cannot be set

Returns:
the warnings

getInfos

public List<String> getInfos()
The list of info messages found for the keys that were matched on this ErrorsField This is generated and cannot be set

Returns:
the infos

getErrorCount

public int getErrorCount()
The count of error messages found for the keys that were matched on this ErrorsField This is generated and cannot be set

Returns:
the errorCount

getWarningCount

public int getWarningCount()
The count of warning messages found for the keys that were matched on this ErrorsField This is generated and cannot be set

Returns:
the warningCount

getInfoCount

public int getInfoCount()
The count of info messages found for the keys that were matched on this ErrorsField This is generated and cannot be set

Returns:
the infoCount

isAlternateContainer

public boolean isAlternateContainer()
If this is true, the display of messages is being handled by another container. The ErrorsField html generated by the jsp will still be used, but it will be placed in different location within the page than the default to accommodate an alternate layout. This flag is used by BoxLayoutManager. This flag only applies to ErrorsFields whose parentComponents are AttributeFields.

Returns:
the alternateContainer

setAlternateContainer

public void setAlternateContainer(boolean alternateContainer)
Parameters:
alternateContainer - the alternateContainer to set

isDisplayFieldErrorIcon

public boolean isDisplayFieldErrorIcon()
If true, displays an icon next to each field that has an error (default KNS look). Otherwise, this icon will not be displayed. Note that any icon set through css for the message containers will still appear and this only relates to the icon directly to the right of an input field. This flag should only be set on InputField ErrorsFields.

Returns:
the displayFieldErrorIcon

setDisplayFieldErrorIcon

public void setDisplayFieldErrorIcon(boolean displayFieldErrorIcon)
Parameters:
displayFieldErrorIcon - the displayFieldErrorIcon to set

setHighlightOnError

public void setHighlightOnError(boolean highlightOnError)
If true, highlights the parentComponent's container when it has an error/warning/info. Otherwise, this highlighting will not be displayed. Note that the css can be changed per a type of highlighting, if showing a different color or no color per type of message is desired.


isHighlightOnError

public boolean isHighlightOnError()
Returns:
the highlightOnError

isFireGrowlsForMessages

public boolean isFireGrowlsForMessages()

setFireGrowlsForMessages

public void setFireGrowlsForMessages(boolean fireGrowlsForMessages)

getGrowlScript

public String getGrowlScript()


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.