Пример #1
0
  private void updateUserMessage() {
    ServiceConnection.instance()
        .getUiConfig(
            new AsyncCallback<HashMap<String, String>>() {
              @Override
              public void onFailure(final Throwable throwable) {
                displayMessage("");
              }

              @Override
              public void onSuccess(final HashMap<String, String> uiConfig) {
                final String message = uiConfig.get(USER_MESSAGE);
                displayMessage(message == null ? "" : message);
              }
            });
  }
Пример #2
0
  private void validateOutputPath(final String text) {
    ServiceConnection.instance()
        .outputFolderExists(
            text,
            new AsyncCallback<Boolean>() {
              @Override
              public void onFailure(final Throwable caught) {
                outputValidationPanel.removeValidationsFor(output);
              }

              @Override
              public void onSuccess(final Boolean result) {
                outputValidationPanel.removeValidationsFor(output);
                if (Boolean.TRUE.equals(result)) {
                  outputValidationPanel.addValidation(
                      new ClientValidation("Folder exists, will be overwritten"), output);
                }
              }
            });
  }
Пример #3
0
  private void initPage(final Integer previousSearchId) {
    hidePageContentsWhileLoading();
    ServiceConnection.instance()
        .getInitialPageData(
            previousSearchId,
            new AsyncCallback<InitialPageData>() {
              @Override
              public void onFailure(final Throwable caught) {
                // SWALLOWED: Fail
                finalizeFileTableInit();
                finalizeSpectrumQa(null);
                // InitReport fail
                DOM.setStyleAttribute(DOM.getElementById("reportingRow"), "display", "none");
                showPageContentsAfterLoad();
              }

              @Override
              public void onSuccess(final InitialPageData result) {
                previousSearchRunId =
                    result.loadedSearch() == null ? -1 : result.loadedSearch().getSearchId();
                if (previousSearchRunId != -1) {
                  userEditedTitle = true;
                }
                initUiConfiguration(result.getUiConfiguration());
                initSearchMetadata(
                    result.loadedSearch() == null
                        ? new HashMap<String, String>()
                        : result.loadedSearch().getDefinition().getMetadata());
                initParamsEditor(result);
                finalizeFileTableInit();
                finalizeSpectrumQa(result.getSpectrumQaParamFileInfo());
                finalizeInitReport(result.isScaffoldReportEnabled(), result.getSearchEngines());
                initAdditionalSettings();
                initUserList(result.listUsers());
                showPageContentsAfterLoad();
                initMessage(getConfigurationSetting(USER_MESSAGE));
                loadPreviousSearch(result.loadedSearch());
              }
            });
  }
Пример #4
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);
      }
    }