this can be done application-wide by overriding
protected IConverterLocator newConverterLocator()
in you Application

see org.apache.wicket.util.convert.ConverterLocator

On 10/2/07, Gerolf Seitz <[EMAIL PROTECTED]> wrote:
> you can override the method getConverter(Class) and return customized
> converter.
> i use a "DoubleLabel" to always show 2 fraction digits:
>
> private static class DoubleLabel extends Label {
>
>         // constructors ....
>
>         public IConverter getConverter(Class clazz) {
>             DoubleConverter converter = (DoubleConverter)
> DoubleConverter.INSTANCE;
>             NumberFormat format = converter.getNumberFormat(getLocale());
>             format.setMinimumFractionDigits(2);
>             converter.setNumberFormat(getLocale(), format);
>             return converter;
>         }
>
>     }
>
> this can probably be optimized to not always create a converter but rather
> save it as a property of the label, ...
>
> you get the idea.
>
>   gerolf
>
> On 10/2/07, Artur W. <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi!
> >
> > TextField rounds doubles values up to 3 fraction digits. Why?
> >
> > For example
> >
> > container.add(new TextField("price", new PropertyModel(this, "price"),
> > Double.class));   //price = 0,96104
> > gives 0,961.
> >
> >
> > How to change it?
> >
> > Thanks,
> > Artur
> >
> > --
> > View this message in context:
> > http://www.nabble.com/TextField-rounds-doubles%2C-why--tf4554400.html#a12997105
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

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

Reply via email to