You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bergmann Manfred <mb...@software-by-mabe.com> on 2009/08/27 19:36:33 UTC

Re: users Digest 27 Aug 2009 15:08:59 -0000 Issue 2060

Thanks for that pointer.
I've looked over the model and got it working with overriding  
getObject() in PropertyModel.


Manfred


>
> Von: Jeremy Thomerson <je...@wickettraining.com>
> Datum: 27. August 2009 15:17:49 GMT+01:00
> An: users@wicket.apache.org
> Betreff: Re: Subclass of base page class not rendered
>
>
> You're going about this the wrong way.  You shouldn't force a
> re-instantiation.  The real problem here is that your components are
> not shown as localized because apparently you are pushing the strings
> into your components in the constructors.  Instead, you should use a
> model that always pulls the strings based on current state.
>
> i.e., instead of:
>
> MyConstructor {
>  add(new Label("foo", getString("some.key"));
> }
>
> You should be doing:
>
> MyConstructor {
>  add(new Label("foo", new ResourceModel("some.key"));
> }
>
> Incorrect use of models is the most common Wicket learning mistake.  I
> suspect that's what this is.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Thu, Aug 27, 2009 at 4:47 AM, Bergmann
> Manfred<mb...@software-by-mabe.com> wrote:
>> Hi there.
>>
>> I've run into an issue and don't know how to solve it.
>> My experience with Wicket is still low.
>>
>> I have a BasePage, subclass of WebPage. This page has some links,  
>> including
>> links to change the language.
>> This BasePage is not a page that is "rendered" directly. Only though
>> subclasses.
>> However the link events are handled on the BasePage. In the link  
>> handler the
>> locale is changed in the session and the last rendered page should  
>> get
>> re-rendered.
>> It looks like that BasePage subclass is re-rendered because
>> <wicket:message/> messages are localized. But some others  
>> components are
>> not.
>> In fact the constructor of the subclass is not called again and  
>> that's the
>> reason for some components are still in the old language.
>> How can I force to re-instantiate this subclass while not knowing  
>> which
>> subclass it is in the link click-handler?
>>
>>
>> Regards,
>> Manfred


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org