com.gwtext.client.util
Class CSS

java.lang.Object
  extended by com.gwtext.client.util.CSS

public class CSS
extends java.lang.Object

Utility class for manipulating CSS rules.


Constructor Summary
CSS()
           
 
Method Summary
static void createStyleSheet(java.lang.String cssText, java.lang.String id)
          Very simple dynamic creation of stylesheets from a text blob of rules.
static CSSRule getRule(java.lang.String selector, boolean refreshCache)
          Gets an an individual CSS rule by selector(s).
static void refreshCache()
          Refresh the rule cache if you have dynamically added stylesheets.
static void removeStyleSheet(java.lang.String id)
          Removes a style or link tag by id
static void swapStyleSheet(java.lang.String id, java.lang.String url)
          Dynamically swaps an existing stylesheet reference for a new one.
static void updateRule(java.lang.String selector, java.lang.String property, java.lang.String value)
          Updates a rule property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSS

public CSS()
Method Detail

createStyleSheet

public static void createStyleSheet(java.lang.String cssText,
                                    java.lang.String id)
Very simple dynamic creation of stylesheets from a text blob of rules. The text will wrapped in a style tag and appended to the HEAD of the document.

Parameters:
cssText - the text containing the css rules
id - an id to add to the stylesheet for later removal

getRule

public static CSSRule getRule(java.lang.String selector,
                              boolean refreshCache)
Gets an an individual CSS rule by selector(s).

Parameters:
selector - the CSS selector or an array of selectors to try. The first selector that is found is returned
refreshCache - true to refresh the internal cache if you have recently updated any rules or added styles dynamically
Returns:
the CSS rule or null if one is not found

refreshCache

public static void refreshCache()
Refresh the rule cache if you have dynamically added stylesheets.


removeStyleSheet

public static void removeStyleSheet(java.lang.String id)
Removes a style or link tag by id

Parameters:
id - stylesheet id

swapStyleSheet

public static void swapStyleSheet(java.lang.String id,
                                  java.lang.String url)
Dynamically swaps an existing stylesheet reference for a new one.

Parameters:
id - the id of an existing link tag to remove
url - the href of the new stylesheet to include

updateRule

public static void updateRule(java.lang.String selector,
                              java.lang.String property,
                              java.lang.String value)
Updates a rule property.

Parameters:
selector - the seelctor. Stops immediately once one is found.
property - the css property
value - the new value for the property