Example usage for com.google.gwt.core.client ScriptInjector fromUrl

List of usage examples for com.google.gwt.core.client ScriptInjector fromUrl

Introduction

In this page you can find the example usage for com.google.gwt.core.client ScriptInjector fromUrl.

Prototype

public static FromUrl fromUrl(String scriptUrl) 

Source Link

Document

Build an injection call for adding a script by URL.

Usage

From source file:com.ait.ext4j.ux.grid.filterfeatures.client.NumericFilter.java

License:Apache License

public static void inject() {
    ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "gridfilter/Numeric.js")
            .setWindow(ScriptInjector.TOP_WINDOW).inject();

}

From source file:com.ait.ext4j.ux.grid.filterfeatures.client.StringFilter.java

License:Apache License

public static void inject() {
    ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "gridfilter/StringFilter.js")
            .setWindow(ScriptInjector.TOP_WINDOW).inject();

}

From source file:com.ait.ext4j.ux.tabs.closemenu.client.TabCloseMenu.java

License:Apache License

public static void inject() {
    ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "tabclose/TabCloseMenu.js")
            .setWindow(ScriptInjector.TOP_WINDOW).inject();
}

From source file:com.ait.ext4j.ux.tabs.scrollermenu.client.TabScrollerMenu.java

License:Apache License

public static void inject() {
    ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "tabscrollermenu/TabScrollerMenu.js")
            .setWindow(ScriptInjector.TOP_WINDOW).inject();
}

From source file:com.ait.toolkit.ace.client.AceEditor.java

License:Open Source License

public void setMode(final AceEditorMode mode) {
    final String modeId = "mode-" + mode.name().toLowerCase();
    String js = modeId + ".js";
    String path = Util.getModuleBaseUrl() + "ace/" + js;

    Element el = DOM.getElementById(modeId);
    if (el == null) {
        modeScriptElement = ScriptInjector.fromUrl(path).setCallback(new Callback<Void, Exception>() {
            @Override/*  w  w  w . ja v  a2  s.  c  om*/
            public void onSuccess(Void result) {
                JsoHelper.setAttribute(modeScriptElement, "id", modeId);
                AceEditor.this._setMode(mode);
            }

            @Override
            public void onFailure(Exception reason) {
            }
        }).setWindow(ScriptInjector.TOP_WINDOW).inject();

    } else {
        this._setMode(mode);

    }

}

From source file:com.ait.toolkit.ace.client.AceEditor.java

License:Open Source License

public void setTheme(final AceEditorTheme theme) {
    final String themeId = "theme-" + theme.name().toLowerCase();
    String js = themeId + ".js";
    String path = Util.getModuleBaseUrl() + "ace/" + js;

    Element el = DOM.getElementById(themeId);
    if (el == null) {
        themeScriptElement = ScriptInjector.fromUrl(path).setCallback(new Callback<Void, Exception>() {
            @Override//w w w  .ja  va  2s  . c  om
            public void onSuccess(Void result) {
                JsoHelper.setAttribute(themeScriptElement, "id", themeId);
                AceEditor.this._setTheme(theme);
            }

            @Override
            public void onFailure(Exception reason) {
            }
        }).setWindow(ScriptInjector.TOP_WINDOW).inject();

    } else {
        _setTheme(theme);
    }
}

From source file:com.ait.toolkit.application.client.ResourceInjector.java

License:Open Source License

/**
 * Loads a javascript file base on the file url
 *///w w  w  . j a  v  a 2  s.  c  om
public void inject() {
    if (this.cssUrl != null) {
        loadCss(this.cssUrl);
    }
    if (this.jsUrl != null) {

        scriptElement = ScriptInjector.fromUrl(this.jsUrl).setCallback(new Callback<Void, Exception>() {
            @Override
            public void onSuccess(Void result) {
                if (ResourceInjector.this.callBack != null) {
                    ResourceInjector.this.callBack.onJsLoaded();
                }
            }

            @Override
            public void onFailure(Exception reason) {
                Window.alert(reason.getMessage() + " for link " + jsUrl);
            }
        }).setWindow(ScriptInjector.TOP_WINDOW).inject();

    }
}

From source file:com.ait.toolkit.sencha.ext.ux.calendar.client.CalendarPanel.java

License:Open Source License

public static void inject() {
    CSSUtil.injectStyleSheet(GWT.getModuleBaseURL() + "extensible/css/extensible-all.css", CAL_PANEL_CSS_ID);
    calendarScriptElement = ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "extensible/extensible-all.js")
            .setWindow(ScriptInjector.TOP_WINDOW).setCallback(new Callback<Void, Exception>() {
                @Override/*  w ww  .  j a  v  a  2s  . co m*/
                public void onSuccess(Void result) {
                    JsoHelper.setAttribute(calendarScriptElement, "id", CAL_PANEL_JS_ID);
                }

                @Override
                public void onFailure(Exception reason) {

                }
            }).inject();
}

From source file:com.ait.toolkit.sencha.ext.ux.grid.checkcolumn.client.CheckColumn.java

License:Open Source License

private static void inject() {
    ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "checkcolumn/CheckColumn.js")
            .setWindow(ScriptInjector.TOP_WINDOW).inject();
}

From source file:com.ait.toolkit.sencha.ext.ux.layout.center.client.CenterLayout.java

License:Open Source License

public static void inject() {
    ScriptInjector.fromUrl(GWT.getModuleBaseURL() + "centerlayout/centerlayout.js")
            .setWindow(ScriptInjector.TOP_WINDOW).inject();
}