Why don't you use special model for each component?
Because this is very specific thing - CompoundPropertyModel is not
supposed for this kind of model value's processing stuff.
For example for activeString:
add(new Label("activeString", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getString(yourModel.getActiveString());
}
}));
Anyway if you want it you can still write your own implementation of
CompoundPropertyModel...
-----Original Message-----
From: Jeffrey Schneller [mailto:[email protected]]
Sent: Friday, October 16, 2009 4:36 PM
To: [email protected]
Subject: Localization of values coming from my Model
I am trying to display a page using my CompoundPropertyModel however
some of the values coming from the model need to be localized before
displaying to the user. This is being done inside of a wizard step.
For example:
My model has the following properties
String gender
boolean active
Gender is either male or female
I have a getter in my object which is getActiveString which returns Yes
or No based on the T/F of the Boolean. public String
getActiveString() {if (active) { return "Yes";} else {return "No";}}
The html is:
<span wicket:id="gender"></span>
<span wicket:id="activeString"></span>
The java code is:
add(new Label("gender"));
add(new Label("activeString"));
The issue is that I need to localize the gender value. The activeString
also needs to be localized.
How would one do this? I need to store the values in the model as they
are since it is being persisted to a db. However for certain users the
data needs to be shown in their particular language when presented on
the page.
Any ideas?
BTW... thanks you all for your previous help. I am finally in the final
steps of development for my project.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]