@Override
  public void startWith(MonetaryUnit fromUnit, MonetaryUnit toUnit, CurrencyPair pair) {
    this.fromUnit = fromUnit;
    this.toUnit = toUnit;
    this.pair = pair;

    view.setPresenter(this);

    view.reset(pair == null);

    if (pair != null) {
      view.getRateProperty().set(pair.getExchangeRate());
      view.getDateProperty().set(pair.getCreatedOn());
    } else {
      view.getRateProperty().set(CurrencyPair.DEFAULT_EXCHANGE_RATE);
      view.getDateProperty().set(new Date());
    }

    view.focus();
  }
  protected List<ValidationError> flushView() {
    List<ValidationError> errors = new ArrayList();

    if (pair == null) {
      pair = new CurrencyPair(fromUnit, toUnit, CurrencyPair.DEFAULT_EXCHANGE_RATE);
    }

    pair.setExchangeRate(view.getRateProperty().get());
    pair.setCreatedOn(view.getDateProperty().get());

    errors.addAll(pair.validate(Validatable.GROUP_CLIENT));

    return errors;
  }
  protected void showValidationErrors(List<ValidationError> errors) {
    List<ValidationError> entityErrors =
        ValidationError.filterEntity(errors, CurrencyPair.class.getName());

    for (ValidationError error : entityErrors) {
      if (CurrencyPair.Property.exchangeRate.equals(error.getProperty()))
        view.getRateProperty().showValidationError(error);
      else if (CurrencyPair.Property.createdOn.equals(error.getProperty()))
        view.getDateProperty().showValidationError(error);
      else errors.add(error);
    }

    for (ValidationError error : errors) {
      bus.fireEvent(new ValidationErrorNotifyEvent(error));
    }
  }
 protected void clearValidationErrors() {
   view.getRateProperty().clearValidationError();
   view.getDateProperty().clearValidationError();
 }