org.richfaces.renderkit.util

## Class RendererUtils

- java.lang.Object
- - org.richfaces.renderkit.util.RendererUtils

-     public final class RendererUtils
      extends Object

  Util class for common render operations - render passthru html attributes, iterate over child components etc.
  Version:
    $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
  Author:
    asmirnov@exadel.com (latest modification by $Author: alexsmirnov $)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DUMMY_FORM_ID`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `attributeValue(String name, Object value)` Convert attribute value to proper object.
    `String` | `clientId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Simplified version of `encodeId`
    `String` | `correctForIdReference(String forAttr, javax.faces.component.UIComponent component)` If target component contains generated id and for doesn't, correct for id
    `Map<String,Object>` | `createParametersMap(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `Object` | `createParameterValue(javax.faces.component.UIParameter parameter)` Returns value of the parameter.
    `void` | `encodeAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object property, String attributeName)`
    `void` | `encodeAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attribute)`
    `void` | `encodeAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attrs)` Encode attributes given by comma-separated string list.
    `void` | `encodeAttributesFromArray(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String[] attrs)`
    `void` | `encodeBeginForm(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, String clientId)`
    `void` | `encodeBeginFormIfNessesary(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `void` | `encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `void` | `encodeCustomId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Encode id attribute with clientId component property.
    `void` | `encodeEndForm(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter writer)`
    `void` | `encodeEndFormIfNessesary(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `void` | `encodeId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Encode id attribute with clientId component property
    `void` | `encodeId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attribute)` Encode clientId to custom attribute ( for example, to control name )
    `void` | `encodePassThru(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String defaultHtmlEvent)` Encode common pass-thru html attributes.
    `void` | `encodePassThruAttribute(javax.faces.context.FacesContext context, Map<String,Object> attributes, javax.faces.context.ResponseWriter writer, String attribute)` Encode one pass-thru attribute, with plain/boolean/url value, got from properly component attribute.
    `void` | `encodePassThruWithExclusions(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String exclusions, String defaultHtmlEvent)` Encode pass-through attributes except specified ones
    `void` | `encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String[] exclusions, String defaultHtmlEvent)`
    `String` | `encodePctOrPx(String value)` formats given value to
    `String` | `encodePx(String value)`
    `javax.faces.component.UIComponent` | `findComponentFor(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String id)`
    `javax.faces.component.UIComponent` | `findComponentFor(javax.faces.component.UIComponent component, String id)`
    `String` | `getActionUrl(javax.faces.context.FacesContext facesContext)`
    `protected Object` | `getComponentAttributeName(Object key)` Convert HTML attribute name to component property name.
    `static RendererUtils` | `getInstance()` Use this method to get singleton instance of RendererUtils
    `javax.faces.component.UIComponent` | `getNestingForm(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Find nested form for given component
    `boolean` | `hasExplicitId(javax.faces.component.UIComponent component)`
    `boolean` | `isBooleanAttribute(javax.faces.component.UIComponent component, String name)` Get boolean value of logical attribute
    `boolean` | `isEmpty(Object o)` Checks if the argument passed in is empty or not.
    `void` | `writeScript(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object script)` Wtrie JavaScript with start/end elements and type.
    `static void` | `writeState(javax.faces.context.FacesContext context)` Write state saving markers to context, include MyFaces view sequence.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DUMMY_FORM_ID

          public static final String DUMMY_FORM_ID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RendererUtils

          protected RendererUtils()

  - ### Method Detail

    - #### getInstance

          public static RendererUtils getInstance()

      Use this method to get singleton instance of RendererUtils
      Returns:
        singleton instance

    - #### encodeId

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

      Encode id attribute with clientId component property
      Parameters:
        `context` -
        `component` -
      Throws:
        `IOException`

    - #### encodeId

          public void encodeId(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component,
                      String attribute)
                        throws IOException

      Encode clientId to custom attribute ( for example, to control name )
      Parameters:
        `context` -
        `component` -
        `attribute` -
      Throws:
        `IOException`

    - #### encodeCustomId

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

      Encode id attribute with clientId component property. Encoded only if id not auto generated.
      Parameters:
        `context` -
        `component` -
      Throws:
        `IOException`

    - #### createParameterValue

          public Object createParameterValue(javax.faces.component.UIParameter parameter)

      Returns value of the parameter. If parameter is instance of `JavaScriptParameter`, `NoEcape` attribute is applied.
      Parameters:
        `parameter` - instance of `UIParameter`
      Returns:
        `Object` parameter value

    - #### createParametersMap

          public Map<String,Object> createParametersMap(javax.faces.context.FacesContext context,
                                               javax.faces.component.UIComponent component)

    - #### encodePassThru

          public void encodePassThru(javax.faces.context.FacesContext context,
                            javax.faces.component.UIComponent component,
                            String defaultHtmlEvent)
                              throws IOException

      Encode common pass-thru html attributes.
      Parameters:
        `context` -
        `component` -
      Throws:
        `IOException`

    - #### encodePassThruWithExclusions

          public void encodePassThruWithExclusions(javax.faces.context.FacesContext context,
                                          javax.faces.component.UIComponent component,
                                          String exclusions,
                                          String defaultHtmlEvent)
                                            throws IOException

      Encode pass-through attributes except specified ones
      Parameters:
        `context` -
        `component` -
        `exclusions` -
      Throws:
        `IOException`

    - #### encodePassThruWithExclusionsArray

          public void encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context,
                                               javax.faces.component.UIComponent component,
                                               String[] exclusions,
                                               String defaultHtmlEvent)
                                                 throws IOException

      Throws:
        `IOException`

    - #### encodePassThruAttribute

          public void encodePassThruAttribute(javax.faces.context.FacesContext context,
                                     Map<String,Object> attributes,
                                     javax.faces.context.ResponseWriter writer,
                                     String attribute)
                                       throws IOException

      Encode one pass-thru attribute, with plain/boolean/url value, got from properly component attribute.
      Parameters:
        `context` -
        `writer` -
        `attribute` -
      Throws:
        `IOException`

    - #### encodeAttributesFromArray

          public void encodeAttributesFromArray(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component,
                                       String[] attrs)
                                         throws IOException

      Throws:
        `IOException`

    - #### encodeAttributes

          public void encodeAttributes(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component,
                              String attrs)
                                throws IOException

      Encode attributes given by comma-separated string list.
      Parameters:
        `context` - current JSF context
        `component` - for with render attributes values
        `attrs` - comma separated list of attributes
      Throws:
        `IOException`

    - #### encodeAttribute

          public void encodeAttribute(javax.faces.context.FacesContext context,
                             javax.faces.component.UIComponent component,
                             Object property,
                             String attributeName)
                               throws IOException

      Parameters:
        `context` -
        `component` -
        `property` -
        `attributeName` -
      Throws:
        `IOException`

    - #### encodeAttribute

          public void encodeAttribute(javax.faces.context.FacesContext context,
                             javax.faces.component.UIComponent component,
                             String attribute)
                               throws IOException

      Throws:
        `IOException`

    - #### isEmpty

          public boolean isEmpty(Object o)

      Checks if the argument passed in is empty or not. Object is empty if it is:
      - `null`
      - zero-length string
      - empty collection
      - empty map
      - zero-length array
      Parameters:
        `o` - object to check for emptiness
      Returns:
        `true` if the argument is empty, `false` otherwise
      Since:
        3.3.2

    - #### getComponentAttributeName

          protected Object getComponentAttributeName(Object key)

      Convert HTML attribute name to component property name.
      Parameters:
        `key` -
      Returns:

    - #### attributeValue

          protected Object attributeValue(String name,
                              Object value)

      Convert attribute value to proper object. For known html boolean attributes return name for true value, otherthise - null. For non-boolean attributes return same value.
      Parameters:
        `name` - attribute name.
        `value` -
      Returns:

    - #### isBooleanAttribute

          public boolean isBooleanAttribute(javax.faces.component.UIComponent component,
                                   String name)

      Get boolean value of logical attribute
      Parameters:
        `component` -
        `name` - attribute name
      Returns:
        true if attribute is equals Boolean.TRUE or String "true" , false otherwise.

    - #### encodePx

          public String encodePx(String value)

    - #### encodePctOrPx

          public String encodePctOrPx(String value)

      formats given value to
      Parameters:
        `value` -
      Returns:

    - #### getNestingForm

          public javax.faces.component.UIComponent getNestingForm(javax.faces.context.FacesContext context,
                                                         javax.faces.component.UIComponent component)

      Find nested form for given component
      Parameters:
        `component` -
      Returns:
        nested `UIForm` component, or `null`

    - #### encodeBeginFormIfNessesary

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

      Parameters:
        `context` -
        `component` -
      Throws:
        `IOException`

    - #### encodeBeginForm

          public void encodeBeginForm(javax.faces.context.FacesContext context,
                             javax.faces.component.UIComponent component,
                             javax.faces.context.ResponseWriter writer,
                             String clientId)
                               throws IOException

      Parameters:
        `context` -
        `component` -
        `writer` -
        `clientId` -
      Throws:
        `IOException`

    - #### encodeEndFormIfNessesary

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

      Parameters:
        `context` -
        `component` -
      Throws:
        `IOException`

    - #### writeState

          public static void writeState(javax.faces.context.FacesContext context)
                                 throws IOException

      Write state saving markers to context, include MyFaces view sequence.
      Parameters:
        `context` -
      Throws:
        `IOException`

    - #### encodeEndForm

          public void encodeEndForm(javax.faces.context.FacesContext context,
                           javax.faces.context.ResponseWriter writer)
                             throws IOException

      Parameters:
        `context` -
        `writer` -
      Throws:
        `IOException`

    - #### getActionUrl

          public String getActionUrl(javax.faces.context.FacesContext facesContext)

      Parameters:
        `facesContext` -
      Returns:
        String A String representing the action URL

    - #### clientId

          public String clientId(javax.faces.context.FacesContext context,
                        javax.faces.component.UIComponent component)

      Simplified version of `encodeId`
      Parameters:
        `context` -
        `component` -
      Returns:
        client id of current component

    - #### writeScript

          public void writeScript(javax.faces.context.FacesContext context,
                         javax.faces.component.UIComponent component,
                         Object script)
                           throws IOException

      Wtrie JavaScript with start/end elements and type.
      Parameters:
        `context` -
        `component` -
        `script` -
      Throws:
        `IOException`

    - #### correctForIdReference

          public String correctForIdReference(String forAttr,
                                     javax.faces.component.UIComponent component)

      If target component contains generated id and for doesn't, correct for id
      Parameters:
        `forAttr` -
        `component` -

    - #### encodeChildren

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

      Throws:
        `IOException`

    - #### hasExplicitId

          public boolean hasExplicitId(javax.faces.component.UIComponent component)

    - #### findComponentFor

          public javax.faces.component.UIComponent findComponentFor(javax.faces.context.FacesContext context,
                                                           javax.faces.component.UIComponent component,
                                                           String id)

    - #### findComponentFor

          public javax.faces.component.UIComponent findComponentFor(javax.faces.component.UIComponent component,
                                                           String id)

      Parameters:
        `component` -
        `id` -
      Returns:

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.