public class ComponentUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
SKIP_ITERATION_HINT |
static EnumSet<javax.faces.component.visit.VisitHint> |
VISIT_HINTS_SKIP_UNRENDERED |
Constructor and Description |
---|
ComponentUtils() |
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 String |
encodeURI(String string)
Duplicate code from OmniFacew project under apache license:
https://github.com/omnifaces/omnifaces/blob/develop/license.txt
|
static boolean |
equals(Object object1,
Object object2) |
static String |
escapeEcmaScriptText(String text) |
static String |
escapeSelector(String selector) |
static String |
escapeText(String text)
Duplicate code from json-simple project under apache license
http://code.google.com/p/json-simple/source/browse/trunk/src/org/json/simple/JSONValue.java
|
static String |
escapeXml(String string)
Replace special characters with XML escapes:
|
static String |
findComponentClientId(String id)
Deprecated.
|
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 javax.faces.convert.Converter |
getConverter(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Finds appropriate converter for a given value holder
|
static String |
getResourceURL(javax.faces.context.FacesContext context,
String value) |
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,
Class<T> rendererClass) |
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 |
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 boolean |
isValueBlank(String value) |
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 |
replaceNewLineWithHtml(String text) |
static TimeZone |
resolveTimeZone(Object timeZone)
|
static String |
resolveWidgetVar(javax.faces.context.FacesContext context,
Widget widget) |
static String |
resolveWidgetVar(String expression)
Deprecated.
|
static String |
resolveWidgetVar(String expression,
javax.faces.component.UIComponent component)
Deprecated.
|
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 EnumSet<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 for@Deprecated public static String findComponentClientId(String id)
@Deprecated public static String resolveWidgetVar(String expression)
@Deprecated public static String resolveWidgetVar(String expression, javax.faces.component.UIComponent component)
public static boolean isValueBlank(String value)
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 String getResourceURL(javax.faces.context.FacesContext context, String value)
public static boolean isSkipIteration(javax.faces.component.visit.VisitContext visitContext, javax.faces.context.FacesContext context)
public static String resolveWidgetVar(javax.faces.context.FacesContext context, Widget widget)
public static String escapeText(String text)
public static String escapeXml(String string)
& (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 TimeZone resolveTimeZone(Object timeZone)
timeZone
- given time zonepublic static <T extends javax.faces.render.Renderer> T getUnwrappedRenderer(javax.faces.context.FacesContext context, String family, String rendererType, Class<T> rendererClass)
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 checkCopyright © 2018. All rights reserved.