List of usage examples for com.google.gwt.core.client ScriptInjector TOP_WINDOW
JavaScriptObject TOP_WINDOW
To view the source code for com.google.gwt.core.client ScriptInjector TOP_WINDOW.
Click Source Link
From source file:org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper.java
License:Apache License
public static void ensurePatternFlyIsAvailable() { ensurejQueryIsAvailable();//from www .jav a 2 s .com ensureBootstrapSelectIsAvailable(); if (!isPatternFlyLoaded()) { ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.patternFly().getText()) .setWindow(ScriptInjector.TOP_WINDOW).inject(); } }
From source file:org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper.java
License:Apache License
public static void ensureMomentIsAvailable() { if (!isMomentLoaded()) { ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.moment().getText()) .setWindow(ScriptInjector.TOP_WINDOW).inject(); }/*w ww.j ava 2 s . c o m*/ setMomentLocale(); }
From source file:org.uberfire.ext.editor.commons.client.file.exports.jso.FileExportScriptInjector.java
License:Apache License
private static void inject(final String raw) { final ScriptInjector.FromString jsPdfScript = ScriptInjector.fromString(raw); jsPdfScript.setWindow(ScriptInjector.TOP_WINDOW).setRemoveTag(false).inject(); }
From source file:org.uberfire.ext.editor.commons.client.template.mustache.ClientMustacheTemplateRenderer.java
License:Apache License
private void inject(final String raw) { final ScriptInjector.FromString js = scriptInjector.apply(raw); js.setWindow(ScriptInjector.TOP_WINDOW).setRemoveTag(false).inject(); }
From source file:org.uberfire.jsbridge.client.AppFormerJsBridge.java
License:Apache License
public Promise<Void> loadAppFormerJsAndReactScripts(final String gwtModuleName) { return promises.create((res, rej) -> { final Consumer<Exception> onError = ex -> { workbench.removeStartupBlocker(AppFormerJsBridge.class); rej.onInvoke(null);/* w w w . j a va 2 s .com*/ }; final CallbackProducer<Void> callback = new CallbackProducer<>(onError); ScriptInjector.fromUrl(gwtModuleName + "/react.production.min.js").setWindow(ScriptInjector.TOP_WINDOW) .setCallback(callback.withSuccess((v) -> ScriptInjector .fromUrl(gwtModuleName + "/react-dom.production.min.js") .setWindow(ScriptInjector.TOP_WINDOW) .setCallback(callback.withSuccess((v1) -> ScriptInjector .fromUrl(gwtModuleName + "/appformer.js").setWindow(ScriptInjector.TOP_WINDOW) .setCallback(callback.withSuccess((v2) -> ScriptInjector .fromUrl(gwtModuleName + "/AppFormerComponentsRegistry.js") .setWindow(ScriptInjector.TOP_WINDOW) .setCallback(callback.withSuccess((v3) -> { res.onInvoke((IThenable<Void>) null); })).inject())) .inject())) .inject())) .inject(); }); }
From source file:org.unitime.timetable.gwt.client.rooms.GoogleMap.java
License:Apache License
@Override public void setup() { ScriptInjector/* w w w . j a va 2s . co m*/ .fromUrl("https://maps.googleapis.com/maps/api/js?" + (iApiKey != null && !iApiKey.isEmpty() ? "key=" + iApiKey + "&" : "") + "sensor=false&callback=setupGoogleMap") .setWindow(ScriptInjector.TOP_WINDOW).setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception e) { UniTimeNotifications.error(e.getMessage(), e); setVisible(false); iMapControl = null; } }).inject(); }
From source file:org.unitime.timetable.gwt.client.rooms.LeafletMap.java
License:Apache License
public void setup() { loadCss(GWT.getHostPageBaseURL() + "leaflet/leaflet.css"); ScriptInjector.fromUrl(GWT.getHostPageBaseURL() + "leaflet/leaflet.js").setWindow(ScriptInjector.TOP_WINDOW) .setCallback(new Callback<Void, Exception>() { @Override// w w w.j a va 2 s. c o m public void onSuccess(Void result) { setupLeafletMap(iTileUrl, iTileAttribution); setLeafletMarker(); leafletReverseGeocode(); } @Override public void onFailure(Exception e) { UniTimeNotifications.error(e.getMessage(), e); setVisible(false); iMapControl = null; } }).inject(); }
From source file:org.unitime.timetable.gwt.client.rooms.RoomEdit.java
License:Apache License
public void show() { UniTimePageLabel.getInstance()/* ww w . java2 s . c om*/ .setPageName(iRoom.getUniqueId() == null ? MESSAGES.pageAddRoom() : MESSAGES.pageEditRoom()); setVisible(true); iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); onShow(); Window.scrollTo(0, 0); if (iGoogleMap != null && !iGoogleMapInitialized) { iGoogleMapInitialized = true; ScriptInjector.fromUrl("https://maps.google.com/maps/api/js?sensor=false&callback=setupGoogleMap") .setWindow(ScriptInjector.TOP_WINDOW).setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception e) { UniTimeNotifications.error(e.getMessage(), e); iGoogleMap = null; iGoogleMapControl = null; } }).inject(); } else if (iGoogleMap != null) { setMarker(); } }
From source file:org.waveprotocol.box.webclient.client.atmosphere.AtmosphereConnectionImpl.java
License:Apache License
@Override public void connect() { if (socket == null) { ScriptInjector.fromUrl("/atmosphere/atmosphere.js").setCallback(new Callback<Void, Exception>() { public void onFailure(Exception reason) { throw new IllegalStateException("atmosphere.js load failed!"); }//from w w w . j a va2 s . c om public void onSuccess(Void result) { socket = AtmosphereSocket.create(AtmosphereConnectionImpl.this, urlBase); socket.connect(); } }).setWindow(ScriptInjector.TOP_WINDOW).inject(); } else { if (AtmosphereConnectionState.CLOSED.equals(this.state)) socket.connect(); } }
From source file:org.waveprotocol.box.webclient.client.atmosphere.WaveSocketAtmosphere.java
License:Apache License
@Override public void connect() { if (socket == null) { // Build the atmosphere.js URL using the Websocket URL final String scriptHost = urlBase.startsWith("wss://") ? "https://" + urlBase.substring(6) : "http://" + urlBase.substring(5); String scriptUrl = new String(scriptHost); // Remove trailing '/' before add context if (scriptUrl.lastIndexOf("/") == scriptUrl.length() - 1) scriptUrl = scriptUrl.substring(0, scriptUrl.length() - 1); scriptUrl += "/atmosphere/atmosphere.js"; ScriptInjector.fromUrl(scriptUrl).setCallback(new Callback<Void, Exception>() { public void onFailure(Exception reason) { throw new IllegalStateException("atmosphere.js load failed!"); }/* w w w . j a v a 2 s.com*/ public void onSuccess(Void result) { // We assume Atmosphere is going to work only with http(s) schemas socket = AtmosphereSocket.create(WaveSocketAtmosphere.this, scriptHost, useWebSocket ? "websocket" : "long-polling", "long-polling", "1.0", sessionId); // Check version value in Model.MODEL_VERSION socket.connect(); } }).setWindow(ScriptInjector.TOP_WINDOW).inject(); } else { socket.connect(); } }