Class IvyPrimefacesThemeResolver


  • public class IvyPrimefacesThemeResolver
    extends Object

    Resolves the Primefaces themes that is used in Html Dialogs. The theme is resolved as follows:

    1. If a theme is set in the template.xhtml file header this theme is used.
    2. If a theme is set on the current session this theme is used. See setSessionTheme(String)
    3. If a theme is configured in the application configuration property 'Jsf.primefaces.theme' this theme is used.
    4. The default theme is used. See parameter defaultTheme. The default theme can be configured in the web.xml.

    To set in the template.xhtml add a html header as follows:

     <h:head>
     ...
         <f:attribute name="primefaces.THEME" value="serenity-lime"/>
     ...
     </h:head>
     

    To configure another default theme (e.g. vader) configure it in the web.xml as follows:

         <context-param>
            <param-name>primefaces.THEME</param-name>
            <param-value>#{ivyPrimefacesThemeResolver.getTheme('vader')}</param-value>
        </context-param>
     

    To configure a theme for an application see the app.yaml and change the property 'Jsf.primefaces.theme'.

    To configure a theme for a session use the method setSessionTheme(String).

    Since:
    16.12.2015
    API:
    This is a public API.
    • Method Detail

      • setSessionTheme

        public void setSessionTheme​(String theme)
        Sets or removes the theme that should be used by the current session.
        Parameters:
        theme - the theme to set or null if to remove the session specific theme
        API:
        This public API is available in Java.
      • getSessionTheme

        public String getSessionTheme()
        Gets the theme that is used by the current session.
        Returns:
        theme used by the current session
        API:
        This public API is available in Java.
      • getTheme

        public String getTheme​(String defaultTheme)

        Gets the theme that is used in HtmlDialogs.

        To learn more about how the theme is resolved read the javadoc of the class IvyPrimefacesThemeResolver.

        Parameters:
        defaultTheme - default theme. This is used if neither a session theme nor an application theme is configured.
        Returns:
        theme to use
        API:
        This public API is available in Java.
      • getCustomerThemes

        public List<String> getCustomerThemes()

        Gets the themes that are installed by the customer.

        If you have installed your own themes they will not automatically appear in this list. However, you can manually configure them in web.xml as follows so that they appear here:

         <context-param>
             <param-name>primefaces.customer.themes</param-name>
             <param-value>customer-theme1, customer-theme2</param-value>
         </context-param>
         
        Returns:
        customer themes
        See Also:
        getThemes(), getIvyThemes(), getPrimefacesAdditionalThemes(), getPrimefacesStandardThemes()
        API:
        This public API is available in Java.
      • getIvyThemes

        public List<String> getIvyThemes()

        Gets all available ivy specific themes

        Returns:
        ivy themes
        API:
        This public API is available in Java.
      • getPrimefacesAdditionalThemes

        public List<String> getPrimefacesAdditionalThemes()

        Gets all available themes from primefaces which are not part of the standard themes

        Returns:
        additional primefaces themes
        API:
        This public API is available in Java.