Exemplo n.º 1
0
 @UiHandler("clearSessionFiltersButton")
 void handleClearSessionFiltersButtonClick(ClickEvent e) {
   sessionsTo.setValue(null, true);
   sessionsFrom.setValue(null, true);
   sessionIdsTextBox.setText(null);
   stopTypingSessionIdsTimer.schedule(10);
 }
  /** This is the entry point method. */
  public void onModuleLoad() {
    sendButton = new Button("Send");
    nameField = new TextBox();
    nameField.setText("GWT User");
    errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    textToServerLabel = new Label();
    serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    final ClickHandler buttonClickHandler =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            dialogBox.hide();
            sendButton.setEnabled(true);
            sendButton.setFocus(true);
          }
        };
    closeButton.addClickHandler(buttonClickHandler);

    // Add a handler to send the name to the server
    ChangeEventHandler handler = new ChangeEventHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);
  }
Exemplo n.º 3
0
  private void filterSessions(Set<SessionDataDto> sessionDataDtoSet) {
    if (sessionDataDtoSet == null || sessionDataDtoSet.isEmpty()) {
      sessionIdsTextBox.setText(null);
      stopTypingSessionIdsTimer.schedule(10);

      return;
    }

    final StringBuilder builder = new StringBuilder();
    boolean first = true;
    for (SessionDataDto sessionDataDto : sessionDataDtoSet) {
      if (!first) {
        builder.append("/");
      }
      builder.append(sessionDataDto.getSessionId());
      first = false;
    }
    sessionIdsTextBox.setText(builder.toString());
    stopTypingSessionIdsTimer.schedule(10);
  }
 private TextBox buildParameterTextBox(String text) {
   TextBox paramBox = new TextBox();
   paramBox.setText(text);
   paramBox.setWidth("135");
   paramBox.addChangeHandler(
       new ChangeHandler() {
         public void onChange(ChangeEvent event) {
           enableSaveButton();
         }
       });
   return paramBox;
 }
Exemplo n.º 5
0
  private void addStock() {
    final String symbol = newSymbolTextBox.getText().toUpperCase().trim();
    newSymbolTextBox.setFocus(true);

    // Stock code must be between 1 and 10 chars that are numbers, letters, or dots.
    if (!symbol.matches("^[0-9A-Z\\.]{1,10}$")) {
      Window.alert("'" + symbol + "' is not a valit symbol.");
      newSymbolTextBox.selectAll();
      return;
    }

    newSymbolTextBox.setText("");
  }
Exemplo n.º 6
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);
     }
   }
 }
Exemplo n.º 7
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();
  }