public final class RendererUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EMPTY_STRING |
static String |
RES_NOT_FOUND |
static String |
SEQUENCE_PARAM |
Modifier and Type | Method and 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 |
getBooleanAttribute(UIComponent component,
String attrName,
boolean defaultValue) |
static boolean |
getBooleanValue(String attribute,
Object value,
boolean defaultValue) |
static Boolean |
getBooleanValue(UIComponent component) |
static String |
getConvertedStringValue(FacesContext context,
UIComponent component,
Converter converter,
Object value)
Convenient utility method that returns the currently given value as String,
using the given converter.
|
static String |
getConvertedStringValue(FacesContext context,
UIComponent component,
Converter converter,
SelectItem selectItem)
Convenient utility method that returns the currently given SelectItem value
as String, using the given converter.
|
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,
creates
Resource and returns it's path suitable for rendering. |
static int |
getIntegerAttribute(UIComponent component,
String attrName,
int defaultValue) |
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 facesContext,
UIComponent component) |
static String |
getStringValue(FacesContext context,
javax.el.ValueExpression ve) |
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 JSF Spec.
|
static boolean |
isRendered(FacesContext facesContext,
UIComponent uiComponent)
Call
UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.faces.component.UIComponent) ,
reads the isRendered property, call UIComponent.popComponentFromEL(javax.faces.context.FacesContext) and returns the value of isRendered. |
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.
|
public static final String EMPTY_STRING
public static final String SEQUENCE_PARAM
public static final String RES_NOT_FOUND
public static Boolean getBooleanValue(UIComponent component)
public static Object getObjectValue(UIComponent component)
public static String getStringValue(FacesContext context, javax.el.ValueExpression ve)
public static String getStringValue(FacesContext facesContext, UIComponent component)
public static String getStringFromSubmittedValueOrLocalValueReturnNull(FacesContext facesContext, UIComponent component)
public static boolean isDefaultAttributeValue(Object value)
value
- public static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) throws FacesException
FacesException
- if the Converter could not be createdpublic static Converter findUISelectManyConverter(FacesContext facesContext, UISelectMany component, boolean considerValueType)
FacesException
- if the Converter could not be createdpublic static void checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass)
public static void renderChildren(FacesContext facesContext, UIComponent component) throws IOException
IOException
public static boolean isRendered(FacesContext facesContext, UIComponent uiComponent)
UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
,
reads the isRendered property, call UIComponent.popComponentFromEL(javax.faces.context.FacesContext)
and returns the value of isRendered.public static List getSelectItemList(UISelectOne uiSelectOne)
public static List<SelectItem> getSelectItemList(UISelectOne uiSelectOne, FacesContext facesContext)
uiSelectOne
- facesContext
- public static List<SelectItem> getSelectItemList(UISelectMany uiSelectMany, FacesContext facesContext)
uiSelectMany
- facesContext
- public static Set getSubmittedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
uiSelectMany
- public static Set getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
uiSelectMany
- public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, Object value)
public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem)
public static Object getConvertedUISelectOneValue(FacesContext facesContext, UISelectOne output, Object submittedValue)
public static Object getConvertedUIOutputValue(FacesContext facesContext, UIOutput output, Object submittedValue) throws ConverterException
ConverterException
public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue) throws ConverterException
facesContext
- selectMany
- submittedValue
- ConverterException
public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue, boolean considerValueType) throws ConverterException
facesContext
- selectMany
- submittedValue
- considerValueType
- if true, the valueType attribute of the component will
also be used (applies for Tomahawk UISelectMany components)ConverterException
public static boolean getBooleanAttribute(UIComponent component, String attrName, boolean defaultValue)
public static int getIntegerAttribute(UIComponent component, String attrName, int defaultValue)
public static boolean getBooleanValue(String attribute, Object value, boolean defaultValue)
public static String getIconSrc(FacesContext facesContext, UIComponent component, String attributeName)
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(javax.faces.context.FacesContext, java.lang.Object)
facesContext
- a FacesContext
component
- a UIComponent
attributeName
- name of attribute that represents "image", "icon", "source", ...public static String toResourceUri(FacesContext facesContext, Object o)
Copyright © 2021 The Apache Software Foundation. All rights reserved.