org.araneaframework.uilib.form
Class LocalFormElementValidationErrorRenderer

java.lang.Object
  extended byorg.araneaframework.uilib.form.LocalFormElementValidationErrorRenderer
All Implemented Interfaces:
FormElementValidationErrorRenderer, Serializable

public class LocalFormElementValidationErrorRenderer
extends Object
implements FormElementValidationErrorRenderer

Form element validation error renderer which produces error messages directly attached to rendered FormElements.

Since:
1.1
Author:
Taimo Peelo (taimo@araneaframework.org)
See Also:
Serialized Form

Field Summary
static LocalFormElementValidationErrorRenderer INSTANCE
           
 
Fields inherited from interface org.araneaframework.uilib.form.FormElementValidationErrorRenderer
ERRORS_PROPERTY_KEY, RENDERED_FORMELEMENTERROR_STYLECLASS
 
Constructor Summary
LocalFormElementValidationErrorRenderer()
           
 
Method Summary
 void addError(FormElement element, String error)
          Called by FormElement.addError(String) to register validation errors.
 void clearErrors(FormElement element)
          Called by FormElement.clearErrors() to clear validation errors.
 String getClientRenderText(FormElement element)
          Returns client side script capable of rendering errors in desired format.
protected  String getFormattedMessage(String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final LocalFormElementValidationErrorRenderer INSTANCE
Constructor Detail

LocalFormElementValidationErrorRenderer

public LocalFormElementValidationErrorRenderer()
Method Detail

addError

public void addError(FormElement element,
                     String error)
Description copied from interface: FormElementValidationErrorRenderer
Called by FormElement.addError(String) to register validation errors.

Specified by:
addError in interface FormElementValidationErrorRenderer
Parameters:
element - element which produced the validation error
error - detailed error message

clearErrors

public void clearErrors(FormElement element)
Description copied from interface: FormElementValidationErrorRenderer
Called by FormElement.clearErrors() to clear validation errors.

Specified by:
clearErrors in interface FormElementValidationErrorRenderer
Parameters:
element - element which errors should be cleared

getClientRenderText

public String getClientRenderText(FormElement element)
Description copied from interface: FormElementValidationErrorRenderer
Returns client side script capable of rendering errors in desired format. This should be in form that can be directly appended to rendered HTML and should be enclosed in HTML <script> tags. When the errors are rendered with some other mechanism, returns null or empty String.

Specified by:
getClientRenderText in interface FormElementValidationErrorRenderer
Returns:
script capable of rendering errors in desired format

getFormattedMessage

protected String getFormattedMessage(String msg)