當前位置: 首頁>>代碼示例>>Java>>正文


Java ScriptInjector類代碼示例

本文整理匯總了Java中com.google.gwt.core.client.ScriptInjector的典型用法代碼示例。如果您正苦於以下問題:Java ScriptInjector類的具體用法?Java ScriptInjector怎麽用?Java ScriptInjector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScriptInjector類屬於com.google.gwt.core.client包,在下文中一共展示了ScriptInjector類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: HelloWorldViewPresenter

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
@Inject
public HelloWorldViewPresenter(final HelloWorldView helloWorldView) {
  this.helloWorldView = helloWorldView;

  ScriptInjector.fromUrl(GWT.getModuleBaseURL() + Constants.JAVASCRIPT_FILE_ID)
      .setWindow(ScriptInjector.TOP_WINDOW)
      .setCallback(
          new Callback<Void, Exception>() {
            @Override
            public void onSuccess(final Void result) {
              Log.info(HelloWorldViewPresenter.class, Constants.JAVASCRIPT_FILE_ID + " loaded.");
              sayHello("Hello from Java Script!");
            }

            @Override
            public void onFailure(final Exception e) {
              Log.error(
                  HelloWorldViewPresenter.class,
                  "Unable to load " + Constants.JAVASCRIPT_FILE_ID,
                  e);
            }
          })
      .inject();
}
 
開發者ID:eclipse,項目名稱:che-archetypes,代碼行數:25,代碼來源:HelloWorldViewPresenter.java

示例2: onModuleLoad

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
public void onModuleLoad() {
	ScriptInjector.fromUrl(GWT.getModuleBaseURL()+"bower_components/webcomponents-lite.min.js").setWindow(ScriptInjector.TOP_WINDOW).setCallback(
               new Callback<Void, Exception>() {
                   @Override
                   public void onSuccess(Void result) {
					LOGGER.info("injection success");
					importPolymer();
				}

				@Override
				public void onFailure(Exception reason) {

				}
			}).inject();


	LOGGER.info("Initializing Layout client UI module ...");
	new ModuleConfigurator().configureModule(new LayoutUIModuleConfiguration());
}
 
開發者ID:GwtDomino,項目名稱:domino-todolist,代碼行數:20,代碼來源:LayoutUIClientModule.java

示例3: injectDocReadyAndC8OCoreScripts

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
private void injectDocReadyAndC8OCoreScripts(final String convertigoMachineUrl) {
    final String convertigoStudioJsUrl = convertigoMachineUrl + "/convertigo/studio/js/";

    // First, inject docready.js = $(document).ready() (but native JS function)
    final String docReadyJsUrl = convertigoStudioJsUrl + "libs/docready.js";
    ScriptInjector
        .fromUrl(docReadyJsUrl)
        .setWindow(ScriptInjector.TOP_WINDOW)
        .setCallback(new Callback<Void, Exception>() {
            @Override
            public void onSuccess(Void result) {
                // ... then convertigo.js and main.js
                injectC8OCoreScripts(convertigoStudioJsUrl);
            }

            @Override
            public void onFailure(Exception reason) {
                Window.alert(formatScriptInjectFailure(docReadyJsUrl, convertigoMachineUrl));
            }
        })
        .inject();
}
 
開發者ID:convertigo,項目名稱:convertigo-che-assembly,代碼行數:23,代碼來源:MainViewPresenter.java

示例4: init

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
public static void init()
{
	if(init)
		return;
	init = true;
	
	String javaScript = "ammo.js";
	
	final String js = GWT.getModuleBaseForStaticFiles() + javaScript;

	ScriptInjector.fromUrl(js).setCallback(new Callback<Void, Exception>()
	{
		@Override
		public void onFailure(Exception e)
		{
			GWT.log("inject " + js + " failure " + e);
		}

		@Override
		public void onSuccess(Void ok)
		{
			Bullet.initVariables();
		}
	}).setWindow(ScriptInjector.TOP_WINDOW).inject();
}
 
