Package org.zkoss.zkmax.theme
Class ResponsiveThemeRegistry
java.lang.Object
org.zkoss.zul.theme.DesktopThemeRegistry
org.zkoss.zkmax.theme.ResponsiveThemeRegistry
- All Implemented Interfaces:
org.zkoss.web.theme.ThemeRegistry
public class ResponsiveThemeRegistry
extends org.zkoss.zul.theme.DesktopThemeRegistry
A standard implementation of ThemeRegistry, used in ZK EE
Used to keep track of a separate list of available tablet themes.
Querying the registry for available themes will be responsive to
the client's device. For example, mobile users will be replied
a list of registered tablet themes, whereas desktop viewers will
be given a list of registered desktop themes to choose from.
- Since:
- 6.5.2
- Author:
- neillee
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitialize the registry with a default tablet theme -
Method Summary
Modifier and TypeMethodDescriptionbooleanderegister(org.zkoss.web.theme.Theme theme) Removes a desktop or a tablet theme from registryorg.zkoss.web.theme.ThemeReturns the registered device-specific theme; null if not found in registryorg.zkoss.web.theme.Theme[]Returns the available themes, responsive to the users' devicebooleanChecks if a certain theme is registered.booleanregister(org.zkoss.web.theme.Theme theme) Registers a desktop or a tablet theme Tablet themes must be identified with the "tablet:" prefix.
-
Field Details
-
TABLET_PREFIX
- See Also:
-
-
Constructor Details
-
ResponsiveThemeRegistry
public ResponsiveThemeRegistry()Initialize the registry with a default tablet theme
-
-
Method Details
-
register
public boolean register(org.zkoss.web.theme.Theme theme) Registers a desktop or a tablet theme Tablet themes must be identified with the "tablet:" prefix. The prefix is removed after the registration is done. For example, after "tablet:dark" is registered, the theme name would be "dark", not "tablet:dark".- Specified by:
registerin interfaceorg.zkoss.web.theme.ThemeRegistry- Overrides:
registerin classorg.zkoss.zul.theme.DesktopThemeRegistry- Parameters:
theme- the Theme to be registered. For tablet themes, theme.getName() should have the prefix "tablet:". The tablet theme would be registered with the prefix removed.- Returns:
- true if registration is successful; false if failed
-
deregister
public boolean deregister(org.zkoss.web.theme.Theme theme) Removes a desktop or a tablet theme from registryTablet themes must be identified with the "tablet:" prefix.
- Specified by:
deregisterin interfaceorg.zkoss.web.theme.ThemeRegistry- Overrides:
deregisterin classorg.zkoss.zul.theme.DesktopThemeRegistry- Parameters:
theme- the theme to be removed. For tablet themes, theme should have its name prepended with the prefix "tablet:" before calling. For example, use the sequence below to deregister a tablet theme.Theme tabletTheme = new StandardTheme("tablet:dark"); themeRegistry.deregister(tabletTheme);- Returns:
- true if successful; false if failed
-
getThemes
public org.zkoss.web.theme.Theme[] getThemes()Returns the available themes, responsive to the users' device- Specified by:
getThemesin interfaceorg.zkoss.web.theme.ThemeRegistry- Overrides:
getThemesin classorg.zkoss.zul.theme.DesktopThemeRegistry- Returns:
- the available themes, responsive to the users' device
-
hasTheme
Checks if a certain theme is registered. This method is also responsive to the users' device. Tablet users would check if a certain tablet theme is registered. Similarly, desktop users would check for desktop themes.- Specified by:
hasThemein interfaceorg.zkoss.web.theme.ThemeRegistry- Overrides:
hasThemein classorg.zkoss.zul.theme.DesktopThemeRegistry- Parameters:
themeName- the name of the theme to check- Returns:
- true if the specified themeName is registered for the accessing device; false if not registered
-
getTheme
Returns the registered device-specific theme; null if not found in registry- Specified by:
getThemein interfaceorg.zkoss.web.theme.ThemeRegistry- Overrides:
getThemein classorg.zkoss.zul.theme.DesktopThemeRegistry- Parameters:
themeName- the name of the theme to retrieve- Returns:
- the registered device-specific theme; null if not found in registry
-