Class RendererUtils


  • public final class RendererUtils
    extends Object
    • Method Detail

      • getStringValue

        public static String getStringValue​(FacesContext context,
                                            jakarta.el.ValueExpression ve)
      • 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
      • getSelectItemList

        public static List getSelectItemList​(UISelectOne uiSelectOne)
      • getSelectItemList

        public static List<SelectItem> getSelectItemList​(UISelectOne uiSelectOne,
                                                         FacesContext facesContext)
        Parameters:
        uiSelectOne -
        facesContext -
        Returns:
        List of SelectItem Objects
      • getSelectItemList

        public static List<SelectItem> getSelectItemList​(UISelectMany uiSelectMany,
                                                         FacesContext facesContext)
        Parameters:
        uiSelectMany -
        facesContext -
        Returns:
        List of SelectItem Objects
      • 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
      • 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)
      • toResourceUri

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