private void userChanged() { if (users == null) { return; } ClientUser user = null; if (users.getSelectedIndex() > 0) { final String email = users.getValue(users.getSelectedIndex()); if (userInfo.containsKey(email)) { user = userInfo.get(email); } Cookies.setCookie( "email", users.getValue(users.getSelectedIndex()), ParamSetSelectionController.getCookieExpirationDate(), null, "/", false); } // Figure out whether this user can edit parameters or not final boolean editorEnabled = user != null && user.isParameterEditorEnabled(); if (paramsEditor != null) { paramsEditor.setEditorEnabled(editorEnabled, user); } setOutputPathChangeEnabled(user != null && user.isOutputPathChangeEnabled()); }
private void initParamsEditor(final InitialPageData pageData) { ParamsEditorApp.onModuleLoad(pageData); paramsEditor = ParamsEditorApp.getPanel(); paramsEditor .getValidationController() .addValueChangeHandler( new ValueChangeHandler<ClientValue>() { @Override public void onValueChange(final ValueChangeEvent<ClientValue> event) { runButton.setEnabled(paramsEditor.isValid()); updateTitleFromFileTable(); updateOutputLocation(); } }); }
private void updateTitleFromFileTable() { // User edited the title field. We have no business here if (userEditedTitle) { return; } List<String> names = files.getFileNames(); if (names.size() == 0) { setTitleText(""); } else { Iterator<String> iterator = names.iterator(); String longestPrefix = iterator.next(); while (iterator.hasNext()) { String next = iterator.next(); for (int i = 0; i < Math.min(longestPrefix.length(), next.length()); i++) { if (next.charAt(i) != longestPrefix.charAt(i)) { longestPrefix = longestPrefix.substring(0, i); break; } } } // The users like to name files with underscores separating different fields. // If we detect more than 1 underscore, we will try to remove everything beyond the last // underscore // That takes care of test_S1, test_S2, test_S3 or test_Inj1, test_Inj2 type of repeats, // resulting // with just "test". // If there is just one underscore, we remove it if it is the last one. int numUnderscores = longestPrefix.length() - longestPrefix.replaceAll("_", "").length(); if (numUnderscores <= 1) { longestPrefix = longestPrefix.replaceAll("_$", ""); } else { longestPrefix = longestPrefix.replaceAll("_[^_]*$", ""); } setTitleText(longestPrefix + paramsEditor.getTitleSuffix()); } updateOutputLocation(); }
/** 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(); }