Examples of ScriptElement


Examples of com.google.gdt.eclipse.designer.model.module.ScriptElement

        "<module>",
        "  <script src='some.url'/>",
        "</module>"});
    assertThat(m_module.getChildren()).hasSize(1);
    // prepare single "<script>" element
    ScriptElement scriptElement;
    {
      List<ScriptElement> scriptElements = m_module.getScriptElements();
      assertThat(scriptElements).hasSize(1);
      scriptElement = scriptElements.get(0);
    }
    // current "src" value
    assertEquals("some.url", scriptElement.getSrc());
    // set new "src" value
    {
      scriptElement.setSrc("new.url");
      assertUpdatedModuleFile(StringUtils.replace(m_moduleContent, "some.url", "new.url"));
    }
  }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

            }
        });
    }

    protected void include(String source) {
        ScriptElement el = Document.get().createScriptElement();
        el.setType("text/javascript");
        el.setSrc(source);
        Document.get().getBody().appendChild(el);
    }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

   * Install the Dygraphs JavaScript source into the current document.  This
   * method is idempotent.
   */
  public static synchronized void install() {
    if (!installed) {
      ScriptElement e = Document.get().createScriptElement();
      e.setText(RESOURCES.dygraphs().getText());
      Document.get().getBody().appendChild(e);
      installed = true;
    }
  }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

        head = document.getElementsByTagName("head").getItem(0);

        // detect already loaded scripts and stylesheets
        NodeList<Element> scripts = document.getElementsByTagName("script");
        for (int i = 0; i < scripts.getLength(); i++) {
            ScriptElement element = ScriptElement.as(scripts.getItem(i));
            String src = element.getSrc();
            if (src != null && src.length() != 0) {
                loadedResources.add(src);
            }
        }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

            });
            return;
        }

        if (addListener(url, resourceLoadListener, loadListeners)) {
            ScriptElement scriptTag = Document.get().createScriptElement();
            scriptTag.setSrc(url);
            scriptTag.setType("text/javascript");

            scriptTag.setPropertyBoolean("async", async);

            addOnloadHandler(scriptTag, new ResourceLoadListener() {
                @Override
                public void onLoad(ResourceLoadEvent event) {
                    fireLoad(event);
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

            // If ie11+ for some reason gets a preload request
            if (BrowserInfo.get().getBrowserMajorVersion() >= 11) {
                throw new RuntimeException(
                        "Browser doesn't support preloading with text/cache");
            }
            ScriptElement element = Document.get().createScriptElement();
            element.setSrc(url);
            element.setType("text/cache");
            return element;
        } else {
            ObjectElement element = Document.get().createObjectElement();
            element.setData(url);
            if (BrowserInfo.get().isChrome()) {
                element.setType("text/cache");
            } else {
                element.setType("text/plain");
            }
            element.setHeight("0px");
            element.setWidth("0px");
            return element;
        }
    }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

  private static final String JSAPI_CALLBACK = "__injectedJSAPI";

  public static void load(Chronoscope.URLResolver resolver, final String libName,
      final String version, final Command callback) {
    if (!injectedLoader) {
      final ScriptElement se = Document.get().createScriptElement();
//      se.setSrc(intrinsics.getCachedUrl("http://www.google.com/jsapi?callback=" + JSAPI_CALLBACK));
      se.setSrc("http://www.google.com/jsapi?callback=" + JSAPI_CALLBACK);
     
      final HeadElement he = HeadElement.as(Document.get().getElementsByTagName("head").getItem(0));
      exportHandler(new Command() {

        public void execute() {
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

    Document doc = Document.get();
    String key = (apiKey == null) ? "" : ("key=" + apiKey + "&");
    hostname = (hostname == null) ? "www.google.com" : hostname;
    String src = getProtocol() + "//" + hostname + "/jsapi?" + key
        + "callback=__gwt_AjaxLoader_onLoad";
    ScriptElement script = doc.createScriptElement();
    script.setSrc(src);
    script.setType("text/javascript");
    doc.getBody().appendChild(script);
    return false;
  }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

  /**
   * Fires a request to a JSONP-supporting URL.
   */
  public void request(String url, final Callback<? super R> request) {
    final String id = JSONP_HANDLER_PREFIX + jsonpCounter++;
    final ScriptElement requestMaker = Document.get().createScriptElement();
    registerCallback(id, new Callback<JavaScriptObject>() {
      @Override
      public void onSuccess(JavaScriptObject cajoled) {
        requestMaker.removeFromParent();
        deregisterCallback(id);
        request.onSuccess(cajoled.<R>cast());
      }

      @Override
      public void onError(String message) {
        // Ignore
      }
    });

    requestMaker.setSrc(url + "&" + JSONP_CALLBACK_PARAM + "=" + id);
    Document.get().getBody().appendChild(requestMaker);
  }
View Full Code Here

Examples of com.google.gwt.dom.client.ScriptElement

  /**
   * Loads Gadget RPC library script.
   */
  private static void loadGadgetRpcScript() {
    ScriptElement script = Document.get().createScriptElement();
    script.setType("text/javascript");
    script.setSrc(GADGET_RPC_PATH);
    Document.get().getBody().appendChild(script);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.