開發者ID:xpenatan,項目名稱:gdx-bullet-gwt,代碼行數:26,代碼來源:GwtBullet.java

示例5: injectJqueryScript

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
private void injectJqueryScript() {
    // Workaround: https://goo.gl/1OrFqj
    ScriptInjector.fromUrl(JQUERY_UI_URL).setCallback(new Callback<Void, Exception>() {
        @Override
        public void onFailure(Exception reason) {
            logger.info("Script load failed Info: " + reason);
        }

        @Override
        public void onSuccess(Void result) {
            logger.info("JQuery for Select loaded successful!");

            init();
        }

    }).setRemoveTag(true).setWindow(ScriptInjector.TOP_WINDOW).inject();
}
 
開發者ID:interseroh,項目名稱:demo-gwt-springboot,代碼行數:18,代碼來源:DemoGwtWebApp.java

示例6: addPremiumSupportHelpAction

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
private void addPremiumSupportHelpAction() {
  // userVoice init
  ScriptInjector.fromUrl(resources.userVoice().getSafeUri().asString())
      .setWindow(ScriptInjector.TOP_WINDOW)
      .setCallback(
          new Callback<Void, Exception>() {
            @Override
            public void onSuccess(Void aVoid) {
              // add action
              actionManager.registerAction(
                  localizationConstant.createSupportTicketAction(), createSupportTicketAction);

              helpGroup.addSeparator();
              helpGroup.add(createSupportTicketAction);
            }

            @Override
            public void onFailure(Exception e) {
              Log.error(getClass(), "Unable to inject UserVoice", e);
            }
          })
      .inject();
}
 
開發者ID:codenvy,項目名稱:codenvy,代碼行數:24,代碼來源:HelpExtension.java

示例7: onModuleLoad

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public void onModuleLoad() {
    if (!isjQueryLoaded()) {
        ScriptInjector.fromString(CytoscapeJsClientBundle.INSTANCE.jQuery().getText())
                .setWindow(ScriptInjector.TOP_WINDOW)
                .inject();
    }
    if (!isCytoscapeUtilsLoaded()) {
    	ScriptInjector.fromString(CytoscapeJsClientBundle.INSTANCE.sageCytoscapeUtils().getText())
         .setWindow(ScriptInjector.TOP_WINDOW)
         .inject();
    }

 

}
 
開發者ID:Sage-Bionetworks,項目名稱:GwtVisualizationWrappers,代碼行數:18,代碼來源:CytoscapeJsEntryPoint.java

示例8: onModuleLoad

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
@Override
public void onModuleLoad() {
	C3Resources resources = loadResources();

	boolean pretty = isPretty(resources);
	GWT.log("[C3Js] Loading " + (pretty ? "pretty" : "obfuscated") + " resources");

	TextResource c3Css = resources.c3Css();
	GWT.log("[C3Js] Injecting CSS " + c3Css.getName());
	StyleInjector.inject(c3Css.getText());

	TextResource c3JavaScript = resources.c3JavaScript();
	GWT.log("[C3Js] Injecting JavaScript " + c3JavaScript.getName());
	ScriptInjector.fromString(c3JavaScript.getText()).setRemoveTag(pretty).setWindow(getWindow()).inject();

	GWT.log("[C3Js] C3 v" + getC3Version() + " (using D3 v" + getD3Version() + ") loaded!");
}
 
開發者ID:psobiech,項目名稱:gwtc3,代碼行數:18,代碼來源:C3Js.java

示例9: inject

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
@Override
public void inject (final OnCompletion oc) {
	final String js = GWT.getModuleBaseForStaticFiles() + "freetype.js";
	ScriptInjector.fromUrl(js).setCallback(new Callback<Void, Exception>() {

		@Override
		public void onFailure (Exception reason) {
			error = true;
			GWT.log("Exception injecting " + js, reason);
			oc.run();
		}

		@Override
		public void onSuccess (Void result) {
			success = true;
			GWT.log("Success injecting js.");
			oc.run();
		}

	}).setWindow(ScriptInjector.TOP_WINDOW).inject();
}
 
