Re: change localized number format globally in application

2008-08-14 Thread Igor Vaynberg
you can install your converter globally by overriding
application.newconverterlocator

-igor

On Thu, Aug 14, 2008 at 8:29 AM, pixologe <[EMAIL PROTECTED]> wrote:
>
> Hi everybody,
>
> with a german Locale the following two labels have different output
>
> new Label("label1", new Model(123456789.0))   > 123.456.789
> new Label("label2", new Model(123456789))   > 123456789
>
> I am not quite sure why Double and Integer are handled differently when it
> comes to grouping - is there an elegant way to change this application wide,
> so that label2 has the same number format as label1?
>
> I have been looking around the web for solutions, but it only came up with
> having a custom Label with a custom Converter or a custom model... I am not
> sure whether this would be really best-practice, so if anyone knows better,
> I'd be glad to hear from you.
>
> Again, thanks in advance for your friendly help :)
> --
> View this message in context: 
> http://www.nabble.com/change-localized-number-format-globally-in-application-tp18983927p18983927.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: change localized number format globally in application

2008-08-14 Thread pixologe


igor.vaynberg wrote:
> 
> you can install your converter globally by overriding
> application.newconverterlocator
> 

thanks for pointing me in the right direction, igor :)

lazy as i am, i chose a one-line solution which is obviously not the most
elegant one - however it does the job for now:

((ConverterLocator)getConverterLocator()).set(Integer.class,FloatConverter.INSTANCE);

just switching the integerconverter against a floatconverter does the trick
:)

however, having a custom converter locator + integer converter would def be
the "cleaner" solution, i know 

thanks again

-- 
View this message in context: 
http://www.nabble.com/change-localized-number-format-globally-in-application-tp18983927p18986192.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: change localized number format globally in application

2008-08-14 Thread Matthew Young
>I am not quite sure why Double and Integer are handled differently when it
comes to grouping

in AbstractIntegerConverter, NumberFormat is initialized with this:

numberFormat.setGroupingUsed(false);

I asked long time ago while different policy for integer and float and the
answer was for integer, most use case don't want grouping.  But I think the
real reason is so we can figure how to make custom converter and how to
install it application wide :)

On Thu, Aug 14, 2008 at 10:33 AM, pixologe <[EMAIL PROTECTED]> wrote:

>
>
> igor.vaynberg wrote:
> >
> > you can install your converter globally by overriding
> > application.newconverterlocator
> >
>
> thanks for pointing me in the right direction, igor :)
>
> lazy as i am, i chose a one-line solution which is obviously not the most
> elegant one - however it does the job for now:
>
>
> ((ConverterLocator)getConverterLocator()).set(Integer.class,FloatConverter.INSTANCE);
>
> just switching the integerconverter against a floatconverter does the trick
> :)
>
> however, having a custom converter locator + integer converter would def be
> the "cleaner" solution, i know
>
> thanks again
>
> --
> View this message in context:
> http://www.nabble.com/change-localized-number-format-globally-in-application-tp18983927p18986192.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>