Wicket
  1. Wicket
  2. WICKET-2244

Allow overriding of the Validator default MessageKey

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4-RC2
    • Fix Version/s: 1.5.2, 1.5.5
    • Component/s: wicket
    • Labels:
      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]

        Activity

        Martin Grigorov made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Fix Version/s 1.5.5 [ 12319052 ]
        Resolution Fixed [ 1 ]
        Igor Vaynberg made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Martin Grigorov made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 1.5.2 [ 12318078 ]
        Resolution Fixed [ 1 ]
        Alexandru Objelean created issue -

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Alexandru Objelean
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development