org.apache.tapestry5.internal
Class DefaultValidationDecorator

java.lang.Object
  extended by org.apache.tapestry5.BaseValidationDecorator
      extended by org.apache.tapestry5.internal.DefaultValidationDecorator
All Implemented Interfaces:
ValidationDecorator

public final class DefaultValidationDecorator
extends BaseValidationDecorator

Default implementation that writes an attribute into fields or labels that are in error.


Constructor Summary
DefaultValidationDecorator(Environment environment, Asset spacerAsset, MarkupWriter markupWriter)
           
 
Method Summary
 void afterField(Field field)
          Writes an icon for field after the field.
 void insideField(Field field)
          Invoked at a point where the decorator may write additional attributes into the field.
 void insideLabel(Field field, Element element)
          Invoked after the label has rendered its tag, but before it has rendered content inside the tag, to allow the decorator to write additional attributes.
 
Methods inherited from class org.apache.tapestry5.BaseValidationDecorator
afterLabel, beforeField, beforeLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultValidationDecorator

public DefaultValidationDecorator(Environment environment,
                                  Asset spacerAsset,
                                  MarkupWriter markupWriter)
Parameters:
environment - used to locate objects and services during the render
spacerAsset - asset for a one-pixel spacer image used as a placeholder for the error marker icon
markupWriter -
Method Detail

insideField

public void insideField(Field field)
Description copied from interface: ValidationDecorator
Invoked at a point where the decorator may write additional attributes into the field. Generally speaking, you will want to render informal parameters before invoking this method.

Specified by:
insideField in interface ValidationDecorator
Overrides:
insideField in class BaseValidationDecorator

insideLabel

public void insideLabel(Field field,
                        Element element)
Description copied from interface: ValidationDecorator
Invoked after the label has rendered its tag, but before it has rendered content inside the tag, to allow the decorator to write additional attributes.

Specified by:
insideLabel in interface ValidationDecorator
Overrides:
insideLabel in class BaseValidationDecorator
Parameters:
field - the field corresponding to the label
element - the element for this label

afterField

public void afterField(Field field)
Writes an icon for field after the field. The icon has the same id as the field, with ":icon" appended. This is expected by the default client-side JavaScript. The icon's src is a blank spacer image (this is to allow the image displayed to be overridden via CSS). The icon's CSS class is "t-error-icon", with "t-invisible" added if the field is not in error when rendered. If client validation is not enabled for the form containing the field and the field is not in error, then the error icon itself is not rendered.

Specified by:
afterField in interface ValidationDecorator
Overrides:
afterField in class BaseValidationDecorator
Parameters:
field - which just completed rendering itself


Copyright © 2003-2012 The Apache Software Foundation.