You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Sparer <mi...@gmx.at> on 2010/08/24 14:33:43 UTC

Shouldn't an IConverter also work for StringResourceModels?

  Hi,

I've got an entry in a properties file that looks like this:

text=I'll pay ${moneyAmount}

where moneyAmount is an Object like the one below

public class MoneyAmount {

long amount;

// getters and setters

}

I registered a converter in the Application that does the formatting 
depending on locale whenever I use a PropertyModel or a simple Model 
(i.e. whenever getModelObjectAsString gets invoked). However when using 
a StringResourceModel, or Component#getString() the IConverter won't be 
invoked and a simple MoneyAmount.toString will show up as replacement of 
${moneyAmount} (on PropertyVariableInterpolator on line 90 btw.). 
Shouldn't there be a lookup for the converter or am I missing something 
and there's an easier way?

cheers,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Shouldn't an IConverter also work for StringResourceModels?

Posted by Igor Vaynberg <ig...@gmail.com>.
file an issue, attach a patch if you can.

-igor

On Tue, Aug 24, 2010 at 5:33 AM, Michael Sparer <mi...@gmx.at> wrote:
>  Hi,
>
> I've got an entry in a properties file that looks like this:
>
> text=I'll pay ${moneyAmount}
>
> where moneyAmount is an Object like the one below
>
> public class MoneyAmount {
>
> long amount;
>
> // getters and setters
>
> }
>
> I registered a converter in the Application that does the formatting
> depending on locale whenever I use a PropertyModel or a simple Model (i.e.
> whenever getModelObjectAsString gets invoked). However when using a
> StringResourceModel, or Component#getString() the IConverter won't be
> invoked and a simple MoneyAmount.toString will show up as replacement of
> ${moneyAmount} (on PropertyVariableInterpolator on line 90 btw.). Shouldn't
> there be a lookup for the converter or am I missing something and there's an
> easier way?
>
> cheers,
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org