Class CmsMediaQueryRuleManager

java.lang.Object
org.opencms.gwt.client.CmsMediaQueryRuleManager

public class CmsMediaQueryRuleManager extends Object
Singleton class that evaluates, and keeps track of changes for, a fixed set of media queries and sets CSS classes on the body element depending on which of the media queries match.
  • Field Details

  • Constructor Details

  • Method Details

    • get

      public static CmsMediaQueryRuleManager get()
      Gets the instance.
      Returns:
      the instance
    • initialize

      public static void initialize()
      Initializes the manager and sets up the rules.
    • addRule

      public void addRule(String cssClass, String mediaQueryText)
      Installs a new media query rule.
      Parameters:
      cssClass - the CSS class to add if the media query matches
      mediaQueryText - the text of the media query
    • updateBodyClass

      public void updateBodyClass(String cssClass, boolean enabled)
      Adds or removes a CSS class from the body.
      Parameters:
      cssClass - the CSS class
      enabled - true if the class should be added, false to remove it