Class IvyPrimefacesThemeResolver
- java.lang.Object
-
- ch.ivyteam.ivy.jsf.primefaces.theme.IvyPrimefacesThemeResolver
-
public class IvyPrimefacesThemeResolver extends Object
Resolves the Primefaces themes that is used in Html Dialogs. The theme is resolved as follows:
- If a theme is set in the template.xhtml file header this theme is used.
- If a theme is set on the current session this theme is used. See
setSessionTheme(String)
- If a theme is configured in the application configuration property 'Jsf.primefaces.theme' this theme is used.
- The default theme is used. See parameter
defaultTheme
. The default theme can be configured in theweb.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 theweb.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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getCustomerThemes()
Gets the themes that are installed by the customer.List<String>
getIvyThemes()
Gets all available ivy specific themesList<String>
getPrimefacesAdditionalThemes()
Gets all available themes from primefaces which are not part of the standard themesString
getSessionTheme()
Gets the theme that is used by the current session.String
getTheme(String defaultTheme)
Gets the theme that is used in HtmlDialogs.List<String>
getThemes()
Gets all available themes.void
setSessionTheme(String theme)
Sets or removes the theme that should be used by the current session.
-
-
-
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.
-
getThemes
public List<String> getThemes()
Gets all available themes.
If you have installed your own themes they will not automatically appear in this list. However, you can manually configure them in
web.xml
so that they appear here. SeegetCustomerThemes()
for more information.- Returns:
- list of all available themes.
- See Also:
getCustomerThemes()
,getIvyThemes()
,getPrimefacesAdditionalThemes()
,getPrimefacesStandardThemes()
- 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.
-
-