Package org.zkoss.zkmax.theme
Class ResponsiveThemeRegistry
- java.lang.Object
-
- org.zkoss.zul.theme.DesktopThemeRegistry
-
- org.zkoss.zkmax.theme.ResponsiveThemeRegistry
-
- All Implemented Interfaces:
ThemeRegistry
public class ResponsiveThemeRegistry extends 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 Modifier and Type Field Description static java.lang.String
TABLET_PREFIX
-
Constructor Summary
Constructors Constructor Description ResponsiveThemeRegistry()
Initialize the registry with a default tablet theme
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
deregister(Theme theme)
Removes a desktop or a tablet theme from registryTheme
getTheme(java.lang.String themeName)
Returns the registered device-specific theme; null if not found in registryTheme[]
getThemes()
Returns the available themes, responsive to the users' deviceboolean
hasTheme(java.lang.String themeName)
Checks if a certain theme is registered.boolean
register(Theme theme)
Registers a desktop or a tablet theme Tablet themes must be identified with the "tablet:" prefix.
-
-
-
Field Detail
-
TABLET_PREFIX
public static final java.lang.String TABLET_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
register
public boolean register(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:
register
in interfaceThemeRegistry
- Overrides:
register
in classDesktopThemeRegistry
- 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(Theme theme)
Removes a desktop or a tablet theme from registryTablet themes must be identified with the "tablet:" prefix.
- Specified by:
deregister
in interfaceThemeRegistry
- Overrides:
deregister
in classDesktopThemeRegistry
- 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 Theme[] getThemes()
Returns the available themes, responsive to the users' device- Specified by:
getThemes
in interfaceThemeRegistry
- Overrides:
getThemes
in classDesktopThemeRegistry
- Returns:
- the available themes, responsive to the users' device
-
hasTheme
public boolean hasTheme(java.lang.String themeName)
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:
hasTheme
in interfaceThemeRegistry
- Overrides:
hasTheme
in classDesktopThemeRegistry
- 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
public Theme getTheme(java.lang.String themeName)
Returns the registered device-specific theme; null if not found in registry- Specified by:
getTheme
in interfaceThemeRegistry
- Overrides:
getTheme
in classDesktopThemeRegistry
- Parameters:
themeName
- the name of the theme to retrieve- Returns:
- the registered device-specific theme; null if not found in registry
-
-