org.apache.myfaces.trinidad.render
Class CoreRenderer

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by org.apache.myfaces.trinidad.render.CoreRenderer

public class CoreRenderer
extends javax.faces.render.Renderer

Basic implementation of the core rendering functionality across render kits.


Field Summary
static char CHAR_UNDEFINED
           
static int NO_CHILD_INDEX
           
 
Constructor Summary
protected CoreRenderer()
           
 
Method Summary
protected  void delegateRenderer(javax.faces.context.FacesContext context, RenderingContext arc, javax.faces.component.UIComponent component, FacesBean bean, CoreRenderer renderer)
           
protected  void delegateRendererBegin(javax.faces.context.FacesContext context, RenderingContext arc, javax.faces.component.UIComponent component, FacesBean bean, CoreRenderer renderer)
           
protected  void delegateRendererEnd(javax.faces.context.FacesContext context, RenderingContext arc, javax.faces.component.UIComponent component, FacesBean bean, CoreRenderer renderer)
           
protected  void encodeAll(javax.faces.context.FacesContext context, RenderingContext arc, javax.faces.component.UIComponent component, FacesBean bean)
          Hook for rendering all of a component; only called if getRendersChildren() is true.
protected  void encodeAllChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
protected  void encodeBegin(javax.faces.context.FacesContext context, RenderingContext arc, javax.faces.component.UIComponent component, FacesBean bean)
          Hook for rendering the start of a component; only called if getRendersChildren() is false.
 void encodeBegin(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
protected  void encodeChild(javax.faces.context.FacesContext context, javax.faces.component.UIComponent child)
          Hook for encoding a child; this assumes that isRendered() has already been called.
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
protected  void encodeEnd(javax.faces.context.FacesContext context, RenderingContext arc, javax.faces.component.UIComponent component, FacesBean bean)
          Hook for rendering the end of a component; only called if getRendersChildren() is false.
 void encodeEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
protected  java.lang.String getClientId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Returns the client ID that should be used for rendering (if shouldRenderId(javax.faces.context.FacesContext, javax.faces.component.UIComponent) returns true).
protected  FacesBean getFacesBean(javax.faces.component.UIComponent component)
           
static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent component, java.lang.String name)
          Gets a facet, verifying that the facet should be rendered.
static int getNextRenderedChildIndex(java.util.List<javax.faces.component.UIComponent> components, int afterChildIndex)
           
static int getRenderedChildCount(javax.faces.component.UIComponent component)
          Returns the total number of children with rendered=="true".
protected static java.lang.Object getRenderingProperty(RenderingContext arc, java.lang.Object key)
           
static boolean hasRenderedChildren(javax.faces.component.UIComponent component)
          Returns true if the component has children and at least one has rendered=="true".
static boolean isDesktop(RenderingContext arc)
           
static boolean isGecko(RenderingContext arc)
           
static boolean isIE(RenderingContext arc)
           
static boolean isInaccessibleMode(RenderingContext arc)
           
static boolean isPDA(RenderingContext arc)
           
static boolean isScreenReaderMode(RenderingContext arc)
           
protected  void renderEncodedActionURI(javax.faces.context.FacesContext context, java.lang.String name, java.lang.Object value)
           
protected  void renderEncodedResourceURI(javax.faces.context.FacesContext context, java.lang.String name, java.lang.Object value)
           
protected  void renderId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Renders the client ID as an "id".
static void renderStyleClass(javax.faces.context.FacesContext context, RenderingContext arc, java.lang.String styleClass)
          Render a generic CSS styleClass (not one derived from an attribute).
static void renderStyleClasses(javax.faces.context.FacesContext context, RenderingContext arc, java.lang.String[] styleClasses)
          Render an array of CSS styleClasses as space-separated values.
protected static java.lang.Object setRenderingProperty(RenderingContext arc, java.lang.Object key, java.lang.Object value)
           
protected  boolean shouldRenderId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Returns true if the component should render an ID.
protected  boolean skipDecode(javax.faces.context.FacesContext context)
           
static java.lang.String toActionUri(javax.faces.context.FacesContext fc, java.lang.Object o)
          Coerces an object into an action URI, calling the view-handler.
