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 Details

  • Constructor Details

    • ResponsiveThemeRegistry

      public ResponsiveThemeRegistry()
      Initialize the registry with a default tablet theme
  • Method Details

    • 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 interface ThemeRegistry
      Overrides:
      register in class 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(Theme theme)
      Removes a desktop or a tablet theme from registry

      Tablet themes must be identified with the "tablet:" prefix.

      Specified by:
      deregister in interface ThemeRegistry
      Overrides:
      deregister in class 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 Theme[] getThemes()
      Returns the available themes, responsive to the users' device
      Specified by:
      getThemes in interface ThemeRegistry
      Overrides:
      getThemes in class DesktopThemeRegistry
      Returns:
      the available themes, responsive to the users' device
    • hasTheme

      public boolean hasTheme(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 interface ThemeRegistry
      Overrides:
      hasTheme in class 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

      public Theme getTheme(String themeName)
      Returns the registered device-specific theme; null if not found in registry
      Specified by:
      getTheme in interface ThemeRegistry
      Overrides:
      getTheme in class DesktopThemeRegistry
      Parameters:
      themeName - the name of the theme to retrieve
      Returns:
      the registered device-specific theme; null if not found in registry