@Override
  public void showErrors(List<EditorError> errors) {
    if (errors != null && errors.size() > 0) {

      List<EditorError> casTbFieldErrors = new ArrayList<EditorError>();
      List<EditorError> dateFieldErrors = new ArrayList<EditorError>();
      List<EditorError> raisonDepistageFieldErrors = new ArrayList<EditorError>();
      List<EditorError> resultatFieldErrors = new ArrayList<EditorError>();

      for (EditorError error : errors) {
        Object userData = error.getUserData();
        if (userData != null && userData instanceof String) {
          String field = (String) userData;

          if (field.equals("casTb")) casTbFieldErrors.add(error);
          if (field.equals("date")) dateFieldErrors.add(error);
          if (field.equals("raisonDepistage")) raisonDepistageFieldErrors.add(error);
          if (field.equals("resultat")) resultatFieldErrors.add(error);
        }
      }
      if (casTbFieldErrors.size() > 0) casTb.showErrors(casTbFieldErrors);
      if (dateFieldErrors.size() > 0) date.showErrors(dateFieldErrors);
      if (raisonDepistageFieldErrors.size() > 0)
        raisonDepistage.showErrors(raisonDepistageFieldErrors);
      if (resultatFieldErrors.size() > 0) resultat.showErrors(resultatFieldErrors);
    }
  }
 public void showErrors(List<EditorError> errors) {
   SafeHtmlBuilder b = new SafeHtmlBuilder();
   for (EditorError error : errors) {
     b.appendEscaped(error.getPath()).appendEscaped(": ");
     b.appendEscaped(error.getMessage()).appendHtmlConstant("<br>");
   }
   this.errors.setInnerHTML(b.toSafeHtml().asString());
 }
Exemplo n.º 3
0
  /**
   * The default implementation will display, but not consume, received errors whose {@link
   * EditorError#getEditor() getEditor()} method returns the Editor passed into {@link #setEditor}.
   *
   * @param errors a List of {@link EditorError} instances
   */
  @Override
  public void showErrors(List<EditorError> errors) {
    StringBuilder sb = new StringBuilder();
    for (EditorError error : errors) {
      if (error.getEditor().equals(editor)) {
        sb.append("\n").append(error.getMessage());
      }
    }

    if (sb.length() == 0) {
      errorLabel.setInnerText("");
      errorLabel.getStyle().setDisplay(Display.NONE);
      return;
    }

    errorLabel.setInnerText(sb.substring(1));
    errorLabel.getStyle().setDisplay(Display.INLINE_BLOCK);
  }
Exemplo n.º 4
0
 /** @see com.google.gwt.editor.client.HasEditorErrors#showErrors(java.util.List) */
 @Override
 public void showErrors(List<EditorError> errors) {
   Widget decoratedWidget = controlGroup != null ? controlGroup : this;
   if (errors != null && !errors.isEmpty()) {
     StyleHelper.addStyle(decoratedWidget, ControlGroupType.ERROR);
     SafeHtmlBuilder sb = new SafeHtmlBuilder();
     for (EditorError error : errors) {
       if (error.getEditor() == this) {
         sb.appendEscaped(error.getMessage());
         sb.appendHtmlConstant("<br />");
       }
     }
     setErrorLabelText(sb.toSafeHtml().asString());
   } else {
     StyleHelper.removeStyle(decoratedWidget, ControlGroupType.ERROR);
     setErrorLabelText("");
   }
 }
Exemplo n.º 5
0
  @Override
  public void showErrors(List<EditorError> errors) {
    if (errors != null && errors.size() > 0) {

      List<EditorError> patientFieldErrors = new ArrayList<EditorError>();
      List<EditorError> patientLieFieldErrors = new ArrayList<EditorError>();
      List<EditorError> typeRelationFieldErrors = new ArrayList<EditorError>();

      for (EditorError error : errors) {
        Object userData = error.getUserData();
        if (userData != null && userData instanceof String) {
          String field = (String) userData;

          if (field.equals("patient")) patientFieldErrors.add(error);
          if (field.equals("patientLie")) patientLieFieldErrors.add(error);
          if (field.equals("typeRelation")) typeRelationFieldErrors.add(error);
        }
      }
      if (patientFieldErrors.size() > 0) patient.showErrors(patientFieldErrors);
      if (patientLieFieldErrors.size() > 0) patientLie.showErrors(patientLieFieldErrors);
      if (typeRelationFieldErrors.size() > 0) typeRelation.showErrors(typeRelationFieldErrors);
    }
  }
  @Override
  public void showErrors(List<EditorError> errors) {
    if (errors != null && errors.size() > 0) {

      List<EditorError> cDTFieldErrors = new ArrayList<EditorError>();
      List<EditorError> lotFieldErrors = new ArrayList<EditorError>();
      List<EditorError> quantiteFieldErrors = new ArrayList<EditorError>();

      for (EditorError error : errors) {
        Object userData = error.getUserData();
        if (userData != null && userData instanceof String) {
          String field = (String) userData;

          if (field.equals("cDT")) cDTFieldErrors.add(error);
          if (field.equals("lot")) lotFieldErrors.add(error);
          if (field.equals("quantite")) quantiteFieldErrors.add(error);
        }
      }
      if (cDTFieldErrors.size() > 0) CDT.showErrors(cDTFieldErrors);
      if (lotFieldErrors.size() > 0) lot.showErrors(lotFieldErrors);
      if (quantiteFieldErrors.size() > 0) quantite.showErrors(quantiteFieldErrors);
    }
  }