@Override public ValidationResult validate() { ValidationResult result = super.validate(); if (AccounterValidator.isInPreventPostingBeforeDate(this.transactionDate)) { result.addError(transactionDateItem, messages.invalidateDate()); } result.add(payForm.validate()); if (!AccounterValidator.isPositiveAmount(amountText.getAmount())) { amountText.textBox.addStyleName("highlightedFormItem"); result.addError(amountText, messages.valueCannotBe0orlessthan0(messages.amount())); } ClientAccount bankAccount = depositInCombo.getSelectedValue(); // check if the currency of accounts is valid or not if (bankAccount != null) { ClientCurrency bankCurrency = getCurrency(bankAccount.getCurrency()); ClientCurrency customerCurrency = getCurrency(customer.getCurrency()); if (bankCurrency != getBaseCurrency() && bankCurrency != customerCurrency) { result.addError(depositInCombo, messages.selectProperBankAccount()); } } return result; }
public ValidationResult validate() { ValidationResult result = form.validate(); result.add(form1.validate()); if (fromClientItem != null && toClientItem != null) { if (fromClientItem.getID() == toClientItem.getID()) { result.addError(fromClientItem, messages.notMove(messages.items())); } if (fromClientItem.getType() != toClientItem.getType()) { result.addError(fromClientItem, messages.typesMustbeSame(messages.items())); } if (fromClientItem.getMeasurement() != toClientItem.getMeasurement()) { result.addError(fromClientItem, messages2.measurementMustBeSame(messages.items())); } return result; } return result; }