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


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.
-
You can reply to this email to add a comment to the issue online.

Reply via email to