Class CmsMediaQueryRuleManager


  • public class CmsMediaQueryRuleManager
    extends java.lang.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.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CmsMediaQueryRuleManager()
      Initializes the rules.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRule​(java.lang.String cssClass, java.lang.String mediaQueryText)
      Installs a new media query rule.
      static CmsMediaQueryRuleManager get()
      Gets the instance.
      static void initialize()
      Initializes the manager and sets up the rules.
      void updateBodyClass​(java.lang.String cssClass, boolean enabled)
      Adds or removes a CSS class from the body.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initialize

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

        public void addRule​(java.lang.String cssClass,
                            java.lang.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​(java.lang.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