public class ComponentUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ComponentUtils.ViewPoolingResetMode |
Modifier and Type | Field and Description |
---|---|
static String |
SKIP_ITERATION_HINT |
static Set<javax.faces.component.visit.VisitHint> |
VISIT_HINTS_SKIP_UNRENDERED |
Modifier and Type | Method and Description |
---|---|
static String |
calculateViewId(javax.faces.context.FacesContext context)
Calculates the current viewId - we can't get it from the ViewRoot if it's not available.
|
static String |
createContentDisposition(String value,
String filename)
Creates an RFC 6266 Content-Dispostion header following all UTF-8 conventions.
|
static void |
decodeBehaviors(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component) |
static String |
encodeURI(String string)
Duplicate code from OmniFacew project under apache license:
https://github.com/omnifaces/omnifaces/blob/develop/license.txt
|
static String |
escapeEcmaScriptText(String text)
Deprecated.
Use
EscapeUtils |
static String |
escapeSelector(String selector) |
static String |
escapeText(String text)
Deprecated.
Use
EscapeUtils |
static String |
escapeXml(String string)
Deprecated.
Use
EscapeUtils |
static <T> T |
eval(javax.faces.component.StateHelper stateHelper,
Serializable key,
Supplier<T> defaultValueSupplier)
Tries to retrieve value from stateHelper by key first.
|
static javax.faces.application.NavigationCase |
findNavigationCase(javax.faces.context.FacesContext context,
String outcome) |
static javax.faces.component.UIComponent |
findParentForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Deprecated.
|
static Object |
getConvertedValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String value) |
static javax.faces.convert.Converter |
getConverter(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Finds appropriate converter for a given value holder
|
static Map<String,List<String>> |
getUIParams(javax.faces.component.UIComponent component) |
static <T extends javax.faces.render.Renderer> |
getUnwrappedRenderer(javax.faces.context.FacesContext context,
String family,
String rendererType) |
static String |
getValueToRender(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component) |
static String |
getValueToRender(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object value)
Algorithm works as follows;
- If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors
terminates jsf lifecycle
- Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned
|
static boolean |
invokeOnClosestIteratorParent(javax.faces.component.UIComponent component,
Consumer<javax.faces.component.UIComponent> function,
boolean includeSelf) |
static boolean |
isNestedWithinIterator(javax.faces.component.UIComponent component) |
static boolean |
isRequestSource(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext context) |
static boolean |
isRTL(javax.faces.context.FacesContext context,
RTLAware component) |
static boolean |
isSkipIteration(javax.faces.component.visit.VisitContext visitContext,
javax.faces.context.FacesContext context) |
static ComponentUtils.ViewPoolingResetMode |
isViewPooling(javax.faces.context.FacesContext context) |
static void |
processDecodesOfFacetsAndChilds(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext context) |
static void |
processUpdatesOfFacetsAndChilds(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext context) |
static void |
processValidatorsOfFacetsAndChilds(javax.faces.component.UIComponent component,
javax.faces.context.FacesContext context) |
static String |
resolveWidgetVar(javax.faces.context.FacesContext context,
Widget widget)
Deprecated.
|
static boolean |
shouldRenderChildren(javax.faces.component.UIComponent component)
Checks if the component's children are rendered
|
static boolean |
shouldRenderFacet(javax.faces.component.UIComponent facet)
Checks if the facet and one of the first level child's is rendered.
|
public static final Set<javax.faces.component.visit.VisitHint> VISIT_HINTS_SKIP_UNRENDERED
public static final String SKIP_ITERATION_HINT
public static String getValueToRender(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public static String getValueToRender(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)
context
- FacesContext instancecomponent
- UIComponent instance whose value will be returnedvalue
- The value of UIComponent if already evaluated outside. E.g. in the renderer.public static javax.faces.convert.Converter getConverter(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- FacesContext instancecomponent
- ValueHolder instance to look converter forpublic static Object getConvertedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)
public static void decodeBehaviors(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public static boolean isRTL(javax.faces.context.FacesContext context, RTLAware component)
public static void processDecodesOfFacetsAndChilds(javax.faces.component.UIComponent component, javax.faces.context.FacesContext context)
public static void processValidatorsOfFacetsAndChilds(javax.faces.component.UIComponent component, javax.faces.context.FacesContext context)
public static void processUpdatesOfFacetsAndChilds(javax.faces.component.UIComponent component, javax.faces.context.FacesContext context)
public static javax.faces.application.NavigationCase findNavigationCase(javax.faces.context.FacesContext context, String outcome)
public static Map<String,List<String>> getUIParams(javax.faces.component.UIComponent component)
public static boolean isSkipIteration(javax.faces.component.visit.VisitContext visitContext, javax.faces.context.FacesContext context)
@Deprecated public static String resolveWidgetVar(javax.faces.context.FacesContext context, Widget widget)
@Deprecated public static String escapeText(String text)
EscapeUtils
@Deprecated public static String escapeEcmaScriptText(String text)
EscapeUtils
@Deprecated public static String escapeXml(String string)
EscapeUtils
& (ampersand) is replaced by & < (less than) is replaced by < > (greater than) is replaced by > " (double quote) is replaced by "
string
- The string to be escaped.@Deprecated public static javax.faces.component.UIComponent findParentForm(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
ComponentTraversalUtils.closestForm(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
instead.context
- component
- public static <T extends javax.faces.render.Renderer> T getUnwrappedRenderer(javax.faces.context.FacesContext context, String family, String rendererType)
public static String calculateViewId(javax.faces.context.FacesContext context)
context
- The FacesContext
.public static String encodeURI(String string) throws UnsupportedEncodingException
URI-encode the given string using UTF-8. URIs (paths and filenames) have different encoding rules as compared to
URL query string parameters. URLEncoder
is actually only for www (HTML) form based query string parameter
values (as used when a webbrowser submits a HTML form). URI encoding has a lot in common with URL encoding, but
the space has to be %20 and some chars doesn't necessarily need to be encoded.
string
- The string to be URI-encoded using UTF-8.null
if null
was given.UnsupportedEncodingException
- if UTF-8 is not supportedpublic static String createContentDisposition(String value, String filename)
value
- e.g. "attachment"filename
- the name of the filepublic static boolean isRequestSource(javax.faces.component.UIComponent component, javax.faces.context.FacesContext context)
public static boolean shouldRenderFacet(javax.faces.component.UIComponent facet)
facet
- The Facet component to checkpublic static boolean shouldRenderChildren(javax.faces.component.UIComponent component)
component
- The component to checkpublic static <T> T eval(javax.faces.component.StateHelper stateHelper, Serializable key, Supplier<T> defaultValueSupplier)
StateHelper
is extended with similar functionality.
(see https://github.com/eclipse-ee4j/mojarra/issues/4568 for details)T
- the expected type of returned valuestateHelper
- The stateHelper to try to retrieve value fromkey
- The key under which value is stored in the stateHelperdefaultValueSupplier
- The object, from which default value is retrievedpublic static boolean isNestedWithinIterator(javax.faces.component.UIComponent component)
public static boolean invokeOnClosestIteratorParent(javax.faces.component.UIComponent component, Consumer<javax.faces.component.UIComponent> function, boolean includeSelf)
public static ComponentUtils.ViewPoolingResetMode isViewPooling(javax.faces.context.FacesContext context)
Copyright © 2020. All rights reserved.