@Override
  public void setErrors(Set<ErrorDisplay> errors) {
    HashSet<ErrorDisplay> errorsToRemove = new HashSet<ErrorDisplay>(containedErrros);
    errorsToRemove.removeAll(errors);
    for (ErrorDisplay errorDisplay : errorsToRemove) {
      Widget widget = widgets.get(errorDisplay);
      errorsList.remove(widget);
      widgets.remove(widget);
    }

    HashSet<ErrorDisplay> errorsToAdd = new HashSet<ErrorView.ErrorDisplay>(errors);
    errorsToAdd.removeAll(containedErrros);
    String errorViewItemClass = ApplicationResources.INSTANCE.css().errorViewItemClass();
    String errorViewImageClass = ApplicationResources.INSTANCE.css().errorViewImageClass();
    for (ErrorDisplay errorDisplay : errorsToAdd) {
      SafeHtml html =
          template.errorDisplayTemplate(
              errorImageSafeUri, errorDisplay.getErrorInfo(), errorViewImageClass);
      HTML widget = new HTML(html);
      widget.setStyleName(errorViewItemClass);
      widgets.put(errorDisplay, widget);
      errorsList.add(widget);
    }
    containedErrros = new HashSet<ErrorView.ErrorDisplay>(errors);
    int height = 0;
    for (int i = 0; i < errorsList.getWidgetCount(); ++i) {
      Widget widget = errorsList.getWidget(i);
      widget.getElement().getStyle().setTop(height, Unit.PX);
      height += widget.getOffsetHeight() + 5;
    }
  }
Example #2
0
 public void setRowNumber(int number) {
   this.rowNum = number;
   if (isAttached())
     if (this.isAutoNumber) {
       row.getWidget(0).getElement().setInnerText(number + "");
     }
 }