Package org.zkoss.zul.theme
Class Themes
java.lang.Object
org.zkoss.zul.theme.Themes
Facade for accessing internal theming subsystem
In most cases, users need not use the underlying theme registry and
theme resolver directly.
- Author:
- sam, neillee
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the current theme namestatic StringgetDisplayName(String themeName) Return the display name (human name) of the themestatic intgetPriority(String themeName) Return the priority of the given themestatic StringgetTheme(org.zkoss.zk.ui.Execution exe) Returns the theme specified using the current theme resolution strategy Default strategy is to use cookiesstatic String[]Returns an array of registered theme namesstatic booleanReturns true if the theme is registeredstatic voidRegister the theme, so it becomes available in the theme liststatic voidRegister the theme with detailsstatic voidregister(String themeName, String displayName, int priority, org.zkoss.web.theme.StandardTheme.ThemeOrigin origin) Register the theme, its display name, its priority; and also specifies its origin (e.g. from JAR or from FOLDER).static voidRegister the theme, and specifies its origin (e.g. from JAR or from FOLDER) Please useThemes.register("custom", Themes.ThemeOrigin.FOLDER)to make your custom theme available if the theme resource is inside a folderstatic voidsetDisplayName(String themeName, String displayName) Set the display name (human name) of the themestatic voidsetPriority(String themeName, int priority) Set the priority of the theme.static voidSets the theme name using the current theme resolution strategy Default strategy is to use cookies
-
Constructor Details
-
Themes
public Themes()
-
-
Method Details
-
setTheme
Sets the theme name using the current theme resolution strategy Default strategy is to use cookies- Parameters:
exe- ExecutionthemeName- the new intended theme name
-
getTheme
Returns the theme specified using the current theme resolution strategy Default strategy is to use cookies- Parameters:
exe- Execution- Returns:
- the name of the theme or a fall back theme name determined by the theme resolution strategy used.
-
getCurrentTheme
Returns the current theme name- Returns:
- the current theme name
-
hasTheme
Returns true if the theme is registered- Parameters:
themeName- the name of the theme- Returns:
- true if the theme with the given name is registered
-
getThemes
Returns an array of registered theme names- Returns:
- an array of registered theme names
-
register
Register the theme, so it becomes available in the theme list- Parameters:
themeName- the name of the theme to be registered Since 6.5.2, to register additional tablet themes, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.register("tablet:dark")would register a tablet theme with the name "dark".
-
register
Register the theme, and specifies its origin (e.g. from JAR or from FOLDER) Please useThemes.register("custom", Themes.ThemeOrigin.FOLDER)to make your custom theme available if the theme resource is inside a folder- Parameters:
themeName- theme name Since 6.5.2, to register additional tablet themes, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.register("tablet:dark")would register a tablet theme with the name "dark".origin- origin of the theme resource- Since:
- 6.5.2
-
register
Register the theme with details- Parameters:
themeName- theme name Since 6.5.2, to register additional tablet themes, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.register("tablet:dark")would register a tablet theme with the name "dark".displayName- The human name of the themepriority- Priority is higher if the value the smaller
-
register
public static void register(String themeName, String displayName, int priority, org.zkoss.web.theme.StandardTheme.ThemeOrigin origin) Register the theme, its display name, its priority; and also specifies its origin (e.g. from JAR or from FOLDER). Please useThemes.register("custom", "Custom Theme", 100, Themes.ThemeOrigin.FOLDER)to make your custom theme available if the theme resource is inside a folder.- Parameters:
themeName- theme name Since 6.5.2, to register additional tablet themes, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.register("tablet:dark")would register a tablet theme with the name "dark".displayName- a more descriptive name for the theme, for display purposepriority- priority of the themeorigin- origin of the theme resource- Since:
- 6.5.2
-
setDisplayName
Set the display name (human name) of the theme- Parameters:
themeName- theme name Since 6.5.2, to identify tablet themes for changing display names, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.setDisplayName("tablet:dark", "foo")would change the display name for the tablet theme with the name "dark".displayName- the new name to be displayed
-
getDisplayName
Return the display name (human name) of the theme- Parameters:
themeName- theme name Since 6.5.2, to identify tablet themes for getting display names, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.getDisplayName("tablet:dark")would return the display name for the tablet theme with the name "dark".- Returns:
- the display name
-
setPriority
Set the priority of the theme.- Parameters:
themeName- theme name Since 6.5.2, to identify tablet themes for changing priorities, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.setPriority("tablet:dark", 100)would change the display name for the tablet theme with the name "dark".priority- Priority is higher if the value the smaller
-
getPriority
Return the priority of the given theme- Parameters:
themeName- theme name Since 6.5.2, to identify tablet themes for getting priorities, just prepend theme names with the "tablet:" prefix (ZK EE only). For example,Themes.getDisplayName("tablet:dark")would return the priority for the tablet theme with the name "dark".- Returns:
- the priority of the given theme
-