On Friday 18 May 2007 10:51 am, Florian Hehlen escreveu:
> Hi,
>
> Do you have a snipet of code you could share on how you do this?
in my form I have this:
add( new DropDownChoice( "cause",
_causeDao.getCauseCodes() ) );
In my application I have this:
//
// Register our custom converters.
//
getApplicationSettings().setConverterLocatorFactory( new
IConverterLocatorFactory()
{
public IConverterLocator newConverterLocator()
{
return new OmsConverter();
}
} );
My OmsConverter looks a bit like this: (I actually register a bunch of
converters)
/**
* Registers all oms specific converters.
*/
public class OmsConverter
extends
ConverterLocator
{
@SpringBean( name = "causeDao" )
private CauseDao _causeDao;
public OmsConverter()
{
InjectorHolder.getInjector().inject( this );
Assert.notNull( _causeDao, "causeDao must not be null." );
CauseConverter causeConverter = new
CauseConverter( _causeDao );
set( Cause.class, causeConverter );
}
This way, if I use the same class in a bunch of places, I don't have to
register the converter or choice renderer with each one. It makes adding a
DDC easy and I only have to do the mapping in the converter.
My converter extends AbstractConverter and is pretty easy to write.
>
> Florian
>
> Thomas R. Corbin wrote:
> > I had started to use a ChoiceRenderer when I started with wicket, but
> > quickly found that registering a converter was easier for me.
> >
> > Is that an unusual way of dealing with DDC?
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user