org.icefaces.ace.util

## Class ComponentUtils

- java.lang.Object
- - org.icefaces.ace.util.ComponentUtils

-     public class ComponentUtils
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ComponentUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.util.List<javax.faces.model.SelectItem>` | `createSelectItems(javax.faces.component.UIComponent component)`
    `static void` | `decorateAttribute(javax.faces.component.UIComponent component, java.lang.String attribute, java.lang.String value)`
    `static void` | `enableOnElementUpdateNotify(javax.faces.context.ResponseWriter writer, java.lang.String id)`
    `static java.lang.String` | `encodeNameSpace(javax.faces.context.FacesContext fc, java.lang.String id)` Environments like portlets need to namespace the components in order to uniquely identify them on the page in case there are multiple instances of the same portlet or different portlets that use the same ids.
    `static java.lang.String` | `escapeJQueryId(java.lang.String id)`
    `static java.lang.String` | `findClientIds(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String list)`
    `static javax.faces.component.UIComponent` | `findComponent(javax.faces.component.UIComponent base, java.lang.String id)`
    `static java.lang.String` | `findComponentClientId(java.lang.String id)`
    `static javax.faces.component.UIComponent` | `findParentForm(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `static java.lang.String` | `getStringValueToRender(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)` Algorithm works as follows; - If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors terminates jsf lifecycle - Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned - If the component is not a value holder, toString of component is used to support Facelets UIInstructions.
    `static java.lang.String` | `getStringValueToRender(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, java.lang.Object value)` Resolves the end text to render by using a specified value
    `static java.lang.String` | `getWidgetVar(java.lang.String id)`
    `static boolean` | `isLiteralText(javax.faces.component.UIComponent component)`
    `static java.lang.String` | `resolveField(javax.el.ValueExpression expression)` Attempts to return the property accessed in a simple EL expression of the form ${someObject.property}.

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

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

- - ### Constructor Detail

    - #### ComponentUtils

          public ComponentUtils()

  - ### Method Detail

    - #### getStringValueToRender

          public static java.lang.String getStringValueToRender(javax.faces.context.FacesContext facesContext,
                                                                javax.faces.component.UIComponent component)

      Algorithm works as follows; - If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors terminates jsf lifecycle - Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned

      - If the component is not a value holder, toString of component is used to support Facelets UIInstructions.
      Parameters:
        `facesContext` - FacesContext instance
        `component` - UIComponent instance whose value will be returned
      Returns:
        End text

    - #### resolveField

          public static java.lang.String resolveField(javax.el.ValueExpression expression)

      Attempts to return the property accessed in a simple EL expression of the form ${someObject.property}.
      Parameters:
        `expression` - An EL expression to parse the property from.
      Returns:
        The property name of the EL expression.

    - #### getStringValueToRender

          public static java.lang.String getStringValueToRender(javax.faces.context.FacesContext facesContext,
                                                                javax.faces.component.UIComponent component,
                                                                java.lang.Object value)

      Resolves the end text to render by using a specified value
      Parameters:
        `facesContext` - FacesContext instance
        `component` - UIComponent instance whose value will be returned
      Returns:
        End text

    - #### findParentForm

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

    - #### decorateAttribute

          public static void decorateAttribute(javax.faces.component.UIComponent component,
                                               java.lang.String attribute,
                                               java.lang.String value)

    - #### createSelectItems

          public static java.util.List<javax.faces.model.SelectItem> createSelectItems(javax.faces.component.UIComponent component)

    - #### escapeJQueryId

          public static java.lang.String escapeJQueryId(java.lang.String id)

    - #### findClientIds

          public static java.lang.String findClientIds(javax.faces.context.FacesContext context,
                                                       javax.faces.component.UIComponent component,
                                                       java.lang.String list)

    - #### encodeNameSpace

          public static java.lang.String encodeNameSpace(javax.faces.context.FacesContext fc,
                                                         java.lang.String id)

      Environments like portlets need to namespace the components in order to uniquely identify them on the page in case there are multiple instances of the same portlet or different portlets that use the same ids. This method will prepend the namespace properly taking care to ensure that the namespace is not added twice and that a colon (:) is added if necessary.
      Parameters:
        `fc` - The current FacesContext instance
        `id` - The id to encode
      Returns:
        The namespace encoded id

    - #### findComponentClientId

          public static java.lang.String findComponentClientId(java.lang.String id)

    - #### findComponent

          public static javax.faces.component.UIComponent findComponent(javax.faces.component.UIComponent base,
                                                                        java.lang.String id)

    - #### getWidgetVar

          public static java.lang.String getWidgetVar(java.lang.String id)

    - #### isLiteralText

          public static boolean isLiteralText(javax.faces.component.UIComponent component)

    - #### enableOnElementUpdateNotify

          public static void enableOnElementUpdateNotify(javax.faces.context.ResponseWriter writer,
                                                         java.lang.String id)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright 2025 ICEsoft Technologies Canada, Corp. All Rights Reserved.