コード例 #1
0
  /** Update the status */
  private void updateStatus(String textValue) {
    isValid = true;
    String msg = null;

    for (TextValidator vdater : validators) {
      if (!vdater.validate(textValue)) {
        isValid = false;
        msg = vdater.getErrorMessage();
        break;
      }
    }

    if (isValid) {
      formgroup.setValidationState(ValidationState.NONE);
      fgHelpBlock.setText(null);
    } else {
      formgroup.setValidationState(ValidationState.ERROR);
      fgHelpBlock.setText(msg);
    }
  }
コード例 #2
0
 @Override
 public void error() {
   form.setValidationState(ValidationState.ERROR);
 }
コード例 #3
0
 @UiHandler("searchPatternTextBox")
 public void onPatternChanged(ChangeEvent event) {
   presenter.viewUpdated();
   form.setValidationState(ValidationState.NONE);
 }
コード例 #4
0
 @Override
 public void setPattern(String pattern) {
   form.setValidationState(ValidationState.NONE);
   searchPatternTextBox.setText(pattern);
 }
コード例 #5
0
  @UiHandler("search")
  public void onSearchClick(final ClickEvent e) {
    errorPanel.clear();
    formGroup.setValidationState(ValidationState.NONE);
    final Map<String, Object> metadata = new HashMap<String, Object>();
    if (!sourceTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.source[0]", sourceTextBox.getText().trim());
    }

    if (!createdByTextBox.getText().trim().isEmpty()) {
      metadata.put("createdBy", createdByTextBox.getText().trim());
    }

    if (!descriptionByTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.description[0]", descriptionByTextBox.getText().trim());
    }

    if (!formatTypeahead.getText().trim().isEmpty()) {
      final String pattern =
          clientTypeRegistry.resolveWildcardPattern(formatTypeahead.getText().trim());
      metadata.put("filename", pattern);
    }

    if (!subjectTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.subject[0]", subjectTextBox.getText().trim());
    }

    if (!typeTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.type[0]", typeTextBox.getText().trim());
    }

    if (!lastModifiedByTextBox.getText().trim().isEmpty()) {
      metadata.put("lastModifiedBy", lastModifiedByTextBox.getText().trim());
    }

    if (!externalLinkTextBox.getText().trim().isEmpty()) {
      metadata.put("dcore.relation[0]", externalLinkTextBox.getText().trim());
    }

    if (!checkinCommentTextBox.getText().trim().isEmpty()) {
      metadata.put("checkinComment", checkinCommentTextBox.getText().trim());
    }

    boolean hasSomeDateValue = false;

    if (createdAfter.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (createdBefore.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (lastModifiedAfter.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (lastModifiedBefore.getValue() != null) {
      hasSomeDateValue = true;
    }

    if (metadata.size() == 0 && !hasSomeDateValue) {
      formGroup.setValidationState(ValidationState.ERROR);
      Alert alert = new Alert(Constants.INSTANCE.AtLeastOneFieldMustBeSet(), AlertType.DANGER);
      alert.setVisible(true);
      alert.setDismissable(true);
      errorPanel.add(alert);
      return;
    }

    final SearchResultTable queryTable =
        new SearchResultTable(
            new QueryMetadataPageRequest(
                metadata,
                createdAfter.getValue(),
                createdBefore.getValue(),
                lastModifiedAfter.getValue(),
                lastModifiedBefore.getValue(),
                0,
                null));
    simplePanel.clear();

    simplePanel.add(queryTable);

    formAccordionCollapse.setIn(false);
    resultAccordionCollapse.setIn(true);
  }