Thanks guys,
I'll remind Jeremy's suggestion when I have something more complicated. Now
it was as simple as:
new PropertyModel(item.getModel(),"language.displayLanguage")
The code of FormInput has indeed been a big help.
Pieter
2007/6/14, Eelco Hillenius <[EMAIL PROTECTED]>:
new PropertyModel(model, "language.getDisplayLanguage()"); should work I
think.
Or you could try:
new AbstractReadOnlyModel() {
public Object getObject() {
return model.getLanguage().getDisplayLanguage();
}
};
Btw, check out the FormInput example in Wicket examples. The code
looks a bit messy, but it does fancy things with locales.
Eelco
On 6/14/07, Pieter Cogghe <[EMAIL PROTECTED]> wrote:
> I've got a model with a language (Locale) property. I want to write
> the language (language.getDisplayLanguage) in a Label. I did it like
> this:
>
> item.add(new Label("language", new PropertyModel(item.getModel
(),"language")){
> @Override
> protected void onComponentTagBody(MarkupStream markupStream,
> ComponentTag openTag) {
> Locale model = (Locale) getModelObject();
> replaceComponentTagBody(markupStream, openTag,
> model.getDisplayLanguage());
> }
> });
>
> This doesn't feel right. Anybody a better idea? (Maybe override the
> toString method of Locale?)
>
> thanks,
>
> Pieter
>
> --
> Pieter Cogghe
> Ganzendries 186
> 9000 Gent
> 0487 10 14 21
>
>
-------------------------------------------------------------------------
> 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
> Wicket-user@lists.sourceforge.net
> 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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-------------------------------------------------------------------------
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user