Package de.xima.fc.gui.util
Class FacesHelper
java.lang.Object
de.xima.fc.gui.util.FacesHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
createDynamicResourceUrl
(javax.faces.context.FacesContext context, String expression, Map<String, String> params, boolean cache) static <T> T
getBeanCreateIfMissing
(Class<T> beanClass, Annotation... qualifiers) Deprecated.static String
getBeanName
(Class<?> beanClass, Annotation... qualifiers) Deprecated.static <T> T
getBeanNullIfMissing
(Class<T> beanClass, Annotation... qualifiers) Deprecated.static Set<javax.faces.component.UIForm>
getCurrentForms
(javax.faces.context.FacesContext context) Similar toComponents.getCurrentForm()
, but finds all forms.static Locale
static void
hideDialogByWidgetVar
(String widgetVar) static javax.faces.application.FacesMessage.Severity
maxSeverity
(javax.faces.application.FacesMessage.Severity lhs, javax.faces.application.FacesMessage.Severity rhs) static void
showDialogByWidgetVar
(String widgetVar)
-
Method Details
-
createDynamicResourceUrl
public static String createDynamicResourceUrl(javax.faces.context.FacesContext context, String expression, Map<String, String> params, boolean cache) - Parameters:
context
- Current faces context.expression
- Expression to invoke when the resource needs to be fetched, e.g. a bean method. It must return aStreamedContent
.params
- URL parameters to include in the resource URL.cache
- Whether the resource can be cached.- Returns:
- The URL for a dynamic resource that retrieves data from the given expression (e.g. a bean method).
-
getLocaleOrDefault
- Returns:
- The locale from the current Faces context, or the default locale when there is no active Faces context or it does not have a locale set.
-
getBeanCreateIfMissing
@Deprecated public static <T> T getBeanCreateIfMissing(Class<T> beanClass, Annotation... qualifiers) Deprecated.Returns the JSF bean (request scoped, view scoped, session scoped, conversation scoped, or application scoped) of the given class. When the bean was not created yet, creates the bean.- Type Parameters:
T
- Type of the bean to lookup.- Parameters:
beanClass
- Class of the bean to lookup.qualifiers
- Optional qualifiers for the bean.- Returns:
- The bean instance of the given class.
-
getBeanName
Deprecated.- Parameters:
beanClass
- Class of the bean to lookup.qualifiers
- Optional qualifiers for the bean.- Returns:
- The name of the JSF bean (request scoped, view scoped, session scoped, conversation scoped, or application scoped).
-
getBeanNullIfMissing
@Nullable @Deprecated public static <T> T getBeanNullIfMissing(Class<T> beanClass, Annotation... qualifiers) Deprecated.Checks if an instance of the JSF bean (request scoped, view scoped, session scoped, conversation scoped, or application scoped) exists, and returns the bean if it does. When the bean was not created yet, returnsnull
.- Type Parameters:
T
- Type of the bean to lookup.- Parameters:
beanClass
- Class of the bean to lookup.qualifiers
- Optional qualifiers for the bean.- Returns:
- The bean instance if the bean was created already, or
null
otherwise.
-
maxSeverity
public static javax.faces.application.FacesMessage.Severity maxSeverity(javax.faces.application.FacesMessage.Severity lhs, javax.faces.application.FacesMessage.Severity rhs) - Parameters:
lhs
- First severity to process.rhs
- Second severity to process.- Returns:
- The severity with the higher level. The order is
fatal
,error
,warn
,info
, from highest to lowest.
-
showDialogByWidgetVar
-
hideDialogByWidgetVar
-
getCurrentForms
public static Set<javax.faces.component.UIForm> getCurrentForms(javax.faces.context.FacesContext context) Similar toComponents.getCurrentForm()
, but finds all forms. Strictly speaking, JSF only allows one form to beexecute
d during postback. For non-AJAX requests, only one form is possible. But for AJAX requests, PrimeFaces supports components from different forms to beexecute
d (process
ed).Returns the currently submitted UI form components, or
empty set
if there is none, which may happen when the current request is not a postback request at all, or when the view has been changed by for example a successful navigation. If the latter is the case, you'd better invoke this method before navigation.- Parameters:
context
- Current faces context.- Returns:
- The currently submitted UI form components.
-
CdiUtils.getBeanCreateIfMissing(Class, Annotation...)