static char toChar(java.lang.Object o)
          Returns the character value of an object, XhtmlConstants.CHAR_UNDEFINED if there is none.
static int toInt(java.lang.Object o)
          Returns the integer value of an object; this does not support null (which must be substituted with a default before calling).
static long toLong(java.lang.Object o)
          Returns the integer value of an object; this does not support null (which must be substituted with a default before calling).
static java.lang.String toResourceUri(javax.faces.context.FacesContext fc, java.lang.Object o)
          Coerces an object into a resource URI, calling the view-handler.
static java.lang.String toString(java.lang.Object o)
          Coerces an object into a String.
static java.lang.String toUri(java.lang.Object o)
          Coerces an object into a resource URI, calling the view-handler.
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, decode, getConvertedValue, getRendersChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAR_UNDEFINED

public static final char CHAR_UNDEFINED
See Also:
Constant Field Values

NO_CHILD_INDEX

public static final int NO_CHILD_INDEX
See Also:
Constant Field Values
Constructor Detail

CoreRenderer

protected CoreRenderer()
Method Detail

toString

public static java.lang.String toString(java.lang.Object o)
Coerces an object into a String.


toResourceUri

public static java.lang.String toResourceUri(javax.faces.context.FacesContext fc,
                                             java.lang.Object o)
Coerces an object into a resource URI, calling the view-handler.


toActionUri

public static java.lang.String toActionUri(javax.faces.context.FacesContext fc,
                                           java.lang.Object o)
Coerces an object into an action URI, calling the view-handler.


toUri

public static java.lang.String toUri(java.lang.Object o)
Coerces an object into a resource URI, calling the view-handler.


toInt

public static int toInt(java.lang.Object o)
Returns the integer value of an object; this does not support null (which must be substituted with a default before calling).


toLong

public static long toLong(java.lang.Object o)
Returns the integer value of an object; this does not support null (which must be substituted with a default before calling).


toChar

public static char toChar(java.lang.Object o)
Returns the character value of an object, XhtmlConstants.CHAR_UNDEFINED if there is none.


encodeBegin

public final void encodeBegin(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component)
                       throws java.io.IOException
Overrides:
encodeBegin in class javax.faces.render.Renderer
Throws:
java.io.IOException

encodeChildren

public final void encodeChildren(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent component)
Overrides:
encodeChildren in class javax.faces.render.Renderer

encodeEnd

public final void encodeEnd(javax.faces.context.FacesContext context,
                            javax.faces.component.UIComponent component)
                     throws java.io.IOException
Overrides:
encodeEnd in class javax.faces.render.Renderer
Throws:
java.io.IOException

encodeBegin

protected void encodeBegin(javax.faces.context.FacesContext context,
                           RenderingContext arc,
                           javax.faces.component.UIComponent component,
                           FacesBean bean)
                    throws java.io.IOException
Hook for rendering the start of a component; only called if getRendersChildren() is false.

Throws:
java.io.IOException

encodeEnd

protected void encodeEnd(javax.faces.context.FacesContext context,
                         RenderingContext arc,
                         javax.faces.component.UIComponent component,
                         FacesBean bean)
                  throws java.io.IOException
Hook for rendering the end of a component; only called if getRendersChildren() is false.

Throws:
java.io.IOException

encodeAll

protected void encodeAll(javax.faces.context.FacesContext context,
                         RenderingContext arc,
                         javax.faces.component.UIComponent component,
                         FacesBean bean)
                  throws java.io.IOException
Hook for rendering all of a component; only called if getRendersChildren() is true.

Throws:
java.io.IOException

encodeChild

protected void encodeChild(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent child)
                    throws java.io.IOException
