GWT 2.0.3

com.google.gwt.dom.client
Class StyleInjector

java.lang.Object
  extended by com.google.gwt.dom.client.StyleInjector

public class StyleInjector
extends java.lang.Object

Used to add stylesheets to the document. The one-argument versions of inject(java.lang.String), injectAtEnd(java.lang.String), and injectAtStart(java.lang.String) use Scheduler.scheduleFinally(com.google.gwt.core.client.Scheduler.ScheduledCommand) to minimize the number of individual style elements created.


Nested Class Summary
static class StyleInjector.StyleInjectorImpl
          The DOM-compatible way of adding stylesheets.
static class StyleInjector.StyleInjectorImplIE
          IE doesn't allow manipulation of a style element through DOM methods.
 
Method Summary
static void inject(java.lang.String css)
          Add a stylesheet to the document.
static void inject(java.lang.String css, boolean immediate)
          Add a stylesheet to the document.
static void injectAtEnd(java.lang.String css)
          Add stylesheet data to the document as though it were declared after all stylesheets previously created by inject(String).
static void injectAtEnd(java.lang.String css, boolean immediate)
          Add stylesheet data to the document as though it were declared after all stylesheets previously created by inject(String).
static void injectAtStart(java.lang.String css)
          Add stylesheet data to the document as though it were declared before all stylesheets previously created by inject(String).
static void injectAtStart(java.lang.String css, boolean immediate)
          Add stylesheet data to the document as though it were declared before all stylesheets previously created by inject(String).
static StyleElement injectStylesheet(java.lang.String contents)
          Deprecated. The returned StyleElement cannot be implemented consistently across all browsers
static StyleElement injectStylesheetAtEnd(java.lang.String contents)
          Deprecated. The returned StyleElement cannot be implemented consistently across all browsers
static StyleElement injectStylesheetAtStart(java.lang.String contents)
          Deprecated. The returned StyleElement cannot be implemented consistently across all browsers
static void setContents(StyleElement style, java.lang.String contents)
          Deprecated. The associated StyleElement cannot be implemented consistently across all browsers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

inject

public static void inject(java.lang.String css)
Add a stylesheet to the document.

Parameters:
css - the CSS contents of the stylesheet

inject

public static void inject(java.lang.String css,
                          boolean immediate)
Add a stylesheet to the document.

Parameters:
css - the CSS contents of the stylesheet
immediate - if true the DOM will be updated immediately instead of just before returning to the event loop. Using this option excessively will decrease performance, especially if used with an inject-css-on-init coding pattern

injectAtEnd

public static void injectAtEnd(java.lang.String css)
Add stylesheet data to the document as though it were declared after all stylesheets previously created by inject(String).

Parameters:
css - the CSS contents of the stylesheet

injectAtEnd

public static void injectAtEnd(java.lang.String css,
                               boolean immediate)
Add stylesheet data to the document as though it were declared after all stylesheets previously created by inject(String).

Parameters:
css - the CSS contents of the stylesheet
immediate - if true the DOM will be updated immediately instead of just before returning to the event loop. Using this option excessively will decrease performance, especially if used with an inject-css-on-init coding pattern

injectAtStart

public static void injectAtStart(java.lang.String css)
Add stylesheet data to the document as though it were declared before all stylesheets previously created by inject(String).

Parameters:
css - the CSS contents of the stylesheet

injectAtStart

public static void injectAtStart(java.lang.String css,
                                 boolean immediate)
Add stylesheet data to the document as though it were declared before all stylesheets previously created by inject(String).

Parameters:
css - the CSS contents of the stylesheet
immediate - if true the DOM will be updated immediately instead of just before returning to the event loop. Using this option excessively will decrease performance, especially if used with an inject-css-on-init coding pattern

injectStylesheet

@Deprecated
public static StyleElement injectStylesheet(java.lang.String contents)
Deprecated. The returned StyleElement cannot be implemented consistently across all browsers

Add a stylesheet to the document. The StyleElement returned by this method is not guaranteed to be unique.

Parameters:
contents - the CSS contents of the stylesheet
Returns:
the StyleElement that contains the newly-injected CSS

injectStylesheetAtEnd

@Deprecated
public static StyleElement injectStylesheetAtEnd(java.lang.String contents)
Deprecated. The returned StyleElement cannot be implemented consistently across all browsers

Add stylesheet data to the document as though it were declared after all stylesheets previously created by injectStylesheet(String). The StyleElement returned by this method is not guaranteed to be unique.

Parameters:
contents - the CSS contents of the stylesheet
Returns:
the StyleElement that contains the newly-injected CSS

injectStylesheetAtStart

@Deprecated
public static StyleElement injectStylesheetAtStart(java.lang.String contents)
Deprecated. The returned StyleElement cannot be implemented consistently across all browsers

Add stylesheet data to the document as though it were declared before any stylesheet previously created by injectStylesheet(String). The StyleElement returned by this method is not guaranteed to be unique.

Parameters:
contents - the CSS contents of the stylesheet
Returns:
the StyleElement that contains the newly-injected CSS

setContents

@Deprecated
public static void setContents(StyleElement style,
                                          java.lang.String contents)
Deprecated. The associated StyleElement cannot be implemented consistently across all browsers

Replace the contents of a previously-injected stylesheet. Updating the stylesheet in-place is typically more efficient than removing a previously-created element and adding a new one. This method should be used with some caution as StyleInjector may recycle StyleElements on certain browsers.

Parameters:
style - a StyleElement previously-returned from injectStylesheet(String).
contents - the new contents of the stylesheet.

GWT 2.0.3