/** Checks the text for errors and sets the error state accordingly. */ public void checkError() { final boolean previousStatus = getMessage() == null || getMessage().isEmpty(); final ValidationResponse vr = validator.validate(getText()); setMessage(vr.getFailureReason()); firePropertyChange("validationResult", previousStatus, !vr.isFailure()); if (vr.isFailure()) { setIcon(errorIcon); } else { setIcon(null); } }
/** * Checks if the text validates. * * @see com.dmdirc.util.validators.Validator#validate(Object) * @return true iif the text validates */ public boolean validateText() { return !isEnabled() || !validator.validate(getText()).isFailure(); }