Michael Mehrle wrote:
>
> Now, if I want to call a method that returns a String instead, like
> so...
>
> add(new Label("greetings", new StringResourceModel("label.allAlbums",
> this, new Model(getTotalAlbums())));
> ^^^^^^^^^^^
>
> ...with my properties file having this entry:
>
> label.getTotalAlbums = All Albums: ${someReference}
>
> Obviously, this doesn't work, since the new Model(xxx) call expects a
> bean to be passed in. How can I do this with a simple method call? And
> what would my someReference var be?
>
Why dont you simple use MessageFormat's parameter substitution as desribed
in the JavaDoc, i.e.
.. new StringResourceModel("label.getTotalAlbums",this,null,new Object[] {
getTotalAlbums() });
with
label.getTotalAlbums=All Albums: ${0}
Alternatively, I you need late binding put
new AbstractReadOnlyModel() {
public Object getObject() { return getTotalAlbums(); }
}
in the object array (instead of getTotalAlbums() directly)
bye ...
...roland
--
View this message in context:
http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15440668.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]