Hi All,
I'm trying to Zen the best solution to my problem and I thought I'd check with
the list to see if anyone else has tackled this.
I have two properties in my business object that are stored as BigDecimals. One
represents money and the other a percentage. I have registered a BigDecimal
converter at the application level but these two pieces of data should really
be formatted differently when displayed in, say, a list.
I've created two IConverters, MoneyToStringConverter and
PercentToStringConverter, and I have attached them to the Label components as
such:
listItem.add(new Label("surcharge", new Model(project.getSurcharge())) {
public IConverter getConverter() {
return new MoneyToStringConverter();
}
});
listItem.add(new Label("surchargePercent", new
Model(project.getSurchargePercent())) {
public IConverter getConverter() {
return new PercentToStringConverter();
}
});
And this works. Surcharge is displayed as $50.00 and Surcharge Percent is
displayed as 50.00%. But this seems rather tedious if I have to attach these to
every field that needs conversion for display.
Does anyone have any thoughts on how we could "flag" a field or label as being
a specific semantic type? Should I create a MoneyLabel and a PercentLabel?
Any ideas would be appreciated!
--
Adam
A language that doesn't affect the way you
think about programming is not worth
knowing.
-- Alan J. Perlis
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user