Hook for encoding a child; this assumes that isRendered() has already been called. (RenderUtils.encodeRecursive() can be used if you don't need that check.) =-=AEW Ugh.

Throws:
java.io.IOException

encodeAllChildren

protected void encodeAllChildren(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent component)
                          throws java.io.IOException
Throws:
java.io.IOException

delegateRenderer

protected void delegateRenderer(javax.faces.context.FacesContext context,
                                RenderingContext arc,
                                javax.faces.component.UIComponent component,
                                FacesBean bean,
                                CoreRenderer renderer)
                         throws java.io.IOException
Throws:
java.io.IOException

delegateRendererBegin

protected void delegateRendererBegin(javax.faces.context.FacesContext context,
                                     RenderingContext arc,
                                     javax.faces.component.UIComponent component,
                                     FacesBean bean,
                                     CoreRenderer renderer)
                              throws java.io.IOException
Throws:
java.io.IOException

delegateRendererEnd

protected void delegateRendererEnd(javax.faces.context.FacesContext context,
                                   RenderingContext arc,
                                   javax.faces.component.UIComponent component,
                                   FacesBean bean,
                                   CoreRenderer renderer)
                            throws java.io.IOException
Throws:
java.io.IOException

renderId

protected void renderId(javax.faces.context.FacesContext context,
                        javax.faces.component.UIComponent component)
                 throws java.io.IOException
Renders the client ID as an "id".

Throws:
java.io.IOException

getClientId

protected java.lang.String getClientId(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component)
Returns the client ID that should be used for rendering (if shouldRenderId(javax.faces.context.FacesContext, javax.faces.component.UIComponent) returns true).


shouldRenderId

protected boolean shouldRenderId(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent component)
Returns true if the component should render an ID. Components that deliver events should always return "true".


skipDecode

protected boolean skipDecode(javax.faces.context.FacesContext context)

getFacesBean

protected FacesBean getFacesBean(javax.faces.component.UIComponent component)

getRenderingProperty

protected static final java.lang.Object getRenderingProperty(RenderingContext arc,
                                                             java.lang.Object key)

setRenderingProperty

protected static final java.lang.Object setRenderingProperty(RenderingContext arc,
                                                             java.lang.Object key,
                                                             java.lang.Object value)

getFacet

public static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent component,
                                                         java.lang.String name)
Gets a facet, verifying that the facet should be rendered.


hasRenderedChildren

public static boolean hasRenderedChildren(javax.faces.component.UIComponent component)
Returns true if the component has children and at least one has rendered=="true".


getRenderedChildCount

public static int getRenderedChildCount(javax.faces.component.UIComponent component)
Returns the total number of children with rendered=="true".


getNextRenderedChildIndex

public static int getNextRenderedChildIndex(java.util.List<javax.faces.component.UIComponent> components,
                                            int afterChildIndex)
Parameters:
afterChildIndex - The children coming after this index, will be considered.
Returns:
the index of the next child that must be rendered, or NO_CHILD_INDEX if there is none.

isDesktop

public static boolean isDesktop(RenderingContext arc)

isPDA

public static boolean isPDA(RenderingContext arc)

isIE

public static boolean isIE(RenderingContext arc)

isGecko

public static boolean isGecko(RenderingContext arc)

isInaccessibleMode

public static boolean isInaccessibleMode(RenderingContext arc)

isScreenReaderMode

public static boolean isScreenReaderMode(RenderingContext arc)

renderEncodedActionURI

protected void renderEncodedActionURI(javax.faces.context.FacesContext context,
                                      java.lang.String name,
                                      java.lang.Object value)
                               throws java.io.IOException
Throws:
java.io.IOException

renderEncodedResourceURI

protected void renderEncodedResourceURI(javax.faces.context.FacesContext context,
                                        java.lang.String name,
                                        java.lang.Object value)
                                 throws java.io.IOException
Throws:
java.io.IOException

renderStyleClass

public static void renderStyleClass(javax.faces.context.FacesContext context,
                                    RenderingContext arc,
                                    java.lang.String styleClass)
                             throws java.io.IOException
Render a generic CSS styleClass (not one derived from an attribute). The styleclass will be passed through the RenderingContext getStyleClass() API.

Parameters:
context - the FacesContext
styleClass - the style class
Throws:
java.io.IOException

renderStyleClasses

public static void renderStyleClasses(javax.faces.context.FacesContext context,
                                      RenderingContext arc,
                                      java.lang.String[] styleClasses)
                               throws java.io.IOException
Render an array of CSS styleClasses as space-separated values. NOTE: the array is mutated during this method, and cannot be reused! Each styleclass will be passed through the RenderingContext getStyleClass() API.

Parameters:
context - the FacesContext
styleClasses - the style classes
Throws:
java.io.IOException


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