org.apache.myfaces.trinidad.render

## Class CoreRenderer

- java.lang.Object
- - javax.faces.render.Renderer
  - - 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static char` | `CHAR_UNDEFINED`
    `static int` | `NO_CHILD_INDEX`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CoreRenderer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterEncode(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component, FacesBean bean)` Hook method that gets invoked after the component is encoded
    `protected void` | `beforeEncode(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component, FacesBean bean)` Hook method that gets invoked before the component is encoded
    `protected void` | `delegateRenderer(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component, FacesBean bean, CoreRenderer renderer)`
    `protected void` | `delegateRendererBegin(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component, FacesBean bean, CoreRenderer renderer)`
    `protected void` | `delegateRendererEnd(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component, FacesBean bean, CoreRenderer renderer)`
    `protected void` | `encodeAll(javax.faces.context.FacesContext context, RenderingContext rc, 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 rc, 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 rc, 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 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, String name)` Gets a facet, verifying that the facet should be rendered.
    `static int` | `getNextRenderedChildIndex(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 Object` | `getRenderingProperty(RenderingContext rc, 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 rc)`
    `static boolean` | `isGecko(RenderingContext rc)`
    `static boolean` | `isGenericPDA(RenderingContext rc)`
    `static boolean` | `isIE(RenderingContext rc)`
    `static boolean` | `isInaccessibleMode(RenderingContext rc)`
    `static boolean` | `isIPhone(RenderingContext rc)`
    `static boolean` | `isKonqueror(RenderingContext rc)`
    `static boolean` | `isNokiaS60(RenderingContext rc)` This method returns true if a user-agent's platform is NokiaS60
    `static boolean` | `isOpera(RenderingContext rc)`
    `static boolean` | `isPDA(RenderingContext rc)`
    `static boolean` | `isScreenReaderMode(RenderingContext rc)`
    `static boolean` | `isWebKit(RenderingContext rc)`
    `VisitResult` | `partialEncodeVisit(VisitContext visitContext, PartialPageContext partialContext, javax.faces.component.UIComponent component, VisitCallback callback)` Called when visiting the CoreRenderer's component during optimized partial page encoding so that the CoreRenderer can modify what is actually encoded.
    `protected void` | `renderEncodedActionURI(javax.faces.context.FacesContext context, String name, Object value)`
    `protected void` | `renderEncodedResourceURI(javax.faces.context.FacesContext context, String name, 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 rc, String styleClass)` Render a generic CSS styleClass (not one derived from an attribute).
    `static void` | `renderStyleClasses(javax.faces.context.FacesContext context, RenderingContext rc, String[] styleClasses)` Render an array of CSS styleClasses as space-separated values.
    `protected static Object` | `setRenderingProperty(RenderingContext rc, Object key, Object value)`
    `void` | `setupChildrenEncodingContext(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component)` Called before rendering the current component's children in order to set up any special context.
    `void` | `setupEncodingContext(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component)` Called before rendering the current comopnent's children in order to set up any special context.
    `void` | `setupEncodingContext(javax.faces.context.FacesContext context, RenderingContext rc, UIXComponent component)` Deprecated.
    `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)`
    `void` | `tearDownChildrenEncodingContext(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component)` Called after rendering the current component's children in order to tear down any special context.
    `void` | `tearDownEncodingContext(javax.faces.context.FacesContext context, RenderingContext rc, javax.faces.component.UIComponent component)` Called after rendering the current component's children in order to tear down any special context.
    `void` | `tearDownEncodingContext(javax.faces.context.FacesContext context, RenderingContext rc, UIXComponent component)` Deprecated.
    `static String` | `toActionUri(javax.faces.context.FacesContext fc, Object o)` Coerces an object into an action URI, calling the view-handler.
    `static char` | `toChar(Object o)` Returns the character value of an object, XhtmlConstants.CHAR_UNDEFINED if there is none.
    `static int` | `toInt(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(Object o)` Returns the integer value of an object; this does not support null (which must be substituted with a default before calling).
    `static String` | `toResourceUri(javax.faces.context.FacesContext fc, Object o)` Coerces an object into a resource URI, calling the view-handler.
    `static String` | `toString(Object o)` Coerces an object into a String.
    `static String` | `toUri(Object o)` Deprecated. use toResourceUri
    `boolean` | `visitChildrenForEncoding(UIXComponent component, VisitContext visitContext, VisitCallback callback)` Hook to allow the renderer to customize the visitation of the children components of a component during the visitation of a component during rendering.

    - ### 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

    - #### partialEncodeVisit

          public VisitResult partialEncodeVisit(VisitContext visitContext,
                                       PartialPageContext partialContext,
                                       javax.faces.component.UIComponent component,
                                       VisitCallback callback)

      Called when visiting the CoreRenderer's component during optimized partial page encoding so that the CoreRenderer can modify what is actually encoded. For example tab controls often render the tabs for the ShowDetailItems in the tab bar before delegating to the disclosed ShowDetailItem to render the tab content. As a result, the tab control needs to encode its tab bar if any of its ShowDetailItems are partial targets so that the tab labels, for example, are up-to-date.

      The default implementation calls the VisitCallback and returns its result if this UIXComponent is a partial target of the current encoding.

      Parameters:
        `visitContext` - VisitContext to pass to the VisitCallback
        `partialContext` - PartialPageContext for the current partial encoding
        `component` - The component for the CoreRenderer to visit
        `callback` - VisitCallback to call if this component is a partial target
      Returns:
        The VisitResult controlling continued iteration of the visit.

    - #### setupEncodingContext

          public void setupEncodingContext(javax.faces.context.FacesContext context,
                                  RenderingContext rc,
                                  javax.faces.component.UIComponent component)

      Called before rendering the current comopnent's children in order to set up any special context.

      If `setupEncodingContext` succeeds then `tearDownEncodingContext` will be called for the same component.

      The default implementation does nothing

      Parameters:
        `context` - FacesContext for this request
        `rc` - RenderingContext for this encoding pass
        `component` - Component to encode using this Renderer
      See Also:
        `tearDownEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext, javax.faces.component.UIComponent)`

    - #### setupEncodingContext

          @Deprecated
          public void setupEncodingContext(javax.faces.context.FacesContext context,
                                             RenderingContext rc,
                                             UIXComponent component)

      Deprecated.

    - #### setupChildrenEncodingContext

          public void setupChildrenEncodingContext(javax.faces.context.FacesContext context,
                                          RenderingContext rc,
                                          javax.faces.component.UIComponent component)

      Called before rendering the current component's children in order to set up any special context.

      If `setupChildrenEncodingContext` succeeds then `tearDownChildrenEncodingContext` will be called for the same component.

      The default implementation does nothing

      Parameters:
        `context` - FacesContext for this request
        `rc` - RenderingContext for this encoding pass
        `component` - Component to encode using this Renderer
      See Also:
        `tearDownChildrenEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext, javax.faces.component.UIComponent)`

    - #### tearDownEncodingContext

          public void tearDownEncodingContext(javax.faces.context.FacesContext context,
                                     RenderingContext rc,
                                     javax.faces.component.UIComponent component)

      Called after rendering the current component's children in order to tear down any special context.

      `tearDownEncodingContext` will be called on the component if `setupEncodingContext` succeeded.

      The default implementation does nothing

      Parameters:
        `context` - FacesContext for this request
        `rc` - RenderingContext for this encoding pass
        `component` - Component to encode using this Renderer
      See Also:
        `setupEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext, javax.faces.component.UIComponent)`

    - #### tearDownEncodingContext

          @Deprecated
          public void tearDownEncodingContext(javax.faces.context.FacesContext context,
                                                RenderingContext rc,
                                                UIXComponent component)

      Deprecated.

    - #### tearDownChildrenEncodingContext

          public void tearDownChildrenEncodingContext(javax.faces.context.FacesContext context,
                                             RenderingContext rc,
                                             javax.faces.component.UIComponent component)

      Called after rendering the current component's children in order to tear down any special context.

      `tearDownChildrenEncodingContext` will be called on the component if `setupChildrenEncodingContext` succeeded.

      The default implementation does nothing

      Parameters:
        `context` - FacesContext for this request
        `rc` - RenderingContext for this encoding pass
        `component` - Component to encode using this Renderer
      See Also:
        `setupChildrenEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext, javax.faces.component.UIComponent)`

    - #### visitChildrenForEncoding

          public boolean visitChildrenForEncoding(UIXComponent component,
                                         VisitContext visitContext,
                                         VisitCallback callback)

      Hook to allow the renderer to customize the visitation of the children components of a component during the visitation of a component during rendering.
      Parameters:
        `component` - the component which owns the children to visit
        `visitContext` - the visitation context
        `callback` - the visit callback
      Returns:
        `true` if the visit is complete.
      See Also:
        `UIXComponent.visitChildren(VisitContext, VisitCallback)`

    - #### toString

          public static String toString(Object o)

      Coerces an object into a String.

    - #### toResourceUri

          public static String toResourceUri(javax.faces.context.FacesContext fc,
                             Object o)

      Coerces an object into a resource URI, calling the view-handler.

    - #### toActionUri

          public static String toActionUri(javax.faces.context.FacesContext fc,
                           Object o)

      Coerces an object into an action URI, calling the view-handler.

    - #### toUri

          @Deprecated
          public static String toUri(Object o)

      Deprecated. use toResourceUri
      Coerces an object into a resource URI, calling the view-handler.

    - #### toInt

          public static int toInt(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(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(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 IOException

      Overrides:
        `encodeBegin` in class `javax.faces.render.Renderer`
      Throws:
        `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 IOException

      Overrides:
        `encodeEnd` in class `javax.faces.render.Renderer`
      Throws:
        `IOException`

    - #### encodeBegin

          protected void encodeBegin(javax.faces.context.FacesContext context,
                         RenderingContext rc,
                         javax.faces.component.UIComponent component,
                         FacesBean bean)
                              throws IOException

      Hook for rendering the start of a component; only called if getRendersChildren() is false.
      Throws:
        `IOException`

    - #### encodeEnd

          protected void encodeEnd(javax.faces.context.FacesContext context,
                       RenderingContext rc,
                       javax.faces.component.UIComponent component,
                       FacesBean bean)
                            throws IOException

      Hook for rendering the end of a component; only called if getRendersChildren() is false.
      Throws:
        `IOException`

    - #### encodeAll

          protected void encodeAll(javax.faces.context.FacesContext context,
                       RenderingContext rc,
                       javax.faces.component.UIComponent component,
                       FacesBean bean)
                            throws IOException

      Hook for rendering all of a component; only called if getRendersChildren() is true.
      Throws:
        `IOException`

    - #### encodeChild

          protected void encodeChild(javax.faces.context.FacesContext context,
                         javax.faces.component.UIComponent child)
                              throws 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:
        `IOException`

    - #### encodeAllChildren

          protected void encodeAllChildren(javax.faces.context.FacesContext context,
                               javax.faces.component.UIComponent component)
                                    throws IOException

      Throws:
        `IOException`

    - #### delegateRenderer

          protected void delegateRenderer(javax.faces.context.FacesContext context,
                              RenderingContext rc,
                              javax.faces.component.UIComponent component,
                              FacesBean bean,
                              CoreRenderer renderer)
                                   throws IOException

      Throws:
        `IOException`

    - #### delegateRendererBegin

          protected void delegateRendererBegin(javax.faces.context.FacesContext context,
                                   RenderingContext rc,
                                   javax.faces.component.UIComponent component,
                                   FacesBean bean,
                                   CoreRenderer renderer)
                                        throws IOException

      Throws:
        `IOException`

    - #### delegateRendererEnd

          protected void delegateRendererEnd(javax.faces.context.FacesContext context,
                                 RenderingContext rc,
                                 javax.faces.component.UIComponent component,
                                 FacesBean bean,
                                 CoreRenderer renderer)
                                      throws IOException

      Throws:
        `IOException`

    - #### renderId

          protected void renderId(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component)
                           throws IOException

      Renders the client ID as an "id".
      Throws:
        `IOException`

    - #### getClientId

          protected 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 Object getRenderingProperty(RenderingContext rc,
                                    Object key)

    - #### setRenderingProperty

          protected static final Object setRenderingProperty(RenderingContext rc,
                                    Object key,
                                    Object value)

    - #### getFacet

          public static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent component,
                                                   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(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 rc)

    - #### isPDA

          public static boolean isPDA(RenderingContext rc)

    - #### isIE

          public static boolean isIE(RenderingContext rc)

    - #### isKonqueror

          public static boolean isKonqueror(RenderingContext rc)

    - #### isGecko

          public static boolean isGecko(RenderingContext rc)

    - #### isWebKit

          public static boolean isWebKit(RenderingContext rc)

    - #### isOpera

          public static boolean isOpera(RenderingContext rc)

    - #### isIPhone

          public static boolean isIPhone(RenderingContext rc)

    - #### isGenericPDA

          public static boolean isGenericPDA(RenderingContext rc)

    - #### isNokiaS60

          public static boolean isNokiaS60(RenderingContext rc)

      This method returns true if a user-agent's platform is NokiaS60
      Parameters:
        `arc` - - RenderingContext of a request
      Returns:
        boolean

    - #### isInaccessibleMode

          public static boolean isInaccessibleMode(RenderingContext rc)

    - #### isScreenReaderMode

          public static boolean isScreenReaderMode(RenderingContext rc)

    - #### beforeEncode

          protected void beforeEncode(javax.faces.context.FacesContext context,
                          RenderingContext rc,
                          javax.faces.component.UIComponent component,
                          FacesBean bean)

      Hook method that gets invoked before the component is encoded
      See Also:
        `#encodeBegin(FacesContext, RederingContext, UIComponent, FacesBean)`, `#encodeAll(FacesContext, RederingContext, UIComponent, FacesBean)`

    - #### afterEncode

          protected void afterEncode(javax.faces.context.FacesContext context,
                         RenderingContext rc,
                         javax.faces.component.UIComponent component,
                         FacesBean bean)

      Hook method that gets invoked after the component is encoded
      See Also:
        `#encodeEnd(FacesContext, RederingContext, UIComponent, FacesBean)`, `#encodeAll(FacesContext, RederingContext, UIComponent, FacesBean)`

    - #### renderEncodedActionURI

          protected void renderEncodedActionURI(javax.faces.context.FacesContext context,
                                    String name,
                                    Object value)
                                         throws IOException

      Throws:
        `IOException`

    - #### renderEncodedResourceURI

          protected void renderEncodedResourceURI(javax.faces.context.FacesContext context,
                                      String name,
                                      Object value)
                                           throws IOException

      Throws:
        `IOException`

    - #### renderStyleClass

          public static void renderStyleClass(javax.faces.context.FacesContext context,
                              RenderingContext rc,
                              String styleClass)
                                       throws 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:
        `IOException`

    - #### renderStyleClasses

          public static void renderStyleClasses(javax.faces.context.FacesContext context,
                                RenderingContext rc,
                                String[] styleClasses)
                                         throws IOException

      Render an array of CSS styleClasses as space-separated values.
      Parameters:
        `context` - the FacesContext
        `styleClasses` - the style classes
      Throws:
        `IOException`

Copyright © 2001-2016 The Apache Software Foundation. All Rights Reserved.