org.apache.shale.validator.faces
Class ValidatorCommandRenderer

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by org.apache.shale.validator.faces.ValidatorCommandRenderer

public class ValidatorCommandRenderer
extends javax.faces.render.Renderer

This Renderer is a hybrid renderer decorator that is dynamically registered by ValidatorRenderKit for component renderers in the "javax.faces.Command" family.


Field Summary
static String OVERRIDE_IMMEDIATE
          Attribute name used to override the default behavior of how the immediate attribute effects the execution of client side javascript validation.
 
Constructor Summary
ValidatorCommandRenderer(javax.faces.render.Renderer defaultRenderer)
          The overloaded constructor is passed the original Renderer for the family and component type.
 
Method Summary
 String convertClientId(javax.faces.context.FacesContext context, String id)
          
 void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          
protected  void encode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, int encodeSwitch)
          Interrogates the component's immediate property and the component's immediate override attribute to determine if client side validation is invoked.
 void encodeBegin(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           Invokes the encode method passing ENCODE_BEGIN for the encodeSwitch parameter.
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Invokes the encode method passing ENCODE_CHILDREN for the encodeSwitch parameter.
 void encodeEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Invokes the encode method passing ENCODE_END for the encodeSwitch parameter.
 Object getConvertedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object o)
          
 boolean getRendersChildren()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OVERRIDE_IMMEDIATE

public static final String OVERRIDE_IMMEDIATE

Attribute name used to override the default behavior of how the immediate attribute effects the execution of client side javascript validation.

See Also:
Constant Field Values
Constructor Detail

ValidatorCommandRenderer

public ValidatorCommandRenderer(javax.faces.render.Renderer defaultRenderer)

The overloaded constructor is passed the original Renderer for the family and component type.

Parameters:
defaultRenderer - The default Renderer we should delegate to
Method Detail

encode

protected void encode(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component,
                      int encodeSwitch)
               throws IOException
Interrogates the component's immediate property and the component's immediate override attribute to determine if client side validation is invoked. If either the property or attribute override is false, client side validation is invoked. Otherwise, the response writer is hijacked and the original render is invoked. The result is buffered and a statement of javascript is injected into the onclick event which cancels client side validation. The original response writer is restored and the modified markup is written to the response writer. The encodeSwitch determines if the encodeBegin, encodeChildren or encodeEnd methods should be invoked on the decorated renderer.

Parameters:
context - FacesContext for the current request
component - UIComponent being rendered
encodeSwitch - FIXME - encode switch?
Throws:
IOException - if an input/output error occurs

convertClientId

public String convertClientId(javax.faces.context.FacesContext context,
                              String id)

Overrides:
convertClientId in class javax.faces.render.Renderer

getConvertedValue

public Object getConvertedValue(javax.faces.context.FacesContext context,
                                javax.faces.component.UIComponent component,
                                Object o)
                         throws javax.faces.convert.ConverterException

Overrides:
getConvertedValue in class javax.faces.render.Renderer
Throws:
javax.faces.convert.ConverterException

decode

public void decode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)

Overrides:
decode in class javax.faces.render.Renderer

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context,
                        javax.faces.component.UIComponent component)
                 throws IOException

Invokes the encode method passing ENCODE_BEGIN for the encodeSwitch parameter.

Overrides:
encodeBegin in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current request
component - UIComponent being rendered
Throws:
IOException - if an input/output error occurs

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component)
                    throws IOException

Invokes the encode method passing ENCODE_CHILDREN for the encodeSwitch parameter.

Overrides:
encodeChildren in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current request
component - UIComponent being rendered
Throws:
IOException - if an input/output error occurs

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component)
               throws IOException

Invokes the encode method passing ENCODE_END for the encodeSwitch parameter.

Overrides:
encodeEnd in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current reqauest
component - UIComponent being rendered
Throws:
IOException - if an input/output error occurs

getRendersChildren

public boolean getRendersChildren()

Overrides:
getRendersChildren in class javax.faces.render.Renderer


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.