Example #1
0
 /** Update the output location as appropriate. */
 public void updateOutputLocation() {
   if (outputPathChangeEnabled && outputPathUserSpecified) {
     // The user can and did influence output path. Keep whatever was the previous setting, unless
     // it is a special value like "<No Files Selected>" or "<No Title>" - wipe that one.
     if (outputPathSpecial) {
       outputPathSpecial = false;
     }
     validateOutputPath(output.getText());
   } else {
     // Automatically populate the file path
     final List<ClientFileSearch> fileSearches = getFileSearches();
     if (files == null || (fileSearches == null) || (fileSearches.isEmpty())) {
       if (!outputPathChangeEnabled) {
         output.setText("<No Files Selected>");
         outputPathSpecial = true;
       } else {
         output.setText("");
       }
       outputValidationPanel.removeValidationsFor(output);
       outputPath = null;
     } else if ((getTitleText() == null) || getTitleText().equals("")) {
       if (!outputPathChangeEnabled) {
         output.setText("<No Title>");
         outputPathSpecial = true;
       } else {
         output.setText("");
       }
       outputValidationPanel.removeValidationsFor(output);
       outputPath = null;
     } else {
       outputPathSpecial = false;
       outputPath = getOutputPathFromFileTable(fileSearches);
       output.setText(outputPath);
       validateOutputPath(outputPath);
     }
   }
 }
Example #2
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();
  }