public final class RendererUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_FOR_LIST |
static String |
ACTION_FOR_PHASE_LIST |
static String |
EMPTY_STRING |
static Object |
NOTHING |
static String |
RES_NOT_FOUND |
static String |
SELECT_ITEM_LIST_ATTR |
static String |
SEQUENCE_PARAM |
Modifier and Type | Method and Description |
---|---|
static void |
addOrReplaceChild(UIInput component,
UIComponent child) |
static void |
checkParamValidity(FacesContext facesContext,
UIComponent uiComponent,
Class compClass) |
static List |
convertIdsToClientIds(String actionFor,
FacesContext facesContext,
UIComponent component) |
static List |
convertPhasesToPhasesIds(String actionForPhase) |
static void |
copyHtmlInputTextAttributes(HtmlInputText src,
HtmlInputText dest) |
static UIComponent |
findComponent(UIComponent headerComp,
Class clazz) |
static FormInfo |
findNestingForm(UIComponent uiComponent,
FacesContext facesContext)
Find the enclosing form of a component
in the view-tree.
|
static Converter |
findUIOutputConverter(FacesContext facesContext,
UIOutput component)
Find the proper Converter for the given UIOutput component.
|
static Converter |
findUISelectManyConverter(FacesContext facesContext,
UISelectMany component)
Calls findUISelectManyConverter with considerValueType = false.
|
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 |
getClientId(FacesContext facesContext,
UIComponent uiComponent,
String forAttr) |
static String |
getConcatenatedId(FacesContext context,
UIComponent component) |
static String |
getConcatenatedId(FacesContext context,
UIComponent container,
String clientId) |
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 Date |
getDateValue(UIComponent component) |
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 String |
getPathToComponent(UIComponent component) |
static ResponseStateManager |
getResponseStateManager(FacesContext facesContext,
String renderKitId)
Deprecated.
use FacesContext.getRenderKit() or getRenderKitFactory().getRenderKit(
context, renderKitId).getResponseStateManager()
|
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 |
getSelectItemList(UISelectMany uiSelectMany) |
static List |
getSelectItemList(UISelectMany uiSelectMany,
FacesContext facesContext) |
static List |
getSelectItemList(UISelectOne uiSelectOne) |
static List |
getSelectItemList(UISelectOne uiSelectOne,
FacesContext facesContext) |
static String |
getStringFromSubmittedValueOrLocalValueReturnNull(FacesContext facesContext,
UIComponent component) |
static String |
getStringValue(FacesContext facesContext,
UIComponent component) |
static String |
getStringValue(FacesContext context,
ValueBinding vb)
Deprecated.
|
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 void |
initPartialValidationAndModelUpdate(UIComponent component,
FacesContext facesContext)
check for partial validation or model update attributes being set
and initialize the request-map accordingly.
|
static boolean |
isAdfOrTrinidadForm(UIComponent component) |
static boolean |
isDefaultAttributeValue(Object value)
See JSF Spec.
|
static boolean |
isRendered(FacesContext facesContext,
UIComponent uiComponent)
Call
#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 String |
loadResourceFile(FacesContext ctx,
String file)
Helper method which loads a resource file (such as css) by a given context path and a file name.
|
static void |
renderChild(FacesContext facesContext,
UIComponent child)
Deprecated.
use UIComponent.encodeAll() instead
|
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 SELECT_ITEM_LIST_ATTR
public static final String EMPTY_STRING
public static final Object NOTHING
public static final String ACTION_FOR_LIST
public static final String ACTION_FOR_PHASE_LIST
public static final String SEQUENCE_PARAM
public static final String RES_NOT_FOUND
public static String getPathToComponent(UIComponent component)
public static String getConcatenatedId(FacesContext context, UIComponent container, String clientId)
public static String getConcatenatedId(FacesContext context, UIComponent component)
public static Boolean getBooleanValue(UIComponent component)
public static Date getDateValue(UIComponent component)
public static Object getObjectValue(UIComponent component)
@Deprecated public static String getStringValue(FacesContext context, ValueBinding vb)
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)
facesContext
- component
- public 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
@Deprecated public static void renderChild(FacesContext facesContext, UIComponent child) throws IOException
facesContext
- child
- IOException
public static boolean isRendered(FacesContext facesContext, 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 getSelectItemList(UISelectOne uiSelectOne, FacesContext facesContext)
uiSelectOne
- facesContext
- public static List getSelectItemList(UISelectMany uiSelectMany)
public static List 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 FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
UIForm
and all known
form-families are searched for.
Currently those are the Trinidad form family,
and the (old) ADF Faces form family.
There might be additional form families
which have to be explicitly entered here.uiComponent
- facesContext
- public static boolean getBooleanValue(String attribute, Object value, boolean defaultValue)
public static void copyHtmlInputTextAttributes(HtmlInputText src, HtmlInputText dest)
public static UIComponent findComponent(UIComponent headerComp, Class clazz)
public static void addOrReplaceChild(UIInput component, UIComponent child)
public static String getClientId(FacesContext facesContext, UIComponent uiComponent, String forAttr)
public static List convertIdsToClientIds(String actionFor, FacesContext facesContext, UIComponent component)
public static String loadResourceFile(FacesContext ctx, String file)
ctx
- FacesContext
object to calculate the context path of the web application.file
- name of the resource file (e.g. foo.css
).null
if no such file is available.public static void initPartialValidationAndModelUpdate(UIComponent component, FacesContext facesContext)
public static boolean isAdfOrTrinidadForm(UIComponent component)
@Deprecated public static ResponseStateManager getResponseStateManager(FacesContext facesContext, String renderKitId) throws FacesException
FacesException
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 CoreRenderer#toResourceUri(FacesContext, 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 © 2020 The Apache Software Foundation. All rights reserved.