예제 #1
0
 /**
  * Deal with errors not associated with any specific widget. TODO Does this really belong here?
  */
 public static void handleGlobalError(Throwable t) {
   ErrorDialog.show(t);
 }
예제 #2
0
    @Override
    public void onClick(final ClickEvent event) {
      updateUserMessage();
      updateOutputLocation();

      final String titleText = title.getText();

      if (titleText == null) {
        Window.alert("No title specified");
        title.setFocus(true);
        return;
      }

      if (!titleText.matches(TITLE_ALLOWED)) {
        Window.alert(
            "The search title "
                + titleText
                + " is invalid. Please use only letters, numbers, - + . _ ( ) [ ] { } = # and a space.");
        title.setFocus(true);
        return;
      }

      final String effectiveOutputPath = outputPathUserSpecified ? output.getText() : outputPath;
      final String user = users.getValue(users.getSelectedIndex());

      final List<ClientFileSearch> fileSearches = getFileSearches();
      if (fileSearches == null || fileSearches.isEmpty()) {
        Window.alert("No files added to the search");
        return;
      }

      if (effectiveOutputPath == null || "".equals(effectiveOutputPath)) {
        Window.alert("The output folder not specified");
        return;
      }

      if ("".equals(user) || user.equals(SELECT_USER_STRING)) {
        Window.alert("No user selected");
        users.setFocus(true);
        return;
      }

      // The user will likely create a broken output on Windows
      if (effectiveOutputPath.length()
              + "/scaffold/".length()
              + titleText.length()
              + ".sf3".length()
          > 220) {
        Window.alert("The output folder path is too long.");
        title.setFocus(true);
        return;
      }

      final ProgressDialogBox dialog = new ProgressDialogBox();
      dialog.setProgressMessage("Submitting search...");
      dialog.setRelativeSize(0.25, 0.25);
      dialog.setMinimumSize(200, 200);
      dialog.showModal();

      try {
        final List<ClientFileSearch> entries = files.getData();

        final ClientSpectrumQa clientSpectrumQa;
        if (spectrumQaSetupPanel != null) {
          clientSpectrumQa = spectrumQaSetupPanel.getParameters();
        } else {
          clientSpectrumQa = new ClientSpectrumQa();
        }
        final ClientSwiftSearchDefinition def =
            new ClientSwiftSearchDefinition(
                getTitleText(),
                userInfo.get(users.getValue(users.getSelectedIndex())),
                effectiveOutputPath,
                paramsEditor.getSelectedParamSet(),
                entries,
                clientSpectrumQa,
                reportSetupPanel == null
                    ? new ClientPeptideReport(false)
                    : reportSetupPanel.getParameters(),
                additionalSettingsPanel.isPublicMgfs(),
                additionalSettingsPanel.isPublicMzxmls(),
                additionalSettingsPanel.isPublicSearchFiles(),
                getSearchMetadata(),
                previousSearchRunId);
        def.setFromScratch(additionalSettingsPanel.isFromScratch());
        def.setLowPriority(additionalSettingsPanel.isLowPriority());
        if (additionalSettingsPanel.isMzIdentMl()) {
          def.getMetadata().put("mzIdentMl", "1");
        }
        if (!"".equals(additionalSettingsPanel.getComment())) {
          def.getMetadata().put("comment", additionalSettingsPanel.getComment());
        } else {
          def.getMetadata().remove("comment");
        }

        ServiceConnection.instance()
            .startSearch(
                def,
                new AsyncCallback<Void>() {
                  @Override
                  public void onFailure(final Throwable throwable) {
                    dialog.hide();
                    ErrorDialog.handleGlobalError(throwable);
                  }

                  @Override
                  public void onSuccess(final Void o) {
                    dialog.hide();
                    redirect("/report/");
                  }
                });
      } catch (Exception e) {
        dialog.hide();
        ErrorDialog.handleGlobalError(e);
      }
    }