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

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

Introduction

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

Prototype

public static StyleElement injectStylesheetAtStart(String contents) 

Source Link

Document

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

Usage

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

License:Apache License

private void injectBoostrap3() {
    final CruxBootstrap3Resources resources = GWT.create(CruxBootstrap3Resources.class);

    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
        @Override/*from  www .  j  ava 2 s . c  om*/
        public boolean execute() {
            //Cascade Style Sheet
            String bootstrapCSS = resources.css().getText();
            String bootstrapModalCSS = resources.bootstrapModalCSS().getText();
            String bootstrapSelectCSS = resources.bootstrapSelectCSS().getText();
            String bootstrapThemeCSS = resources.themeCss().getText();
            String docsCSS = resources.docs().getText();

            StyleInjector.injectStylesheetAtStart(bootstrapCSS);
            StyleInjector.injectStylesheetAtStart(bootstrapThemeCSS);
            StyleInjector.injectStylesheetAtStart(bootstrapSelectCSS);
            StyleInjector.injectStylesheetAtStart(bootstrapModalCSS);
            StyleInjector.injectStylesheetAtStart(docsCSS);

            //JavaScript
            String bootstrapJS = resources.bootstrapJS().getText();
            String jquery = resources.jquery().getText();
            String modalJS = resources.bootstrapModal().getText();
            String modalManagerJS = resources.bootstrapModalManager().getText();
            String selectJS = resources.bootstrapSelect().getText();
            String html5shiv = resources.html5shiv().getText();

            ScriptInjector.fromString(jquery).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(bootstrapJS).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(modalManagerJS).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(modalJS).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(selectJS).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(html5shiv).setWindow(ScriptInjector.TOP_WINDOW).inject();

            resources.font().ensureInjected();

            return false;
        }
    }, 300);
}