Adam, As you suggest, creating a named subclass of Label is probably the
best thing for you if you don't want to keep overriding the
getConverter() method. 

My 2 cents,

Jonathan

>>> [EMAIL PROTECTED] 2005-06-17 7:02:53 PM >>>
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 

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com 
_____________________________________________________________________


-------------------------------------------------------
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_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to