Class RendererUtils

java.lang.Object
org.apache.myfaces.renderkit.RendererUtils

public final class RendererUtils extends Object
  • Field Details

  • Method Details

    • getBooleanValue

      public static Boolean getBooleanValue(UIComponent component)
    • getObjectValue

      public static Object getObjectValue(UIComponent component)
    • getStringValue

      public static String getStringValue(FacesContext context, jakarta.el.ValueExpression ve)
    • getStringValue

      public static String getStringValue(FacesContext facesContext, UIComponent component)
    • getStringFromSubmittedValueOrLocalValueReturnNull

      public static String getStringFromSubmittedValueOrLocalValueReturnNull(FacesContext facesContext, UIComponent component)
    • isDefaultAttributeValue

      public static boolean isDefaultAttributeValue(Object value)
      See Faces Spec. 8.5 Table 8-1
      Parameters:
      value -
      Returns:
      boolean
    • findUIOutputConverter

      public static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) throws FacesException
      Find the proper Converter for the given UIOutput component.
      Returns:
      the Converter or null if no Converter specified or needed
      Throws:
      FacesException - if the Converter could not be created
    • findUISelectManyConverter

      public static Converter findUISelectManyConverter(FacesContext facesContext, UISelectMany component, boolean considerValueType)
      Find proper Converter for the entries in the associated Collection or array of the given UISelectMany as specified in API Doc of UISelectMany. If considerValueType is true, the valueType attribute will be used in addition to the standard algorithm to get a valid converter.
      Returns:
      the Converter or null if no Converter specified or needed
      Throws:
      FacesException - if the Converter could not be created
    • checkParamValidity

      public static void checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass)
    • renderChildren

      public static void renderChildren(FacesContext facesContext, UIComponent component) throws IOException
      Throws:
      IOException
    • getSelectItemList

      public static List<SelectItem> getSelectItemList(UIComponent uiComponent, FacesContext facesContext)
    • getSubmittedValuesAsSet

      public static Set getSubmittedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
      Convenient utility method that returns the currently submitted values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a select item is currently selected. Calling the contains method of this Set with the renderable (String converted) item value as argument returns true if this item is selected.
      Parameters:
      uiSelectMany -
      Returns:
      Set containing all currently selected values
    • getSelectedValuesAsSet

      public static Set getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
      Convenient utility method that returns the currently selected values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a value is currently selected. Calling the contains method of this Set with the item value as argument returns true if this item is selected.
      Parameters:
      uiSelectMany -
      Returns:
      Set containing all currently selected values
    • getConvertedUISelectOneValue

      public static Object getConvertedUISelectOneValue(FacesContext facesContext, UISelectOne output, Object submittedValue)
    • getConvertedUIOutputValue

      public static Object getConvertedUIOutputValue(FacesContext facesContext, UIOutput output, Object submittedValue) throws ConverterException
      Throws:
      ConverterException
    • getConvertedUISelectManyValue

      public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue) throws ConverterException
      Invokes getConvertedUISelectManyValue() with considerValueType = false, thus implementing the standard behavior of the spec (valueType comes from Tomahawk).
      Parameters:
      facesContext -
      selectMany -
      submittedValue -
      Returns:
      Throws:
      ConverterException
    • getConvertedUISelectManyValue

      public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue, boolean considerValueType) throws ConverterException
      Gets the converted value of a UISelectMany component.
      Parameters:
      facesContext -
      selectMany -
      submittedValue -
      considerValueType - if true, the valueType attribute of the component will also be used (applies for Tomahawk UISelectMany components)
      Returns:
      Throws:
      ConverterException
    • getBooleanValue

      public static boolean getBooleanValue(String attribute, Object value, boolean defaultValue)
    • getIconSrc

      public static String getIconSrc(FacesContext facesContext, UIComponent component, String attributeName)
      Checks for name/library attributes on component and if they are avaliable, creates Resource and returns it's path suitable for rendering. If component doesn't have name/library gets value for attribute named attributeName returns it processed with toResourceUri(jakarta.faces.context.FacesContext, java.lang.Object)
      Parameters:
      facesContext - a FacesContext
      component - a UIComponent
      attributeName - name of attribute that represents "image", "icon", "source", ...
    • toResourceUri

      public static String toResourceUri(FacesContext facesContext, Object o)
      Coerces an object into a resource URI, calling the view-handler.