コード例 #1
0
ファイル: HTMLTest.java プロジェクト: MaxDhn/gwt-test-utils
  @Test
  public void text() {
    // Arrange
    HTML html = new HTML("this is a <b>great</b> test.<BR/>Enjoy!");

    // Act
    String result = html.getText();

    // Assert
    assertEquals("this is a great test.Enjoy!", result);

    // Act 2
    html.setText("override <b>not bold text</b>");

    // Assert 2
    assertEquals("override <b>not bold text</b>", html.getText());
  }
コード例 #2
0
 /**
  * Gets the message to be displayed to the user
  *
  * @return the message
  */
 public String getMessage() {
   return messageLabel.getText();
 }
コード例 #3
0
  private void save(final int saveMode) {
    enableSaveButtons(false);

    String date = dateCreatedHTML.getText();
    String manager = managerHTML.getText();
    String descriptionText = XMLUtils.clean(description.getText());
    String notesText = XMLUtils.clean(notes.getText());
    final String name = XMLUtils.clean(workingSetName.getText());
    final String errorFilter = filterPanel.checkValidity();

    // CHECK TO MAKE SURE FIELDS ARE ENTERED IN
    if (name == null || name.trim().equals("")) {
      WindowUtils.errorAlert("Please enter a working set name.");
      enableSaveButtons(true);
      return;
    }

    if (errorFilter != null) {
      WindowUtils.errorAlert(errorFilter);
    } else if (descriptionText == null || descriptionText.trim().equals("")) {
      WindowUtils.errorAlert("Please enter a working set description.");
      enableSaveButtons(true);
      return;
    } else if (workingSetMode.getSelectedIndex() != PRIVATEINDEX
        && workingSetMode.getSelectedIndex() != PUBLICINDEX) {
      WindowUtils.errorAlert("Please select the working set type.");
      enableSaveButtons(true);
      return;
    }

    // HAVEN'T SAVED BEFORE
    if (id == null) {
      final WorkingSetData currentWorkingSet = new WorkingSetData();
      currentWorkingSet.setDate(date);
      currentWorkingSet.setCreator(manager);
      currentWorkingSet.setDescription(descriptionText);
      currentWorkingSet.setNotes(notesText);
      currentWorkingSet.setWorkingSetName(name);
      currentWorkingSet.setMode(workingSetMode.getItemText(workingSetMode.getSelectedIndex()));
      currentWorkingSet.setPeople(people.getItemsInList());
      currentWorkingSet.setFilter(filterPanel.getFilter());

      if (currentWorkingSet.getMode().equalsIgnoreCase(WorkingSetData.PRIVATE)) {
        savePrivateWorkingSet(currentWorkingSet, saveMode);
        workingSetMode.setEnabled(false);
      } else {
        savePublicWorkingSet(currentWorkingSet, saveMode);
        workingSetMode.setEnabled(false);
      }

      // this.manager.workingSetHierarchy.update();
      WSStore.getStore().update();
    }
    // ALREADY HAVE BEEN SAVED BEFORE, REALLY EDITTING
    else {

      final WorkingSetData currentWorkingSet =
          (WorkingSetData) WorkingSetCache.impl.getWorkingSets().get(id);

      if (currentWorkingSet != null) {
        currentWorkingSet.setDescription(descriptionText);
        currentWorkingSet.setNotes(notesText);
        currentWorkingSet.setWorkingSetName(name);
        currentWorkingSet.setPeople(people.getItemsInList());
        currentWorkingSet.setFilter(filterPanel.getFilter());
        String mode = currentWorkingSet.getMode();
        String newMode = workingSetMode.getItemText(workingSetMode.getSelectedIndex());

        if (!mode.equalsIgnoreCase(newMode)) {

          // CHANGING TO PRIVATE
          if (newMode.equalsIgnoreCase(WorkingSetData.PRIVATE)) {

            WindowUtils.confirmAlert(
                "Warning",
                "Changing a working set from public to private creates"
                    + " a copy of the working set into your private directory but does not"
                    + " delete the working set out of the public directory.",
                new Listener<MessageBoxEvent>() {
                  public void handleEvent(MessageBoxEvent be) {
                    if (be.getType() == Events.Close) {
                      if (be.getButtonClicked().getType().equals(MessageBox.OK)) {
                        savePublicToPrivateWorkingSet(currentWorkingSet, saveMode);
                      }
                    }
                  }
                });
          }

          // CHANGING TO PUBLIC
          if (newMode.equalsIgnoreCase(WorkingSetData.PRIVATE)) {

            WindowUtils.confirmAlert(
                "Warning",
                "Changing a working set from private to public will allow your "
                    + "working set to be viewed by other people.",
                new Listener<MessageBoxEvent>() {
                  public void handleEvent(MessageBoxEvent be) {
                    if (be.getType() == Events.Close) {
                      if (be.getButtonClicked().getType().equals(MessageBox.OK)) {
                        savePrivateToPublicWorkingSet(currentWorkingSet, saveMode);
                      }
                    }
                  }
                });
          }
        } else if (currentWorkingSet.getMode().equalsIgnoreCase(WorkingSetData.PRIVATE))
          savePrivateWorkingSet(currentWorkingSet, saveMode);
        else savePublicWorkingSet(currentWorkingSet, saveMode);
      }
    }
  }
コード例 #4
0
 public String getText() {
   return caption.getText();
 }
コード例 #5
0
 public String getSelectedValue() {
   return currentValue.getText();
 }