cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist <mlundqui...@comcast.net>
Subject [forms] simple output-only datatype convertor
Date Sat, 04 Jun 2005 00:14:43 GMT
Hi,

I have this class called Money, a fixed-point representation and 
arithmetic class for monetary amounts.

I want to display some Moneys in an <output> widget in a <repeater>.

Money has a toString() method.

Am I missing some obvious, built-in easy way to make this work?

What I did...
(1) Wrote dumb little class StringConvertor and StringConvertorBuilder 
classes.  This just calls toString() on the object.  I added this in 
the Cocoon source tree.
(2) Made a MoneyType and MoneyTypeBuilder (extending the abstract 
classes in oacf.datatype.typeimpl).  I did this in my application 
source tree which is built separately from cocoon.  To make this work, 
I had to change visibility on some AbstractTypeBuilder methods from 
protected to public.
(3) Finally, added my new datatype to cocoon.xconf.

It works fine.

But it feels wrong.  It was kind of a pain in the rear for one thing.  
Was there a better approach?

Cheers,
—ml—


Mime
View raw message