You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Ville Peurala (JIRA)" <ji...@apache.org> on 2007/04/19 10:02:15 UTC

[jira] Created: (WICKET-485) Private inner classes of StringValidator should be public

Private inner classes of StringValidator should be public
---------------------------------------------------------

                 Key: WICKET-485
                 URL: https://issues.apache.org/jira/browse/WICKET-485
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
            Reporter: Ville Peurala
            Priority: Minor


Inner classes of StringValidator, like MaximumLengthValidator, are currently private and created only via factory methods. They should be public so that their method resourceKey(FormComponent) could be overridden. Currently you can't use these ready-made validators if you need to use an existing resource bundle key for error messages.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-485) Private inner classes of StringValidator should be public

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490101 ] 

Igor Vaynberg commented on WICKET-485:
--------------------------------------

@Johan: the form component name is added outside the validator, inside formcomponent when it tries to resolve the resource string

@Ville: i will make the public

> Private inner classes of StringValidator should be public
> ---------------------------------------------------------
>
>                 Key: WICKET-485
>                 URL: https://issues.apache.org/jira/browse/WICKET-485
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Ville Peurala
>         Assigned To: Igor Vaynberg
>            Priority: Minor
>
> Inner classes of StringValidator, like MaximumLengthValidator, are currently private and created only via factory methods. They should be public so that their method resourceKey(FormComponent) could be overridden. Currently you can't use these ready-made validators if you need to use an existing resource bundle key for error messages.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-485) Private inner classes of StringValidator should be public

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner reassigned WICKET-485:
--------------------------------------

    Assignee: Igor Vaynberg

hmm i don't like opening up them, They are really meant to go through those factory methods.
The problem here and i guess that did happen with a validator refactor is that the form element name isn't also added anymore to the resource keys
looking at the javadoc:

/**
		 * @see org.apache.wicket.markup.html.form.validation.AbstractValidator#resourceKey(org.apache.wicket.markup.html.form.FormComponent)
		 */
		protected String resourceKey()
		{
			return "StringValidator.range";
		}

there was a time that there was a form component part in that one.

So the fix should be somewhere else that resource key is just unique for that validator.
But there should be a prepend with something else
currently we do this in AbstractValidator:

	ValidationError error = new ValidationError().addMessageKey(resourceKey);
		final String defaultKey = Classes.simpleName(getClass());
		if (!resourceKey.equals(defaultKey))
		{
			error.addMessageKey(defaultKey);
		}

But that doesnt help much. (then we have "StringValidator.Range" and that StringValidator.class name)
We should have:

Component.getId() + "StringValidator.Range"
"StringValidator.Range"
"StringValidator.class" (don't care much about this one)






> Private inner classes of StringValidator should be public
> ---------------------------------------------------------
>
>                 Key: WICKET-485
>                 URL: https://issues.apache.org/jira/browse/WICKET-485
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Ville Peurala
>         Assigned To: Igor Vaynberg
>            Priority: Minor
>
> Inner classes of StringValidator, like MaximumLengthValidator, are currently private and created only via factory methods. They should be public so that their method resourceKey(FormComponent) could be overridden. Currently you can't use these ready-made validators if you need to use an existing resource bundle key for error messages.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-485) Private inner classes of StringValidator should be public

Posted by "Ville Peurala (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489989 ] 

Ville Peurala commented on WICKET-485:
--------------------------------------

The problem we have is that we have an existing resource bundle which is used by multiple applications. We need to use error messages from there, but we cannot change the keys, so we cannot use error keys like "StringValidator.Range". We must use existing error keys like "error_value_too_long". What I would like to do is use ready-made validators (like StringValidator.MaximumLengthValidator) like this:

input.add(new StringValidator.MaximumLengthValidator() {
            @Override
            protected String resourceKey(FormComponent component) {
                return "error_value_too_long";
            }
});

But this cannot be done now, since those inner classes are private (this code example does not compile).


> Private inner classes of StringValidator should be public
> ---------------------------------------------------------
>
>                 Key: WICKET-485
>                 URL: https://issues.apache.org/jira/browse/WICKET-485
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Ville Peurala
>         Assigned To: Igor Vaynberg
>            Priority: Minor
>
> Inner classes of StringValidator, like MaximumLengthValidator, are currently private and created only via factory methods. They should be public so that their method resourceKey(FormComponent) could be overridden. Currently you can't use these ready-made validators if you need to use an existing resource bundle key for error messages.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-485) Private inner classes of StringValidator should be public

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-485.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3

> Private inner classes of StringValidator should be public
> ---------------------------------------------------------
>
>                 Key: WICKET-485
>                 URL: https://issues.apache.org/jira/browse/WICKET-485
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Ville Peurala
>         Assigned To: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.3
>
>
> Inner classes of StringValidator, like MaximumLengthValidator, are currently private and created only via factory methods. They should be public so that their method resourceKey(FormComponent) could be overridden. Currently you can't use these ready-made validators if you need to use an existing resource bundle key for error messages.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.