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:org.kaaproject.kaa.server.admin.client.servlet.ServletHelper.java
License:Apache License
public static void downloadEndpointProfile(String endpointKey, ProfileType type) { String getUrl = composeURL(KAA_PROFILE_DOWNLOAD_SERVLET_PATH, ENDPOINT_KEY_PARAMETER + "=" + URL.encodeQueryString(endpointKey), PROFILE_TYPE_PARAMETER + "=" + URL.encodeQueryString(type.name())); String url = GWT.getModuleBaseURL() + getUrl; Window.open(url, "_self", "enabled"); }
From source file:org.kaaproject.kaa.server.admin.client.servlet.ServletHelper.java
License:Apache License
public static void downloadJsonFile(String json, String filename) { Window.open("data:application/octet-stream;headers=Content-Disposition: attachment; filename=\"" + filename + "\"," + json, "_self", "enabled"); }
From source file:org.kaaproject.kaa.server.admin.client.util.Utils.java
License:Apache License
private static void onUnauthorized() { if (unauthorizedSessionDialog == null || !unauthorizedSessionDialog.isShowing()) { unauthorizedSessionDialog = new UnauthorizedSessionDialog(new UnauthorizedSessionDialog.Listener() { @Override/*w ww .jav a 2 s.c o m*/ public void onLogin() { Window.open(Window.Location.getPath(), "_blank", ""); } @Override public void onIgnore() { // do nothing } }); unauthorizedSessionDialog.center(); unauthorizedSessionDialog.show(); } }
From source file:org.kie.dockerui.client.widgets.container.explorer.KieContainersExplorer.java
License:Apache License
private void downloadArtifact(final KieContainer container) { // Obtain current settings from client cache. final Settings settings = SettingsClientHolder.getInstance().getSettings(); final String downloadURL = ClientUtils.getDownloadURL(settings, container); GWT.log("Downloading artifact using URL = '" + downloadURL + "'"); Window.open(downloadURL, "_blank", ""); }
From source file:org.kie.dockerui.client.widgets.container.explorer.KieContainersExplorer.java
License:Apache License
private void navigate(final KieContainer container) { // Obtain current settings from client cache. final Settings settings = SettingsClientHolder.getInstance().getSettings(); // Obtain the URL by inspecting the container. dockerService.inspect(container.getId(), new AsyncCallback<org.kie.dockerui.shared.model.KieContainerDetails>() { @Override/*w w w . j a v a 2 s .co m*/ public void onFailure(Throwable throwable) { showError(throwable); } @Override public void onSuccess( final org.kie.dockerui.shared.model.KieContainerDetails kieContainerDetails) { String addr = null; try { addr = ClientUtils.getWebAddress(container, kieContainerDetails, settings); Window.open(addr, "_blank", ""); } catch (IllegalStateException e) { showError(Constants.INSTANCE.noPublicPortsAvailable()); } } }); }
From source file:org.kie.dockerui.client.widgets.container.KieContainerDetails.java
License:Apache License
private void load(final KieContainer container, final org.kie.dockerui.shared.model.KieContainerDetails details, final Settings settings) { containerId.setValue(container.getId()); containerName.setValue(container.getName()); containerImage.setValue(container.getImage()); containerStatus.setValue(container.getStatus()); containerIP.setValue(details.getIpAddress()); final KieImageType type = container.getType(); // artifactVersionsGroup.clear(); if (type != null && KieImageCategory.KIEAPP.equals(type.getCategory())) { final String sshCommand = ClientUtils.getSSHCommand(container, details, settings); final String webAddress = ClientUtils.getWebAddress(container, details, settings); final String siteAddress = ClientUtils.getSiteAddress(container, details, settings); if (settings.isRegistryEnabled()) { final String pullAddress = ClientUtils.getPullAddress(container, details, settings); containerPullAddress.setText(pullAddress); pullAddressGroup.setVisible(true); } else {// w ww.java 2s.co m containerPullAddress.setText(""); pullAddressGroup.setVisible(false); } containerSSHCommand.setText(sshCommand); containerWebAddress.setText(webAddress); containerWebAddress.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { Window.open(webAddress, "_blank", ""); } }); sshCommandGroup.setVisible(true); webAddressGroup.setVisible(true); /* // Maven Site disabled - Petr final VerticalPanel p = new VerticalPanel(); p.addStyleName(style.artifactVersions()); final Frame f = new Frame(siteAddress); f.addStyleName(style.artifactVersions()); final Button b = new Button(Constants.INSTANCE.navigate()); b.setType(ButtonType.INFO); b.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { try { Window.open(siteAddress,"_blank",""); } catch (IllegalStateException e) { showError(Constants.INSTANCE.noPublicPortsAvailable()); } } }); p.add(f); p.add(b); artifactVersionsGroup.add(p); artifactVersionsGroup.setVisible(true); */ // Specify the password for the dbms container via environment variables. jdbcGroup.setVisible(false); if (SharedUtils.supportsDatabase(container)) { final Map<String, String> dbContainerEnvs = ClientUtils.toMap(details.getEnvVars(), "="); if (dbContainerEnvs != null) { final String _jdbcUrl = ClientUtils.getValue(dbContainerEnvs, DatabaseUtils.KIE_CONNECTION_URL); if (_jdbcUrl != null && _jdbcUrl.trim().length() > 0) { jdbcUrl.setText(_jdbcUrl); jdbcUser.setText(ClientUtils.getValue(dbContainerEnvs, DatabaseUtils.KIE_CONNECTION_USER)); jdbcPassword.setText( ClientUtils.getValue(dbContainerEnvs, DatabaseUtils.KIE_CONNECTION_PASSWORD)); jdbcGroup.setVisible(true); } } } } else { containerPullAddress.setText(""); containerSSHCommand.setText(""); containerWebAddress.setText(""); pullAddressGroup.setVisible(false); sshCommandGroup.setVisible(false); webAddressGroup.setVisible(false); // artifactVersionsGroup.setVisible(false); jdbcGroup.setVisible(false); } configurePortsGrid(container, details, settings); configureEnvVarsGrid(container, details, settings); }
From source file:org.kie.dockerui.client.widgets.KieContainerDetails.java
License:Apache License
private void load(final KieContainer container, final org.kie.dockerui.shared.model.KieContainerDetails details, final Settings settings) { containerId.setValue(container.getId()); containerName.setValue(container.getName()); containerImage.setValue(container.getImage()); containerStatus.setValue(container.getStatus()); containerIP.setValue(details.getIpAddress()); final KieImageType type = container.getType(); artifactVersionsGroup.clear();/*w w w . ja v a2s. c o m*/ if (type != null && KieImageCategory.KIEAPP.equals(type.getCategory())) { final String sshCommand = ClientUtils.getSSHCommand(container, details, settings); final String webAddress = ClientUtils.getWebAddress(container, details, settings); final String siteAddress = ClientUtils.getSiteAddress(container, details, settings); if (settings.isRegistryEnabled()) { final String pullAddress = ClientUtils.getPullAddress(container, details, settings); containerPullAddress.setText(pullAddress); pullAddressGroup.setVisible(true); } else { containerPullAddress.setText(""); pullAddressGroup.setVisible(false); } containerSSHCommand.setText(sshCommand); containerWebAddress.setText(webAddress); containerWebAddress.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { Window.open(webAddress, "_blank", ""); } }); sshCommandGroup.setVisible(true); webAddressGroup.setVisible(true); final VerticalPanel p = new VerticalPanel(); p.addStyleName(style.artifactVersions()); final Frame f = new Frame(siteAddress); f.addStyleName(style.artifactVersions()); final Button b = new Button(Constants.INSTANCE.navigate()); b.setType(ButtonType.INFO); b.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { try { Window.open(siteAddress, "_blank", ""); } catch (IllegalStateException e) { showError(Constants.INSTANCE.noPublicPortsAvailable()); } } }); p.add(f); p.add(b); artifactVersionsGroup.add(p); artifactVersionsGroup.setVisible(true); // Specify the password for the dbms container via environment variables. jdbcGroup.setVisible(false); if (SharedUtils.supportsDatabase(container)) { final Map<String, String> dbContainerEnvs = ClientUtils.toMap(details.getEnvVars(), "="); if (dbContainerEnvs != null) { final String _jdbcUrl = ClientUtils.getValue(dbContainerEnvs, DatabaseUtils.KIE_CONNECTION_URL); if (_jdbcUrl != null && _jdbcUrl.trim().length() > 0) { jdbcUrl.setText(_jdbcUrl); jdbcUser.setText(ClientUtils.getValue(dbContainerEnvs, DatabaseUtils.KIE_CONNECTION_USER)); jdbcPassword.setText( ClientUtils.getValue(dbContainerEnvs, DatabaseUtils.KIE_CONNECTION_PASSWORD)); jdbcGroup.setVisible(true); } } } } else { containerPullAddress.setText(""); containerSSHCommand.setText(""); containerWebAddress.setText(""); pullAddressGroup.setVisible(false); sshCommandGroup.setVisible(false); webAddressGroup.setVisible(false); artifactVersionsGroup.setVisible(false); jdbcGroup.setVisible(false); } configurePortsGrid(container, details, settings); configureEnvVarsGrid(container, details, settings); }
From source file:org.kie.guvnor.dtablexls.client.editor.DecisionTableXLSEditorViewImpl.java
License:Apache License
public void setPath(final Path path) { //Upload widgets final Well uploadWell = new Well(); final HorizontalPanel uploadContainer = new HorizontalPanel(); uploadContainer.add(new Label(DecisionTableXLSEditorConstants.INSTANCE.UploadNewVersion() + ":")); uploadContainer.add(uploadWidget);//from w ww .java2 s. c o m uploadContainer.add(uploadButton); uploadWell.add(uploadContainer); ts.addRow(uploadWell); uploadButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { BusyPopup.showMessage(DecisionTableXLSEditorConstants.INSTANCE.Uploading()); uploadWidget.submit(path, URLHelper.getServletUrl(), new Command() { @Override public void execute() { BusyPopup.close(); notifySuccess(); } }, new Command() { @Override public void execute() { BusyPopup.close(); } }); } }); //Download widgets final Well downloadWell = new Well(); final HorizontalPanel downloadContainer = new HorizontalPanel(); downloadContainer.add(new Label(DecisionTableXLSEditorConstants.INSTANCE.DownloadCurrentVersion() + ":")); downloadContainer.add(downloadButton); downloadWell.add(downloadContainer); ts.addRow(downloadWell); downloadButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { Window.open(URLHelper.getDownloadUrl(path), "downloading", "resizable=no,scrollbars=yes,status=no"); } }); }
From source file:org.kie.guvnor.scorecardxls.client.editor.ScoreCardXLSEditorViewImpl.java
License:Apache License
public void setPath(final Path path) { //Upload widgets final Well uploadWell = new Well(); final HorizontalPanel uploadContainer = new HorizontalPanel(); uploadContainer.add(new Label(ScoreCardXLSEditorConstants.INSTANCE.UploadNewVersion() + ":")); uploadContainer.add(uploadWidget);//from w w w . j av a2 s . c om uploadContainer.add(uploadButton); uploadWell.add(uploadContainer); ts.addRow(uploadWell); uploadButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { BusyPopup.showMessage(ScoreCardXLSEditorConstants.INSTANCE.Uploading()); uploadWidget.submit(path, URLHelper.getServletUrl(), new Command() { @Override public void execute() { BusyPopup.close(); notifySuccess(); } }, new Command() { @Override public void execute() { BusyPopup.close(); } }); } }); //Download widgets final Well downloadWell = new Well(); final HorizontalPanel downloadContainer = new HorizontalPanel(); downloadContainer.add(new Label(ScoreCardXLSEditorConstants.INSTANCE.DownloadCurrentVersion() + ":")); downloadContainer.add(downloadButton); downloadWell.add(downloadContainer); ts.addRow(downloadWell); downloadButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { Window.open(URLHelper.getDownloadUrl(path), "downloading", "resizable=no,scrollbars=yes,status=no"); } }); }
From source file:org.kie.workbench.client.KieWorkbenchEntryPoint.java
License:Apache License
private List<? extends MenuItem> getDashboardViews() { final List<MenuItem> result = new ArrayList<MenuItem>(1); result.add(MenuFactory.newSimpleItem(constants.Process_Dashboard()) .withRoles(kieACL.getGrantedRoles(F_PROCESS_DASHBOARD)) .place(new DefaultPlaceRequest("DashboardPerspective")).endMenu().build().getItems().get(0)); final String dashbuilderURL = DashboardURLBuilder.getDashboardURL("/dashbuilder/workspace", "showcase", LocaleInfo.getCurrentLocale().getLocaleName()); result.add(MenuFactory.newSimpleItem(constants.Business_Dashboard()) .withRoles(kieACL.getGrantedRoles(F_DASHBOARD_BUILDER)).respondsWith(new Command() { @Override/*w w w . j av a2 s .c om*/ public void execute() { Window.open(dashbuilderURL, "_blank", ""); } }).endMenu().build().getItems().get(0)); return result; }