List of usage examples for com.google.gwt.user.client Window open
public static void open(String url, String name, String features)
From source file:es.deusto.weblab.client.experiments.controlapp.ui.ControlAppExperiment.java
License:Open Source License
@Override public void start(final int time, String initialConfiguration) { final JSONObject value = JSONParser.parseStrict(initialConfiguration).isObject(); final String baseURL = value.get("url").isString().stringValue(); System.out.println("Control app URL=" + baseURL); final String width = this.configurationRetriever.getProperty(EXTERNAL_WIDTH, "" + Window.getClientWidth()); final String height = this.configurationRetriever.getProperty(EXTERNAL_HEIGHT, "" + Window.getClientHeight()); final long startTime = System.currentTimeMillis(); switch (getLinkPresentation()) { case iframe:/* w w w . j a v a 2s. co m*/ final String iframeUrl = baseURL.replace("TIME_REMAINING", "" + time); final HTML html = new HTML("<iframe src='" + iframeUrl + "' width='" + width + "' height='" + height + "px' frameborder='0'/>"); putWidget(html); break; case popup: final VerticalPanel vp = new VerticalPanel(); final Button popupButton = new Button(i18n.remoteSystem()); popupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final long now = System.currentTimeMillis(); final long elapsed = now - startTime; final long nowTime = 1000 * time - elapsed; final String popupUrl = baseURL.replace("TIME_REMAINING", "" + (nowTime / 1000)); Window.open(popupUrl, "_blank", "resizable=yes,scrollbars=yes,dependent=yes,width=" + width + ",height=" + height + ",top=0"); } }); vp.add(popupButton); putWidget(vp); break; case redirection: String redirectionUrl = baseURL.replace("TIME_REMAINING", "" + time); this.boardController.disableFinishOnClose(); final Anchor anch = new Anchor(i18n.remoteSystem(), redirectionUrl); putWidget(anch); Location.replace(redirectionUrl); break; } }
From source file:es.deusto.weblab.client.experiments.redirect.RedirectExperiment.java
License:Open Source License
@Override public void start(final int time, String initialConfiguration) { final JSONObject value = JSONParser.parseStrict(initialConfiguration).isObject(); final String baseURL = value.get("url").isString().stringValue(); System.out.println("Control app URL=" + baseURL); final String width = this.configurationRetriever.getProperty(RedirectCreatorFactory.EXTERNAL_WIDTH); final String height = this.configurationRetriever.getProperty(RedirectCreatorFactory.EXTERNAL_HEIGHT); final long startTime = System.currentTimeMillis(); switch (getLinkPresentation()) { case iframe:/* www . ja v a 2 s .c o m*/ final String iframeUrl = baseURL.replace("TIME_REMAINING", "" + time); final HTML html = new HTML("<iframe src='" + iframeUrl + "' width='" + width + "' height='" + height + "px' frameborder='0'/>"); putWidget(html); break; case popup: final VerticalPanel vp = new VerticalPanel(); final Button popupButton = new Button(i18n.remoteSystem()); popupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final long now = System.currentTimeMillis(); final long elapsed = now - startTime; final long nowTime = 1000 * time - elapsed; final String popupUrl = baseURL.replace("TIME_REMAINING", "" + (nowTime / 1000)); Window.open(popupUrl, "_blank", "resizable=yes,scrollbars=yes,dependent=yes,width=" + width + ",height=" + height + ",top=0"); } }); vp.add(popupButton); putWidget(vp); break; case redirection: String redirectionUrl = baseURL.replace("TIME_REMAINING", "" + time); this.boardController.disableFinishOnClose(); final Anchor anch = new Anchor(i18n.remoteSystem(), redirectionUrl); putWidget(anch); Location.replace(redirectionUrl); break; } }
From source file:es.upm.fi.dia.oeg.map4rdf.client.maplet.stats.StatisticsPresenter.java
License:Open Source License
private void drawStatistics() { GetGeoResourceOverlays action = new GetGeoResourceOverlays(configID.getConfigID(), mapLayer.getMapView().getVisibleBox()); action.setStatisticDefinition(currentStatistic); getDisplay().startProcessing();/*from w w w . j av a 2 s . c om*/ dispatchAsync.execute(action, new AsyncCallback<ListResult<GeoResourceOverlay>>() { @Override public void onFailure(Throwable caught) { getDisplay().stopProcessing(); } public void onSuccess(ListResult<GeoResourceOverlay> result) { double max = 0; for (GeoResourceOverlay overlay : result) { double value = overlay.getValue(); if (value > max) { max = value; } } for (GeoResourceOverlay overlay : result) { Point point = (Point) overlay.getEntity().getFirstGeometry(); double radius = (100000 * overlay.getValue()) / max; final CircleBean circle = new CircleBean(point, radius); final String uri = overlay.getUri(); mapLayer.drawCircle(MapShapeStyleFactory.createStyle(circle), Double.toString(overlay.getValue())).addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.open(uri, "_blank", null); } }); } getDisplay().stopProcessing(); }; }); }
From source file:es.upm.fi.dia.oeg.map4rdf.client.presenter.MapPresenter.java
License:Open Source License
@Override protected void onBind() { getDisplay().getKmlButton().addClickHandler(new ClickHandler() { @Override//from w w w . j a v a 2s . c o m public void onClick(ClickEvent event) { GetGeoResourcesAsFormattedFileUrl action = new GetGeoResourcesAsFormattedFileUrl( configID.getConfigID(), getVisibleBox(), GetGeoResourcesAsFormattedFileUrl.ServiceType.KML); action.setFacetConstraints(facetConstraints); dispatchAsync.execute(action, new AsyncCallback<SingletonResult<String>>() { @Override public void onFailure(Throwable caught) { widgetFactory.getDialogBox().showError(caught.getMessage()); } @Override public void onSuccess(SingletonResult<String> result) { Window.open(GWT.getModuleBaseURL() + result.getValue(), "resources.kml", null); } }); } }); getDisplay().getGeoJSONButton().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GetGeoResourcesAsFormattedFileUrl action = new GetGeoResourcesAsFormattedFileUrl( configID.getConfigID(), getVisibleBox(), GetGeoResourcesAsFormattedFileUrl.ServiceType.GEOJSON); action.setFacetConstraints(facetConstraints); dispatchAsync.execute(action, new AsyncCallback<SingletonResult<String>>() { @Override public void onFailure(Throwable caught) { widgetFactory.getDialogBox().showError(caught.getMessage()); } @Override public void onSuccess(SingletonResult<String> result) { Window.open(GWT.getModuleBaseURL() + result.getValue(), "resources.json", null); } }); } }); getDisplay().getFilterVector().addVectorFeatureAddedListener(new VectorFeatureAddedListener() { @Override public void onFeatureAdded(FeatureAddedEvent eventObject) { eventBus.fireEvent(new AreaFilterChangedEvent()); } }); }
From source file:eu.riscoss.client.RiscossWebApp.java
License:Apache License
void showUI(JSiteMap sitemap) { Log.println("Loading UI for domain " + sitemap.domain); VerticalPanel vPanel = new VerticalPanel(); MenuBar menu = new MenuBar(); menu.setWidth(" 100% "); menu.setAnimationEnabled(true);/*from www.j ava 2s . c om*/ menu.setStyleName("mainMenu"); MenuBar account = new MenuBar(true); account.setStyleName("subMenu"); account.setAnimationEnabled(true); menu.addItem(username + " (" + sitemap.domain + ")", account); account.addItem("Change domain", new Command() { @Override public void execute() { showDomainSelectionDialog(); } }); account.addItem("Logout", new Command() { @Override public void execute() { Cookies.removeCookie(CookieNames.TOKEN_KEY); Cookies.removeCookie(CookieNames.DOMAIN_KEY); Window.Location.reload(); } }); for (JSiteSection subsection : sitemap.getRoot().subsections()) { if (subsection.pages().size() < 1) continue; if (subsection.getLabel().equals("untracked")) continue; MenuBar submenu = new MenuBar(true); submenu.setStyleName("subMenu"); submenu.setAnimationEnabled(true); menu.addItem(subsection.getLabel(), submenu); for (JSitePage page : subsection.pages()) { access.add(page.getLabel()); submenu.addItem(page.getLabel(), new MenuCommand(page.getUrl()) { @Override public void execute() { loadPanel(getUrl()); } }); } if (subsection.getLabel().equals("Configure")) { final Button b = new Button("ye"); final SingleUploader upload = new SingleUploader(FileInputType.CUSTOM.with(b)); upload.setTitle("Upload new entities document"); upload.setAutoSubmit(true); upload.setServletPath(upload.getServletPath() + "?t=importentities&domain=" + RiscossJsonClient.getDomain() + "&token=" + RiscossCall.getToken()); upload.addOnFinishUploadHandler(new OnFinishUploaderHandler() { @Override public void onFinish(IUploader uploader) { Log.println("OnFinish"); UploadedInfo info = uploader.getServerInfo(); String name = info.name; String response = uploader.getServerMessage().getMessage(); if (confFileLoaded) { RiscossJsonClient.importEntities(new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { Window.alert("Entity information imported correctly"); loadPanel("entities.jsp"); } }); } else { Window.alert("Missing config xml file. Please, contact an administrator"); } } }); submenu.addSeparator(); submenu.addItem("Import entities", new MenuCommand("Import entities") { @Override public void execute() { upload.fireEvent(new ClickEvent() { }); b.fireEvent(new ClickEvent() { }); } }); vPanel.add(upload); upload.setVisible(false); } } MenuBar helpUs = new MenuBar(true); helpUs.setStyleName("subMenu"); helpUs.setAnimationEnabled(true); menu.addItem("Help us", helpUs); helpUs.addItem("User feedback", new Command() { @Override public void execute() { Window.open("http://www.essi.upc.edu/~e-survey/index.php?sid=356784&lang=en", "_self", ""); } }); helpUs.addItem("Expert feedback", new Command() { @Override public void execute() { Window.open("http://www.essi.upc.edu/~e-survey/index.php?sid=91563&lang=en", "_self", ""); } }); HorizontalPanel hPanel = new HorizontalPanel(); VerticalPanel north = new VerticalPanel(); // Image logo = new Image( "http://riscossplatform.ow2.org/riscoss/wiki/wiki1/download/ColorThemes/RISCOSS_2/logo_riscoss_DSP.png" ); Image logo = new Image("resources/logo_riscoss_DSP.png"); logo.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { loadPanel("dashboard.jsp"); } }); logo.setStyleName("logo"); north.add(logo); north.setHeight("5%"); // any value here seems to resolve the firefox problem of showing only a small frame on the right side Label version = new Label("v1.6.0"); version.setStyleName("version"); north.add(version); //north.setWidth("100%"); hPanel.add(north); //Comment this line if you don't need shortcuts generateShortcuts(); hPanel.add(shortcuts); hPanel.setWidth("100%"); vPanel.add(hPanel); vPanel.add(menu); vPanel.setWidth("100%"); RootPanel.get().add(vPanel); RootPanel.get().setStyleName("root"); loadPanel("dashboard.jsp"); }
From source file:eu.riscoss.client.riskanalysis.RASPanel.java
License:Apache License
private void generateReport() { RiscossJsonClient.generatePDFReport(selectedRAS, new JsonCallback() { @Override// w w w.java2s. c o m public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { Window.open(GWT.getHostPageBaseURL() + "models/download?domain=" + RiscossJsonClient.getDomain() + "&name=report.pdf&type=pdf&token=" + RiscossCall.getToken(), "", ""); } }); //Window.open(GWT.getHostPageBaseURL() + "rasreport.jsp?id=" + selectedRAS, "_blank", ""); /*RiscossJsonClient.generateHTMLReport(selectedRAS, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { } @Override public void onSuccess(Method method, JSONValue response) { String html = response.isObject().get("hml").isString().stringValue(); HTMLPanel htmlPanel = new HTMLPanel(html); PopupPanel popupPanel = new PopupPanel(); popupPanel.setWidget(htmlPanel); popupPanel.show(); } });*/ }
From source file:forplay.html.HtmlPlatform.java
License:Apache License
/** * @see forplay.core.Platform#openURL(java.lang.String) *//*from w w w. j a v a 2s . co m*/ @Override public void openURL(String url) { Window.open(url, "_blank", ""); }
From source file:fr.aliasource.webmail.client.LoadSettingsCallback.java
License:GNU General Public License
private void doLangRedirect(HashMap<String, String> m) { if (langRedirectDone) { return;/* ww w .java 2 s . com*/ } String lang = m.get(GetSettings.LANGUAGE); if (lang == null || !supportedLocales.contains(lang)) { lang = "en"; } String locale = LocaleInfo.getCurrentLocale().getLocaleName(); if (locale.equals("default") || !supportedLocales.contains(locale)) { locale = "en"; } if (!locale.equals(lang)) { GWT.log("will try to open: " + getHostPageLocation() + "?locale=" + lang, null); Window.open(getHostPageLocation() + "?locale=" + lang, "_self", ""); } langRedirectDone = true; }
From source file:fr.fg.client.core.ToolBar.java
License:Open Source License
public void onClick(Widget sender) { if (sender == ladderBt) { onLadderBtClick();// w w w. ja v a 2s .co m } else if (sender == messagesBt) { onMessageBtClick(); } else if (sender == menuBt) { onMenuBtClick(); } else if (sender == helpBt) { //Window.open("http://wiki.fallengalaxy.com/index.php/Accueil", "", ""); onHelpBtClick(); } else if (sender == mapBt) { onMapBtClick(); } else if (sender == researchBt) { onResearchBtClick(); } else if (sender == optionsBt) { onOptionsBtClick(); } else if (sender == premiumBt) { onPremiumBtClick(); } else if (sender == contactsBt) { onContactsBtClick(); } else if (sender == achievementsBt) { onAchievementsBtClick(); } else if (sender == advancementsBt) { onAdvancementsBtClick(); } else if (sender == eventsBt) { onEventsBtClick(); } else if (sender == disconnectBt) { onDisconnectBtClick(); } else if (sender == allyBt) { onAllyBtClick(); } else if (sender == diplomacyBt) { onDiplomacyClick(); } else if (sender == contractsBt) { onContractsBtClick(); } else if (sender == tacticsBt) { onTacticsBtClick(); } else if (sender == forumBt) { Window.open("http://forum.fallengalaxy.com/", "", ""); } else if (sender == bugReportBt) { onBugReportBtClick(); } }
From source file:fr.insalyon.creatis.vip.application.client.view.monitor.menu.LogsContextMenu.java
License:Open Source License
public LogsContextMenu(LogsTab section, final String simulationID, final String dataName, final String folder, boolean isFile) { this.section = section; this.baseDir = "/" + simulationID + "/" + folder; this.setShowShadow(true); this.setShadowDepth(10); this.setWidth(90); MenuItem viewItem = new MenuItem("View File"); viewItem.setIcon(ApplicationConstants.ICON_PREVIEW); viewItem.addClickHandler(new ClickHandler() { @Override/*from w w w . j a va 2 s.c om*/ public void onClick(MenuItemClickEvent event) { new ViewerWindow("Viewing File: " + dataName, simulationID, folder, dataName, "").show(); } }); MenuItem downloadItem = new MenuItem("Download"); downloadItem.setIcon(DataManagerConstants.ICON_DOWNLOAD); downloadItem.addClickHandler(new ClickHandler() { @Override public void onClick(MenuItemClickEvent event) { Window.open(GWT.getModuleBaseURL() + "/getfileservice?filepath=" + baseDir + "/" + dataName + "&" + CoreConstants.COOKIES_SESSION + "=" + Cookies.getCookie(CoreConstants.COOKIES_SESSION), "", ""); } }); MenuItem deleteItem = new MenuItem("Delete"); deleteItem.setIcon(CoreConstants.ICON_DELETE); deleteItem.addClickHandler(new ClickHandler() { @Override public void onClick(MenuItemClickEvent event) { SC.confirm("Do you really want to delete '" + baseDir + "/" + dataName + "'?", new BooleanCallback() { @Override public void execute(Boolean value) { if (value != null && value) { delete(baseDir + "/" + dataName); } } }); } }); if (isFile) { this.setItems(viewItem, downloadItem, deleteItem); } else { this.setItems(downloadItem, deleteItem); } }