Example #1
0
  /** Check query string to see if the user wants to load previous search data into the forms. */
  private void loadPreviousSearch(final ClientLoadedSearch result) {
    if (result == null) {
      return;
    }
    final ClientSwiftSearchDefinition definition = result.getDefinition();
    displayMessage("Loaded previous search " + definition.getSearchTitle());

    if (result.getClientParamSetList() != null) {
      // We transfered a new parameter set list together with search definition
      // Update the parameter editor.
      paramsEditor.setParamSetList(result.getClientParamSetList());
    }

    paramsEditor.setSelectedParamSet(result.getDefinition().getParamSet());

    // Determine search type
    SearchType searchType = null;
    for (final ClientFileSearch clientFileSearch : definition.getInputFiles()) {
      final String fileNamefileNameWithoutExtension =
          FilePathWidget.getFileNameWithoutExtension(clientFileSearch.getPath());
      final SearchType newSearchType =
          SearchTypeList.getSearchTypeFromSetup(
              definition.getSearchTitle(),
              fileNamefileNameWithoutExtension,
              clientFileSearch.getExperiment(),
              clientFileSearch.getBiologicalSample());
      if (searchType == null) {
        searchType = newSearchType;
      } else {
        if (!searchType.equals(newSearchType)) {
          searchType = SearchType.Custom;
          break;
        }
      }
    }

    final String title = definition.getSearchTitle();
    setTitleText(title);
    if (spectrumQaSetupPanel != null) {
      spectrumQaSetupPanel.setParameters(definition.getSpectrumQa());
    }
    if (reportSetupPanel != null) {
      reportSetupPanel.setParameters(definition.getPeptideReport());
    }
    final List<ClientFileSearch> inputFiles = definition.getInputFiles();

    files.setFiles(inputFiles, searchType);

    selectUser(definition.getUser().getEmail());

    final String filePath = getOutputPathFromFileTable(inputFiles);
    // If the loaded path differs from what the file table would produce, it is user-specified
    // .. set the proper flags
    if (definition.getOutputFolder() == null || !definition.getOutputFolder().equals(filePath)) {
      outputPathUserSpecified = true;
    }
    outputPath = definition.getOutputFolder();
    output.setText(outputPath);
    updateOutputLocation();

    additionalSettingsPanel.setDefinition(definition);

    showPageContentsAfterLoad();
  }