You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Resolved) (JIRA)" <ji...@apache.org> on 2012/02/10 09:09:59 UTC
[jira] [Resolved] (WICKET-2244) Allow overriding of the Validator
default MessageKey
[ https://issues.apache.org/jira/browse/WICKET-2244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-2244.
-------------------------------------
Resolution: Fixed
Fix Version/s: 1.5.5
Fixed!
Thanks, Bertrand!
Funny, I reported similar bug to another project few days ago...
> Allow overriding of the Validator default MessageKey
> -----------------------------------------------------
>
> Key: WICKET-2244
> URL: https://issues.apache.org/jira/browse/WICKET-2244
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 1.4-RC2
> Reporter: Alexandru Objelean
> Assignee: Martin Grigorov
> Fix For: 1.5.5, 1.5.2
>
>
> Currently there is no other way to change the default message key of any validator. Provide a protected non final method: getMessageKey() to allow overriding of the message key. For example for MinimumValidator:
> [CODE]
> public void validate(IValidatable<Z> validatable)
> {
> Z value = validatable.getValue();
> if (value.compareTo(minimum) < 0)
> {
> ValidationError error = new ValidationError();
> error.addMessageKey(getMessageKey());
> error.setVariable("minimum", minimum);
> validatable.error(error);
> }
> }
> protected String getMessageKey() {
> return "MinimumValidator";
> }
> [CODE]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira