@Override
 public void onModuleLoad() {
   if (!isGrowlPresent()) {
     ScriptInjector.fromString(GrowlClientBundle.INSTANCE.growlJS().getText())
         .setWindow(ScriptInjector.TOP_WINDOW)
         .inject();
   }
 }
  /** {@inheritDoc} */
  @Override
  public void setLanguage(final DatePickerLanguage language) {
    this.language = language;

    // Inject the JS for the language
    if (language.getJs() != null) {
      ScriptInjector.fromString(language.getJs().getText())
          .setWindow(ScriptInjector.TOP_WINDOW)
          .inject();
    }
  }
示例#3
0
 public void ensureWebComponentApi(ScheduledCommand onLoaded) {
   // Check if document.register exists
   if (JsSupport.doc().registerElement() == null) {
     // Nope... Lets inject our polyfill
     ScriptInjector.fromUrl(getPolyfillUrl())
         .setCallback(voidCallback(onLoaded))
         .setRemoveTag(true)
         .inject();
   } else {
     Scheduler.get().scheduleDeferred(onLoaded);
   }
 }
示例#4
0
  /** Main class */
  public void onModuleLoad() {

    ScriptInjector.fromUrl("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js")
        .setCallback(
            new Callback<Void, Exception>() {
              public void onFailure(Exception reason) {
                Window.alert("Script load failed.");
              }

              public void onSuccess(Void result) {
                loadModule();
              }
            })
        .setWindow(ScriptInjector.TOP_WINDOW)
        .inject();
  }
示例#5
0
  public static void loadRaphaelFrom(final Listener l, String url) {
    if (raphaelLoaded) {
      l.loaded(null);
    } else {
      ScriptInjector.fromUrl(url)
          .setWindow(ScriptInjector.TOP_WINDOW)
          .setCallback(
              new com.google.gwt.core.client.Callback<Void, Exception>() {
                @Override
                public void onSuccess(Void result) {
                  l.loaded(null);
                }

                @Override
                public void onFailure(Exception reason) {
                  l.loaded(reason);
                }
              })
          .inject();
    }
  }
 @Override
 public void onModuleLoad() {
   ScriptInjector.fromString(SelectClientBundle.INSTANCE.selectJs().getText())
       .setWindow(ScriptInjector.TOP_WINDOW)
       .inject();
 }
 @Override
 public void onModuleLoad() {
   ScriptInjector.fromString(Resources.INSTANCE.introJs().getText())
       .setWindow(ScriptInjector.TOP_WINDOW)
       .inject();
 }