@lists.sourceforge.net
Subject: Re: [Wicket-user] question on localization
Date: Tue, 24 Apr 2007 11:00:05 -0700
this is bad. getpagetitle() might get called from a partially constructed
object
it should be
public BasePage() {
add(new Label(pageHeaderTitle, new pagetitlemodel
pagetitlemodel.getObject() will be called
when
subclass page will be rendered, that is after subclass is constructed. is
this correct?
Vadim
From: Igor Vaynberg [EMAIL PROTECTED]
Reply-To: wicket-user@lists.sourceforge.net
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] question
You might want to make it so you can dynamically generate a page title
where you need to, instead of always requiring a static page title. The
trick is to return an IModel from the getPageTitle method in your base
page. Here's how I've done it:
title wicket:id=pageHeaderTitleFoo/title
public
this is bad. getpagetitle() might get called from a partially constructed
object
it should be
public BasePage() {
add(new Label(pageHeaderTitle, new pagetitlemodel()));
}
private class pagetitlemodel extends abstractreadonlymodel {
object getobject() { return
Ah, yes, this is much better. It bothered me enough to put a warning in
the Javadoc, but that's a poor substitute for something that just works.
I'll be fixing our code in the morning. Thanks Igor.
jk
On Tue, Apr 24, 2007 at 11:00:05AM -0700, Igor Vaynberg wrote:
this is bad. getpagetitle()
i tried to use Label() with PropertyModel(pageTitle) but didn't work for
me. it rendered Home string all the time, no matter what the locale was.
any ideas how to do this?
You can do something like this:
new Label( componentId, new StringResourceModel( pageTitle, this, new
Model() ) );
In