Example usage for com.google.gwt.dom.client ScriptElement setText

List of usage examples for com.google.gwt.dom.client ScriptElement setText

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

The script content of the element.

Usage

From source file:com.ait.toolkit.sencha.touch.client.core.JsInjector.java

License:Open Source License

public static void intject(String javaScript) {
    HeadElement head = getHead();// w  w  w  .  j  av a2s  .c  o m
    ScriptElement element = createScriptElement();
    element.setText(javaScript);
    head.appendChild(element);
}

From source file:com.akjava.gwt.hangout.apilist.client.APILists.java

License:Apache License

private static ScriptElement createScriptElement(String src, String content) {
    ScriptElement script = Document.get().createScriptElement();
    script.setAttribute("type", "text/javascript");
    if (src != null) {
        script.setAttribute("src", src);
    }/*from w w  w. j  a va  2s .c  o  m*/
    if (content != null) {
        script.setText(content);
    }
    return script;
}

From source file:com.github.gwtbootstrap.client.ui.resources.JavaScriptInjector.java

License:Apache License

/**
 * Injects the JavaScript code into a/*from w w w.j  av  a  2  s .com*/
 * {@code <script type="text/javascript">...</script>} element in the
 * document header.
 * 
 * @param javascript
 *            the JavaScript code
 */
public static void inject(String javascript) {
    HeadElement head = getHead();
    ScriptElement element = createScriptElement();
    element.setText(javascript);
    head.appendChild(element);
}

From source file:com.googlecode.gflot.client.util.JavaScriptInjector.java

License:Open Source License

public static void inject(String javascript) {
    HeadElement head = getHead();//from w  w  w  .  j  av a  2s .  com
    ScriptElement element = createScriptElement();
    element.setText(javascript);
    head.appendChild(element);
}

From source file:com.pronoiahealth.olhie.resources.OlhieResourceInjector.java

License:Open Source License

/**
 * Inject javascript in head element/*from  w w w .  j a  v a 2s.com*/
 * 
 * @param r
 */
private static void injectJs(TextResource r) {
    String jsStr = r.getText();
    HeadElement head = getHead();
    ScriptElement element = createScriptElement();
    element.setText(jsStr);
    head.appendChild(element);
}

From source file:fr.loria.score.client.RtApi.java

License:Open Source License

private void injectJSFilesForRTEditor(com.google.gwt.dom.client.Element parentElem) {
    ScriptElement u1 = createScriptElement();
    u1.setText(bundle.jquery().getText());
    parentElem.appendChild(u1);//  w ww  . ja va 2 s  .  com

    ScriptElement u2 = createScriptElement();
    u2.setText(bundle.theme().getText());
    parentElem.appendChild(u2);

    ScriptElement u3 = createScriptElement();
    u3.setText(bundle.utils().getText());
    parentElem.appendChild(u3);

    ScriptElement u4 = createScriptElement();
    u4.setText(bundle.keys().getText());
    parentElem.appendChild(u4);

    ScriptElement u5 = createScriptElement();
    u5.setText(bundle.clipboard().getText());
    parentElem.appendChild(u5);

    ScriptElement u6 = createScriptElement();
    u6.setText(bundle.history().getText());
    parentElem.appendChild(u6);

    ScriptElement u7 = createScriptElement();
    u7.setText(bundle.cursor().getText());
    parentElem.appendChild(u7);

    ScriptElement u8 = createScriptElement();
    u8.setText(bundle.editor().getText());
    parentElem.appendChild(u8);

    ScriptElement u9 = createScriptElement();
    u9.setText(bundle.model().getText());
    parentElem.appendChild(u9);

    ScriptElement u10 = createScriptElement();
    u10.setText(bundle.model().getText());
    parentElem.appendChild(u10);

    ScriptElement u11 = createScriptElement();
    u11.setText(bundle.parser().getText());
    parentElem.appendChild(u11);

    ScriptElement u12 = createScriptElement();
    u12.setText(bundle.initEditor().getText());
    parentElem.appendChild(u12);
}

From source file:org.eumetsat.usd.gcp.client.dygraphs.Dygraphs.java

License:Open Source License

/**
 * Install the Dygraphs JavaScript source into the current document. This method is idempotent.
 *///from  ww w .j  av  a  2  s .c  o  m
public static synchronized void install() {
    if (!installed) {
        ScriptElement dygraphsScript = Document.get().createScriptElement();
        dygraphsScript.setText(Resources.INSTANCE.dygraphs().getText());
        Document.get().getBody().appendChild(dygraphsScript);

        ScriptElement dygraphsExtraScript = Document.get().createScriptElement();
        dygraphsExtraScript.setText(Resources.INSTANCE.dygraphsExtra().getText());
        Document.get().getBody().appendChild(dygraphsExtraScript);

        installed = true;
    }
}

From source file:org.geosdi.geoplatform.gui.configuration.resources.GeoPlatformJSInjector.java

License:Open Source License

/**
 * <p> Create//w  w  w. j ava  2  s  .  c  o  m
 * {@code <script type="text/javascript" language="javascript">...</script>}
 * element in the Document Header. </p>
 *
 * @param javascript
 */
public static void inject(String javascript) {
    assert (javascript != null && !javascript.equals("")) : "Javascript must not be null or Empty String";

    HeadElement head = getHead();
    ScriptElement element = createScriptElement();
    element.setText(javascript);
    head.appendChild(element);
}

From source file:org.geosdi.geoplatform.gui.configuration.resources.GoogleAnalyticsInjector.java

License:Open Source License

@Override
public void buildAnalytics() {
    ScriptElement analyticsElement = createScriptElement();
    analyticsElement.setText("var _gaq = _gaq || " + "[];_gaq.push(['_setAccount', '" + userAccount
            + "']);_gaq.push(['_trackPageview']);");

    Element firstScript = getHead().getElementsByTagName("script").getItem(0);

    firstScript.getParentNode().insertBefore(analyticsElement, firstScript);

    ScriptElement script = createScriptElement();

    script.setSrc(("https:".equals(Window.Location.getProtocol()) ? "https://ssl" : "http://www")
            + ".google-analytics.com/ga.js");

    script.setType("text/javascript");
    script.setAttribute("async", "true");

    firstScript.getParentNode().insertBefore(script, firstScript);
}

From source file:org.wso2.developerstudio.codenvy.ext.esb.client.inject.ESBJavaScriptInjector.java

License:Open Source License

public static void inject(String javascript) {

    HeadElement head = getHead();//from   w  ww  .  j  ava 2  s.  c o m
    new Timer() {

        public void run() {
            // goJsPlumb();
            goJS();
        }
    }.schedule(1);

    ScriptElement element = createScriptElement();
    element.setText(javascript);
    head.appendChild(element);
}