Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2244

Allow overriding of the Validator default MessageKey

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4-RC2
    • 1.5.2, 1.5.5
    • wicket
    • None

    Description

      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]

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            alexandru.objelean Alexandru Objelean
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: