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; }
@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(); }