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
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize the registry with a default tablet theme
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    deregister(org.zkoss.web.theme.Theme theme)
    Removes a desktop or a tablet theme from registry
    org.zkoss.web.theme.Theme
    getTheme(String themeName)
    Returns the registered device-specific theme; null if not found in registry
    org.zkoss.web.theme.Theme[]
    Returns the available themes, responsive to the users' device
    boolean
    hasTheme(String themeName)
    Checks if a certain theme is registered.
    boolean
    register(org.zkoss.web.theme.Theme theme)
    Registers a desktop or a tablet theme Tablet themes must be identified with the "tablet:" prefix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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:
      register in interface org.zkoss.web.theme.ThemeRegistry
      Overrides:
      register in class org.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 registry

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

      Specified by:
      deregister in interface org.zkoss.web.theme.ThemeRegistry
      Overrides:
      deregister in class org.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:
      getThemes in interface org.zkoss.web.theme.ThemeRegistry
      Overrides:
      getThemes in class org.zkoss.zul.theme.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 org.zkoss.web.theme.ThemeRegistry
      Overrides:
      hasTheme in class org.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

      public org.zkoss.web.theme.Theme getTheme(String themeName)
      Returns the registered device-specific theme; null if not found in registry
      Specified by:
      getTheme in interface org.zkoss.web.theme.ThemeRegistry
      Overrides:
      getTheme in class org.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