Re: how to register IConverters

2008-07-23 Thread Jason Lea
We followed the wiki:  
http://cwiki.apache.org/WICKET/using-custom-converters.html

So in our Application class we have

   @Override
   protected IConverterLocator newConverterLocator() {
   final ConverterLocator converterLocator=new ConverterLocator();
   converterLocator.set(Long.class, new MyLongConverter());
   converterLocator.set(BigDecimal.class, new MyBigDecimalConverter());
   return converterLocator;
   }

We only had to create MyLongConverter and MyBigDecimalConverter, and 
just used the existing ConverterLocator.  We only created the converters 
so we could have longs and bigdecimals appear with digit groups eg 
1,234,567.89


lars vonk wrote:

Hi Timo,

thanks for replying.

  

Normally you can just register converters in init() of your
Application subclass.



How is this done? What method do I call? The only way I see to add
your own converters is the way I described previously or explicitly
cast the IConverterLocator an
org.apache.wicket.util.convert.ConverterLocator since there is no set
method on the IConverterLocator interface that allows to add
converters. Or am I overlooking something?

Thanks in advance,
Lars



On Wed, Jul 23, 2008 at 6:16 AM, Timo Rantalaiho <[EMAIL PROTECTED]> wrote:
  

On Mon, 21 Jul 2008, lars vonk wrote:


Is it maybe an idea to change this to a registerConverter(IConverter)
method that I can call? That saves me a custom IConverterLocator to
implement.
  

Normally you can just register converters in init() of your
Application subclass. You only need your own IConverterLocator
implementation if you want more specialised way of locating
converters than the default (for example, to support Hibernate
proxies).

Best wishes,
Timo

--
Timo Rantalaiho
Reaktor Innovations Oyhttp://www.ri.fi/ >

-
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]


  


--
Jason Lea




Re: how to register IConverters

2008-07-23 Thread lars vonk
Hi Timo,

thanks for replying.

> Normally you can just register converters in init() of your
> Application subclass.

How is this done? What method do I call? The only way I see to add
your own converters is the way I described previously or explicitly
cast the IConverterLocator an
org.apache.wicket.util.convert.ConverterLocator since there is no set
method on the IConverterLocator interface that allows to add
converters. Or am I overlooking something?

Thanks in advance,
Lars



On Wed, Jul 23, 2008 at 6:16 AM, Timo Rantalaiho <[EMAIL PROTECTED]> wrote:
> On Mon, 21 Jul 2008, lars vonk wrote:
>> Is it maybe an idea to change this to a registerConverter(IConverter)
>> method that I can call? That saves me a custom IConverterLocator to
>> implement.
>
> Normally you can just register converters in init() of your
> Application subclass. You only need your own IConverterLocator
> implementation if you want more specialised way of locating
> converters than the default (for example, to support Hibernate
> proxies).
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oyhttp://www.ri.fi/ >
>
> -
> 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: how to register IConverters

2008-07-22 Thread Timo Rantalaiho
On Mon, 21 Jul 2008, lars vonk wrote:
> Is it maybe an idea to change this to a registerConverter(IConverter)
> method that I can call? That saves me a custom IConverterLocator to
> implement.

Normally you can just register converters in init() of your
Application subclass. You only need your own IConverterLocator
implementation if you want more specialised way of locating
converters than the default (for example, to support Hibernate
proxies).

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations Oyhttp://www.ri.fi/ >

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



how to register IConverters

2008-07-21 Thread lars vonk
Hi,

I need to use a custom implementation of an IConverter. The way I see
to let the application use this class is to:

- override method newConverterLocator
- return own implementation of IConverterLocater (or sublcass of
ConverterLocator) that registers the new IConverter.

Is this correct, because this seems a bit verbose?

Is it maybe an idea to change this to a registerConverter(IConverter)
method that I can call? That saves me a custom IConverterLocator to
implement.

Thanks, Lars

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