Example usage for com.google.gwt.dom.client StyleInjector injectStylesheetAtEnd

List of usage examples for com.google.gwt.dom.client StyleInjector injectStylesheetAtEnd

Introduction

In this page you can find the example usage for com.google.gwt.dom.client StyleInjector injectStylesheetAtEnd.

Prototype

public static StyleElement injectStylesheetAtEnd(String contents) 

Source Link

Document

Add stylesheet data to the document as though it were declared after all stylesheets previously created by #injectStylesheet(String) .

Usage

From source file:cc.kune.common.client.utils.CSSUtils.java

License:GNU Affero Public License

/**
 * Adds the css.// ww w  .ja v  a 2  s .c  om
 *
 * @param cssContents the css contents
 * @return the style element
 */
@SuppressWarnings("deprecation")
public static StyleElement addCss(final String cssContents) {
    // final StyleElement style = Document.get().createStyleElement();
    // style.setPropertyString("language", "text/css");
    // style.setInnerText(cssContents);

    return StyleInjector.injectStylesheetAtEnd(cssContents);
}

From source file:gwt.material.design.components.client.GwtMDC.java

License:Apache License

public static StyleElement injectCss(TextResource resource) {
    return StyleInjector.injectStylesheetAtEnd(resource.getText());
}

From source file:gwt.material.design.components.client.theme.ThemeManager.java

License:Apache License

public static void applyTheme(final String resource) {

    // Remove old styles
    if (currentTheme != null) {
        currentTheme.removeFromParent();
    }// ww  w  .  j  a  v  a  2  s  .com

    GwtMDC.loadCssResources();

    // Apply the theme
    currentTheme = StyleInjector.injectStylesheetAtEnd(resource);

}

From source file:org.cruxframework.crux.plugin.bootstrap.client.ModuleLoader.java

License:Apache License

@SuppressWarnings("unused")
private void injectBoostrap2() {
    final CruxBootstrap2Resources res = GWT.create(CruxBootstrap2Resources.class);

    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

        @Override//from  www.jav  a 2  s . c  o  m
        public boolean execute() {
            //JavaScript
            String jquery = res.jquery().getText();
            String bs2JS = res.bootstrap2JS().getText();
            String html5shiv = res.html5shiv().getText();
            String modal = res.bootstrapModal().getText();
            String modalManager = res.bootstrapModalManager().getText();
            String select = res.bootstrapSelect().getText();

            ScriptInjector.fromString(jquery).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(bs2JS).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(modalManager).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(modal).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(select).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(html5shiv).setWindow(ScriptInjector.TOP_WINDOW).inject();

            //Cascade Style Sheets
            String bs2Responsive = res.cssResponsive().getText();
            String bootstrapModalCSS = res.bootstrapModalCSS().getText();
            String bootstrapSelectCSS = res.bootstrapSelectCSS().getText();
            String bs2Css = res.css().getText();

            StyleInjector.injectStylesheetAtEnd(bs2Css);
            StyleInjector.injectStylesheetAtEnd(bs2Responsive);
            StyleInjector.injectStylesheetAtEnd(bootstrapSelectCSS);
            StyleInjector.injectStylesheetAtEnd(bootstrapModalCSS);

            return false;
        }

    }, 300);
}