Package org.apache.myfaces.renderkit
Class RendererUtils
- java.lang.Object
-
- org.apache.myfaces.renderkit.RendererUtils
-
public final class RendererUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
EMPTY_STRING
static String
RES_NOT_FOUND
static String
SEQUENCE_PARAM
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass)
static Converter
findUIOutputConverter(FacesContext facesContext, UIOutput component)
Find the proper Converter for the given UIOutput component.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.static Boolean
getBooleanValue(UIComponent component)
static boolean
getBooleanValue(String attribute, Object value, boolean defaultValue)
static Object
getConvertedUIOutputValue(FacesContext facesContext, UIOutput output, Object submittedValue)
static Object
getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue)
Invokes getConvertedUISelectManyValue() with considerValueType = false, thus implementing the standard behavior of the spec (valueType comes from Tomahawk).static Object
getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue, boolean considerValueType)
Gets the converted value of a UISelectMany component.static Object
getConvertedUISelectOneValue(FacesContext facesContext, UISelectOne output, Object submittedValue)
static String
getIconSrc(FacesContext facesContext, UIComponent component, String attributeName)
Checks for name/library attributes on component and if they are avaliable, createsResource
and returns it's path suitable for rendering.static Object
getObjectValue(UIComponent component)
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.static List<SelectItem>
getSelectItemList(UISelectMany uiSelectMany, FacesContext facesContext)
static List
getSelectItemList(UISelectOne uiSelectOne)
static List<SelectItem>
getSelectItemList(UISelectOne uiSelectOne, FacesContext facesContext)
static String
getStringFromSubmittedValueOrLocalValueReturnNull(FacesContext facesContext, UIComponent component)
static String
getStringValue(FacesContext context, jakarta.el.ValueExpression ve)
static String
getStringValue(FacesContext facesContext, UIComponent component)
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.static boolean
isDefaultAttributeValue(Object value)
See Faces Spec.static void
renderChildren(FacesContext facesContext, UIComponent component)
static String
toResourceUri(FacesContext facesContext, Object o)
Coerces an object into a resource URI, calling the view-handler.
-
-
-
Field Detail
-
EMPTY_STRING
public static final String EMPTY_STRING
- See Also:
- Constant Field Values
-
SEQUENCE_PARAM
public static final String SEQUENCE_PARAM
- See Also:
- Constant Field Values
-
RES_NOT_FOUND
public static final String RES_NOT_FOUND
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 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
-
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, createsResource
and returns it's path suitable for rendering. If component doesn't have name/library gets value for attribute namedattributeName
returns it processed withtoResourceUri(jakarta.faces.context.FacesContext, java.lang.Object)
- Parameters:
facesContext
- aFacesContext
component
- aUIComponent
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.
-
-