public final class ComponentUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<javax.faces.component.UIComponent> |
findTargets(javax.faces.component.UIComponent component,
String target)
Searches for JSF Components within the UIComponent or his parents in the component tree.
|
static <T> T |
getAttributeValue(javax.faces.component.UIComponent component,
String attributeName,
Class<T> resultClass)
Returns the attribute value of a custom component.
|
static int |
getMaxLength(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
Return the
maxLngth from the component (HtmlInputText. |
static String |
getStyle(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
Return the
style from the component (HtmlInputText or HtmlOutputLabel). |
static String |
getStyleClass(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
Return the
styleClass from the component (HtmlInputText, HtmlOutputLabel or HtmlSelectOneMenu). |
static Object |
getValue(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
Return the
value from the component (ValueHolder). |
static boolean |
isRequired(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
Return the
required info from the component (EditableValueHolder). |
static void |
processTargets(javax.faces.component.UIComponent component,
String target,
ComponentCallback callback)
Searches for JSF Components within the UIComponent or his parents in the component tree.
|
public static Object getValue(javax.faces.component.UIComponent component, javax.faces.context.FacesContext facesContext)
value from the component (ValueHolder). It checks first the valueExpression, if not
present then the getter is executed for retrieving fixed values.component - JSF component to get the value from.facesContext - The FacesContextpublic static boolean isRequired(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
required info from the component (EditableValueHolder). It checks first the valueExpression, if not
present then the getter is executed for retrieving fixed values.component - JSF component to get the value from.facesContext - The FacesContextpublic static String getStyle(javax.faces.component.UIComponent component, javax.faces.context.FacesContext facesContext)
style from the component (HtmlInputText or HtmlOutputLabel). It checks first the valueExpression, if not
present then the getter is executed for retrieving fixed values.component - JSF component to get the value from.facesContext - The FacesContextpublic static String getStyleClass(javax.faces.component.UIComponent component, javax.faces.context.FacesContext facesContext)
styleClass from the component (HtmlInputText, HtmlOutputLabel or HtmlSelectOneMenu). It checks first the valueExpression, if not
present then the getter is executed for retrieving fixed values.component - JSF component to get the value from.facesContext - The FacesContextpublic static int getMaxLength(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext facesContext)
maxLngth from the component (HtmlInputText. It checks first the valueExpression, if not
present then the getter is executed for retrieving fixed values.component - JSF component to get the value from.facesContext - The FacesContextpublic static <T> T getAttributeValue(javax.faces.component.UIComponent component,
String attributeName,
Class<T> resultClass)
T - The generic type.component - The custom UIComponent.attributeName - attribute nameresultClass - The class type of the attribute used for castingpublic static List<javax.faces.component.UIComponent> findTargets(javax.faces.component.UIComponent component, String target)
UIComponent.findComponent()
but comes with a potential performance. The algorithm is as follows.
UIComponent.findComponent. Thus absolute ids are supportedcomponent - The Component where the search starts.target - The id or set of ids (separated by ,) to be searched. Absolute ids (like :frm:field) are supported.public static void processTargets(javax.faces.component.UIComponent component,
String target,
ComponentCallback callback)
UIComponent.findComponent()
but comes with a potential performance. For each component found, the callback is called.
UIComponent.findComponent. Thus absolute ids are supportedjavax.faces.application.Resource.ComponentResourcecomponent - The Component where the search starts.target - The id or set of ids (separated by ,) to be searched. Absolute ids (like :frm:field) are supported.callback - Process the found components.Copyright © 2014–2018. All rights reserved.