Package org.opencms.gwt.client
Class CmsMediaQueryRuleManager
- java.lang.Object
-
- org.opencms.gwt.client.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected static CmsMediaQueryRuleManager
instance
The instance.
-
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.
-
-
-
Field Detail
-
instance
protected static CmsMediaQueryRuleManager instance
The instance.
-
-
Constructor Detail
-
CmsMediaQueryRuleManager
protected CmsMediaQueryRuleManager()
Initializes the rules.
-
-
Method Detail
-
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(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 matchesmediaQueryText
- 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 classenabled
- true if the class should be added, false to remove it
-
-