i dont think it works like that.

the localizer searches up the component hierarchy, RequiredValidator is not in it so the validators have to explicitly ask localizer for both keys: formcompid.validator-key and validator-key. i dont think localizer knows enough to do it for us.

-Igor


On 3/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
While you're at it, perhaps we could improve the error message on missing resources for validators? Currently all we get is:

>java.util.MissingResourceException: Unable to find resource: RequiredValidator

Not very helpful :(. I'd preferred if Localizer (line 228) included the component's path, something like:

>java.util.MissingResourceException : Unable to find resource: ComboBox$FoundValidator for component: sub.form.foo.bar

For this to work we have to strip down AbstractValidator#error(FormComponent, String, IModel):
{
// Return formatted error message
Localizer localizer = formComponent.getLocalizer();

// Get the property value associated with the key.
String key = Classes.name(getClass());
String message = localizer.getString(key, formComponent, resourceModel);

formComponent.error(message);
}

Please compare with the current implementation, which calls twice into the localizer with the formComponent's parent - first with the resourceKey and then with just the validator class.
IMHO this is duplicate work. Localizer (line 386) does something similar already.

Sven


>if nick can migrate before 1.2 i would like to remove it. its causing an >extra resource lookup in my refactored code. its not a big deal but its >bugging me because i know its there.
>
>-Igor
>
>On 3/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> so you do have a straight forward migration path away from it? maybe i will
> deprecate it for 1.2 and remove in 1.3 then. or ask again before we release
> 1.2 in case you had time to move.
>
>  -Igor
>
>
>
> On 2/28/06, Nick Heudecker < [EMAIL PROTECTED]> wrote:
> > We're using it.  We should move away from it, but I don't have the time to
> update everything in my app right now.
> >
> >
> >
> > On 2/28/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > > i would like to remove IValidatorResourceKeyFactory and so i want to
> know if anyone is using it and thus be affected. since we now have a good
> search order for resource keys instead of always trying
> formname.inputname.validator-class the factory is more or
> less obsolete.
> > >
> > > so if you are using it please respond.
> > >
> > > -Igor
> > >
> > >
> >
> >
>
>


--
Living a wicket life...

Martijn Dashorst - http://www.jroller.com/page/dashorst

Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to