org.richfaces.renderkit

## Class RenderKitUtils

- java.lang.Object
- - org.richfaces.renderkit.RenderKitUtils

-     public final class RenderKitUtils
      extends Object

  Author:
    Nick Belaevski

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RenderKitUtils.Attributes`
    `static class` | `RenderKitUtils.ScriptHashVariableWrapper` Wrapper class around object value used to transform values into particular JS objects

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addToScriptHash(Map<String,Object> hash, javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, RenderKitUtils.Attributes attributes, RenderKitUtils.ScriptHashVariableWrapper wrapper)`
    `static void` | `addToScriptHash(Map<String,Object> hash, String name, Object value)`
    `static void` | `addToScriptHash(Map<String,Object> hash, String name, Object value, Object defaultValue)`
    `static void` | `addToScriptHash(Map<String,Object> hash, String name, Object value, Object defaultValue, RenderKitUtils.ScriptHashVariableWrapper wrapper)` Puts value into map under specified key if the value is not empty and not default.
    `static String[]` | `asArray(Object object)`
    `static RenderKitUtils.Attributes` | `attributes()`
    `static RenderKitUtils.Attributes` | `attributes(Enum<?>... attrs)`
    `static RenderKitUtils.Attributes` | `attributes(String... attrs)`
    `static String` | `decodeBehaviors(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `static <T> T` | `evaluateAttribute(String attribute, javax.faces.component.UIComponent component, javax.faces.context.FacesContext context)` Tries to evaluate an attribute as `ValueExpression`.
    `static Object` | `getAttributeAndBehaviorsValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, ComponentAttribute componentAttribute)`
    `static String` | `getBehaviorSourceId(javax.faces.context.FacesContext facesContext)`
    `static Object` | `getFirstNonEmptyAttribute(String attributeName, javax.faces.component.UIComponent... components)`
    `static Object` | `getFirstNonEmptyAttribute(String attributeName, javax.faces.component.UIComponent component)`
    `static Object` | `getFirstNonEmptyAttribute(String attributeName, javax.faces.component.UIComponent componentA, javax.faces.component.UIComponent componentB)`
    `static String` | `getResourcePath(javax.faces.context.FacesContext context, String library, String resourceName)`
    `static String` | `getResourceURL(String url, javax.faces.context.FacesContext context)`
    `static boolean` | `hasFacet(javax.faces.component.UIComponent component, String facetName)`
    `static String` | `prefixAttributeName(String attributeName, boolean isXhtmlMode)`
    `static String` | `prefixAttributeName(String attributeName, javax.faces.context.ResponseWriter responseWriter)`
    `static void` | `renderAttribute(javax.faces.context.FacesContext facesContext, String attributeName, Object attributeValue)`
    `static void` | `renderAttributeAndBehaviors(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, ComponentAttribute componentAttribute)`
    `static void` | `renderPassThroughAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Collection<ComponentAttribute> attributes)`
    `static void` | `renderPassThroughAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Map<String,ComponentAttribute> knownAttributesMap)`
    `static void` | `renderPassThroughAttributesOptimized(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Map<String,ComponentAttribute> knownAttributesMap)`
    `static boolean` | `shouldRenderAttribute(Object attributeValue)`
    `static String` | `toScriptArgs(Object... objects)`

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

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

- - ### Method Detail

    - #### asArray

          public static String[] asArray(Object object)

    - #### shouldRenderAttribute

          public static boolean shouldRenderAttribute(Object attributeValue)

    - #### prefixAttributeName

          public static String prefixAttributeName(String attributeName,
                                   boolean isXhtmlMode)

    - #### prefixAttributeName

          public static String prefixAttributeName(String attributeName,
                                   javax.faces.context.ResponseWriter responseWriter)

    - #### renderAttribute

          public static void renderAttribute(javax.faces.context.FacesContext facesContext,
                             String attributeName,
                             Object attributeValue)
                                      throws IOException

      Throws:
        `IOException`

    - #### getAttributeAndBehaviorsValue

          public static Object getAttributeAndBehaviorsValue(javax.faces.context.FacesContext facesContext,
                                             javax.faces.component.UIComponent component,
                                             ComponentAttribute componentAttribute)

    - #### renderAttributeAndBehaviors

          public static void renderAttributeAndBehaviors(javax.faces.context.FacesContext facesContext,
                                         javax.faces.component.UIComponent component,
                                         ComponentAttribute componentAttribute)
                                                  throws IOException

      Throws:
        `IOException`

    - #### renderPassThroughAttributesOptimized

          public static void renderPassThroughAttributesOptimized(javax.faces.context.FacesContext context,
                                                  javax.faces.component.UIComponent component,
                                                  Map<String,ComponentAttribute> knownAttributesMap)
                                                           throws IOException

      Throws:
        `IOException`

    - #### renderPassThroughAttributes

          public static void renderPassThroughAttributes(javax.faces.context.FacesContext context,
                                         javax.faces.component.UIComponent component,
                                         Map<String,ComponentAttribute> knownAttributesMap)
                                                  throws IOException

      Throws:
        `IOException`

    - #### renderPassThroughAttributes

          public static void renderPassThroughAttributes(javax.faces.context.FacesContext context,
                                         javax.faces.component.UIComponent component,
                                         Collection<ComponentAttribute> attributes)
                                                  throws IOException

      Throws:
        `IOException`

    - #### decodeBehaviors

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

    - #### attributes

          public static RenderKitUtils.Attributes attributes()

    - #### attributes

          public static RenderKitUtils.Attributes attributes(Enum<?>... attrs)

    - #### attributes

          public static RenderKitUtils.Attributes attributes(String... attrs)

    - #### addToScriptHash

          public static void addToScriptHash(Map<String,Object> hash,
                             String name,
                             Object value)

    - #### addToScriptHash

          public static void addToScriptHash(Map<String,Object> hash,
                             String name,
                             Object value,
                             Object defaultValue)

    - #### addToScriptHash

          public static void addToScriptHash(Map<String,Object> hash,
                             String name,
                             Object value,
                             Object defaultValue,
                             RenderKitUtils.ScriptHashVariableWrapper wrapper)

      Puts value into map under specified key if the value is not empty and not default. Performs optional value wrapping.
      Parameters:
        `hash` -
        `name` -
        `value` -
        `defaultValue` -
        `wrapper` -
      Since:
        3.3.2

    - #### addToScriptHash

          public static void addToScriptHash(Map<String,Object> hash,
                             javax.faces.context.FacesContext facesContext,
                             javax.faces.component.UIComponent component,
                             RenderKitUtils.Attributes attributes,
                             RenderKitUtils.ScriptHashVariableWrapper wrapper)

    - #### toScriptArgs

          public static String toScriptArgs(Object... objects)

    - #### getResourcePath

          public static String getResourcePath(javax.faces.context.FacesContext context,
                               String library,
                               String resourceName)

    - #### getResourceURL

          public static String getResourceURL(String url,
                              javax.faces.context.FacesContext context)

    - #### getFirstNonEmptyAttribute

          public static Object getFirstNonEmptyAttribute(String attributeName,
                                         javax.faces.component.UIComponent component)

    - #### getFirstNonEmptyAttribute

          public static Object getFirstNonEmptyAttribute(String attributeName,
                                         javax.faces.component.UIComponent componentA,
                                         javax.faces.component.UIComponent componentB)

    - #### getFirstNonEmptyAttribute

          public static Object getFirstNonEmptyAttribute(String attributeName,
                                         javax.faces.component.UIComponent... components)

    - #### getBehaviorSourceId

          public static String getBehaviorSourceId(javax.faces.context.FacesContext facesContext)

    - #### hasFacet

          public static boolean hasFacet(javax.faces.component.UIComponent component,
                         String facetName)

    - #### evaluateAttribute

          public static <T> T evaluateAttribute(String attribute,
                                javax.faces.component.UIComponent component,
                                javax.faces.context.FacesContext context)

      Tries to evaluate an attribute as `ValueExpression`. If the attribute doesn't hold `ValueExpression` or the expression evaluates to `null`, the value of the attribute is returned.
      Parameters:
        `attribute` - the name of a component's attribute
        `component` - the component
        `context` - the context
      Returns:
        the evaluated `ValueExpression` for a given attribute or the value of the attribute (in case the attribute isn't `ValueExpression` or it evaluates to null)

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