Example usage for com.google.gwt.core.ext.linker ScriptReference getSrc

List of usage examples for com.google.gwt.core.ext.linker ScriptReference getSrc

Introduction

In this page you can find the example usage for com.google.gwt.core.ext.linker ScriptReference getSrc.

Prototype

public final String getSrc() 

Source Link

Document

The src attribute of the resource.

Usage

From source file:com.smartgwt.linker.SmartGwtScriptInjector.java

License:Open Source License

private String getScriptLoadJS(Set<ScriptReference> scriptsToLoad, LinkerContext context) {
    String moduleName = context.getModuleName();
    System.out.println(SCRIPT_ANNOUNCE.replaceFirst("module", moduleName));

    String result = "\nif (!window." + LOADED_SCRIPTS + ") " + "window." + LOADED_SCRIPTS + " = {};\n";
    for (ScriptReference script : scriptsToLoad) {
        String src = script.getSrc();
        result += "if (!" + LOADED_SCRIPTS + "['" + src + "']) {\n  " + LOADED_SCRIPTS + "['" + src
                + "'] = true;\n  " + "document.write('<script language=\"javascript\" src=\"'+" + moduleName
                + "." + XSI_LINKER_MODULE_BASE + "+'" + src + "\"></script>');\n" + "}\n";
        System.out.println(src);/*  w w  w. ja v  a2s.  c  o m*/
    }
    result += "\n";

    return context.isOutputCompact() ? result.replaceAll("\n\\s*", "") : result;
}

From source file:org.cesiumjs.linker.CesiumScriptInjector.java

License:Apache License

private String getScriptLoadJS(Set<ScriptReference> scriptsToLoad, String pageRelativeModulePath) {
    String result = "if (!window." + LOADED_SCRIPTS + ") window." + LOADED_SCRIPTS + " = {};\n";
    for (ScriptReference script : scriptsToLoad) {
        String src = script.getSrc();
        if (!src.startsWith("cs/")) {
            continue;
        }/*from   w w  w. ja  v  a 2 s .  com*/
        result += "if (!" + LOADED_SCRIPTS + "['" + src + "']) {\n  " + LOADED_SCRIPTS + "['" + src
                + "'] = true;\n  " + "document.write('<script src=\"" + pageRelativeModulePath + "/" + src
                + "\">" + "</script>');\n}\n";
        System.out.println(src);
    }
    return result;
}

From source file:org.openlayers.linker.OpenLayersScriptInjector.java

License:Apache License

private String getScriptLoadJS(Set<ScriptReference> scriptsToLoad, String pageRelativeModulePath) {
    String result = "if (!window." + LOADED_SCRIPTS + ") window." + LOADED_SCRIPTS + " = {};\n";
    for (ScriptReference script : scriptsToLoad) {
        String src = script.getSrc();
        if (!src.startsWith("ol/")) {
            continue;
        }//from   w ww.j  a  v  a2s.c o m
        result += "if (!" + LOADED_SCRIPTS + "['" + src + "']) {\n  " + LOADED_SCRIPTS + "['" + src
                + "'] = true;\n  " + "document.write('<script src=\"" + pageRelativeModulePath + "/" + src
                + "\">" + "</script>');\n}\n";
        System.out.println(src);
    }
    return result;
}