開發者ID:intrigus,項目名稱:gdx-freetype-gwt,代碼行數:22,代碼來源:FreetypeInjector.java

示例10: injectScriptOneAfterAnother

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
private static void injectScriptOneAfterAnother(final List<String> pathAsList) {
    ScriptInjector.fromUrl(pathAsList.remove(0))
                  .setWindow(ScriptInjector.TOP_WINDOW)
                  .setCallback(new Callback<Void, Exception>() {
                      @Override
                      public void onFailure(Exception reason) {
                      }

                      @Override
                      public void onSuccess(Void result) {
                          if (!pathAsList.isEmpty()) {
                              injectScriptOneAfterAnother(pathAsList);
                          }
                      }
                  })
                  .inject();
}
 
開發者ID:ow2-proactive,項目名稱:scheduling-portal,代碼行數:18,代碼來源:JSUtil.java

示例11: ActivityTrackingExtension

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
@Inject
public ActivityTrackingExtension(AppContext appContext) {

  ScriptInjector.fromUrl("/_app/activity.js")
      .setWindow(TOP_WINDOW)
      .setCallback(
          new Callback<Void, Exception>() {
            @Override
            public void onSuccess(Void result) {
              init(appContext.getMasterApiEndpoint(), appContext.getWorkspaceId());
            }

            @Override
            public void onFailure(Exception reason) {}

            private native void init(String restContext, String wsId) /*-{
                            $wnd.ActivityTracker.init(restContext, wsId);
                        }-*/;
          })
      .inject();
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:22,代碼來源:ActivityTrackingExtension.java

示例12: injectScript

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
public static void injectScript(SafeUri js, AsyncCallback<Void> callback) {
  final ScriptElement[] script = new ScriptElement[1];
  script[0] =
      ScriptInjector.fromUrl(js.asString())
          .setWindow(ScriptInjector.TOP_WINDOW)
          .setCallback(
              new Callback<Void, Exception>() {
                @Override
                public void onSuccess(Void result) {
                  script[0].removeFromParent();
                  callback.onSuccess(result);
                }

                @Override
                public void onFailure(Exception reason) {
                  callback.onFailure(reason);
                }
              })
          .inject()
          .cast();
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:22,代碼來源:Loader.java

示例13: load

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
/**
 * Load the specified script.
 *
 * @param script Path to script.
 * @param callback {@code Callback} called when ready.
 */
public static void load(
        String script, Callback<Void, Exception> callback) {

    if (loadedScripts.contains(script)) {
        callback.onSuccess(null);
        return;
    }

    ScriptInjector.fromUrl(script)
        .setWindow(ScriptInjector.TOP_WINDOW)
        .setCallback(callback)
        .inject();

    loadedScripts.add(script);
}
 
開發者ID:snogaraleal,項目名稱:wbi,代碼行數:22,代碼來源:Script.java

示例14: startPlugins

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
void startPlugins(@Observes UberfireJSAPIReadyEvent event) {

        runtimePlugins.call(new RemoteCallback<List<RuntimePlugin>>() {
            @Override
            public void callback(List<RuntimePlugin> plugins) {
                try {
                    for (final RuntimePlugin p : plugins) {
                        if (isJSPlugin(p)) {
                            ScriptInjector.fromString(p.getPluginContent()).setWindow(ScriptInjector.TOP_WINDOW).inject();
                        } else if (isPerspectivePlugin(p)) {
                            perspectiveEditorGenerator.generatePerspective(p.getPluginContent());
                        }
                    }
                } finally {
                    workbench.removeStartupBlocker(RuntimePluginStartup.class);
                }
            }
        }).getRuntimePlugins();
    }
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:20,代碼來源:RuntimePluginStartup.java

示例15: inject

import com.google.gwt.core.client.ScriptInjector; //導入依賴的package包/類
/**
 * Loads a javascript file base on the file url
 */
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();

	}
}
 
開發者ID:ahome-it,項目名稱:ahome-core,代碼行數:28,代碼來源:ResourceInjector.java


注:本文中的com.google.gwt.core.client.ScriptInjector類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。