Class FacesHelper


  • public class FacesHelper
    extends Object
    • Method Detail

      • getBeanCreateIfMissing

        public static <T> T getBeanCreateIfMissing​(Class<T> beanClass,
                                                   Annotation... qualifiers)
        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

        public static String getBeanName​(Class<?> beanClass,
                                         Annotation... qualifiers)
        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
        public static <T> T getBeanNullIfMissing​(Class<T> beanClass,
                                                 Annotation... qualifiers)
        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, returns null.
        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.
      • hideDialogByClientId

        public static void hideDialogByClientId​(javax.faces.context.FacesContext ctx,
                                                String clientId)
        Hides the dialog with the given client ID, when it exists.
        Parameters:
        ctx - Current faces context.
        clientId - Client ID of the dialog.
      • hideDialogByClientId

        public static void hideDialogByClientId​(String clientId)
        Hides the dialog with the given client ID, when it exists.
        Parameters:
        clientId - Client ID of the dialog.
      • 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, , , from highest to lowest.
      • showDialogByClientId

        public static void showDialogByClientId​(javax.faces.context.FacesContext ctx,
                                                String clientId)
        Show the dialog with the given client ID, when it exists.
        Parameters:
        ctx - Current faces context.
        clientId - Client ID of the dialog.
      • showDialogByClientId

        public static void showDialogByClientId​(String clientId)
        Show the dialog with the given client ID, when it exists.
        Parameters:
        clientId - Client ID of the dialog.