コード例 #1
0
  public void confirmBackgroundExecutionDialog(final String url) {
    final String title = Messages.getString("confirm"); // $NON-NLS-1$
    final String message = Messages.getString("userParamBackgroundWarning"); // $NON-NLS-1$
    VerticalPanel vp = new VerticalPanel();
    vp.add(new Label(Messages.getString(message)));

    final PromptDialogBox scheduleInBackground =
        new PromptDialogBox(
            title,
            Messages.getString("yes"),
            Messages.getString("no"),
            false,
            true,
            vp); //$NON-NLS-1$ //$NON-NLS-2$

    final IDialogCallback callback =
        new IDialogCallback() {
          public void cancelPressed() {
            scheduleInBackground.hide();
          }

          public void okPressed() {
            runInBackground(url);
          }
        };
    scheduleInBackground.setCallback(callback);
    scheduleInBackground.center();
  }
コード例 #2
0
ファイル: TabWidget.java プロジェクト: Hanuman/bi-platform-v2
 public void createDeepLink() {
   if (tabContent instanceof IFrameTabPanel) {
     PromptDialogBox dialogBox =
         new PromptDialogBox(
             Messages.getString("deepLink"),
             Messages.getString("ok"),
             Messages.getString("cancel"),
             false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             true);
     String url =
         Window.Location.getProtocol()
             + "//"
             + Window.Location.getHostName()
             + ":"
             + Window.Location.getPort()
             + Window.Location.getPath() // $NON-NLS-1$ //$NON-NLS-2$
             + "?name="
             + textLabel.getText()
             + "&startup-url="; //$NON-NLS-1$ //$NON-NLS-2$
     String startup = ((IFrameTabPanel) tabContent).getUrl();
     TextBox urlbox = new TextBox();
     urlbox.setText(url + URL.encodeComponent(startup));
     urlbox.setVisibleLength(80);
     dialogBox.setContent(urlbox);
     dialogBox.center();
   }
 }
コード例 #3
0
 public MantleLoginDialog() {
   super(
       Messages.getString("login"),
       Messages.getString("login"),
       Messages.getString("cancel"),
       false,
       true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   setCallback(myCallback);
   getLoginSettingsAndShow(false);
   super.setStylePrimaryName("pentaho-dialog");
 }
コード例 #4
0
 protected void backClicked() {
   hide();
   if (parentDialog != null) {
     parentDialog.center();
   }
 }
コード例 #5
0
  private void performRestoreToHomeFolder(
      final String filesList,
      final int restoreResponseStatusCode,
      final String userHomeFolderPath,
      final SolutionFileActionEvent event) {

    final String encodedUserHomeFolderPath = SolutionBrowserPanel.pathToId(userHomeFolderPath);
    String fileListDescription = "files";
    // if there is one file
    if (filesList.split(",").length == 1) {
      fileListDescription = "file";
    }

    HTML messageTextBox = new HTML();
    String cannotRestoreToOrigFolder =
        Messages.getString("cannotRestoreToOriginFolder", fileListDescription);
    String restoreToHomeFolder = Messages.getString("restoreToHomeFolder", userHomeFolderPath);

    messageTextBox.setHTML(cannotRestoreToOrigFolder + "<br> <br>" + restoreToHomeFolder + "<br>");
    final PromptDialogBox restoreFileWarningDialogBox =
        new PromptDialogBox(
            Messages.getString("couldNotWriteToFolder"), "Restore File", "Cancel", true, true);
    restoreFileWarningDialogBox.setContent(messageTextBox);

    final IDialogCallback callback =
        new IDialogCallback() {

          public void cancelPressed() {
            restoreFileWarningDialogBox.hide();
          }

          public void okPressed() {
            // We can't write to origin file folder, and there are
            // files in homeFolder with same names
            if (restoreResponseStatusCode == Response.SC_CONFLICT) {
              final OverwritePromptDialog overwriteDialog = new OverwritePromptDialog();
              final IDialogCallback callback =
                  new IDialogCallback() {
                    public void cancelPressed() {
                      event.setMessage("Cancel");
                      overwriteDialog.hide();
                    }

                    public void okPressed() {
                      String restoreFilesUrl =
                          contextURL
                              + "api/repo/files/restore?overwriteMode="
                              + overwriteDialog.getOverwriteMode(); // $NON-NLS-1$
                      RequestBuilder builder =
                          new RequestBuilder(RequestBuilder.PUT, restoreFilesUrl);
                      try {
                        builder.sendRequest(
                            filesList,
                            new RequestCallback() {
                              @Override
                              public void onResponseReceived(Request request, Response response) {
                                if (response.getStatusCode() == Response.SC_OK) {
                                  new RefreshRepositoryCommand().execute(false);
                                  event.setMessage("Success");
                                  EventBusUtil.EVENT_BUS.fireEvent(event);
                                } else {
                                  showErrorDialogBox(event);
                                }
                              }

                              @Override
                              public void onError(Request request, Throwable exception) {
                                showErrorDialogBox(event);
                              }
                            });
                      } catch (RequestException e) {
                        showErrorDialogBox(event);
                      }
                    }
                  };
              overwriteDialog.setCallback(callback);
              overwriteDialog.center();
            } else if (restoreResponseStatusCode == Response.SC_TEMPORARY_REDIRECT) {
              String moveFilesURL =
                  contextURL + "api/repo/files/" + encodedUserHomeFolderPath + "/move";
              RequestBuilder builder = new RequestBuilder(RequestBuilder.PUT, moveFilesURL);
              try {
                builder.sendRequest(
                    filesList,
                    new RequestCallback() {
                      @Override
                      public void onResponseReceived(Request request, Response response) {
                        new RefreshRepositoryCommand().execute(false);
                        event.setMessage("Success");
                        EventBusUtil.EVENT_BUS.fireEvent(event);
                      }

                      @Override
                      public void onError(Request request, Throwable exception) {
                        showErrorDialogBox(event);
                      }
                    });
              } catch (RequestException e) {
                showErrorDialogBox(event);
              }
            }
          }
        };

    restoreFileWarningDialogBox.setCallback(callback);
    restoreFileWarningDialogBox.center();
  }