You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com> on 2011/01/25 18:37:45 UTC
Call onAfterRender and change default model without error
I tried to do the following below but I got an error could not update
component hierarchy.
WicketMessage: Cannot modify component hierarchy after render phase has
started (page version cant change then anymore)
Is there an event method (like onAfterRender) that I could use without
error?
Component:
onBeforeRender() {
...
this.setDefaultModel(...);
}
onAfterRender() {
this.setSetDefaultModel(...);
}
Berlin Brown (POL)
RE: Call onAfterRender and change default model without error
Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
Some Other Panel :
addAjaxLink() {
onClick() {
setDefaultModel(new Model<String>("EnabledLight"));
target.addComponent(trafficLight);
}
}
-----Original Message-----
From: Brown, Berlin [GCG-PFS]
Sent: Tuesday, January 25, 2011 2:19 PM
To: 'users@wicket.apache.org'
Subject: RE: Call onAfterRender and change default model without error
Here is a use-case for my request below:
Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component).
WicketTrafficLight extends Panel {
WicketTrafficLight() {
super("trafficLight");
setDefaultModel(new Model<String>("EnabledLight"));
}
onAfterRender() {
...
setDefaultModel(new Model<String>("DisabledLight"));
}
}
Some Other Panel :
addAjaxLink() {
onClick() {
setDefaultModel(new Model<String>("EnabledLight"));
}
}
...
<span wicket:id="trafficLight"></span>
-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
Sent: Tuesday, January 25, 2011 1:01 PM
To: users@wicket.apache.org
Subject: Re: Call onAfterRender and change default model without error
you didnt answer my question
-igor
On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
> If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
>
> onBeforeRender() {
> ...
> this.setDefaultModel(new ReadonlyStaticModel("state1"));
> }
>
> onAfterRender() {
> this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
> }
>
> I guess I could use the backing model object as opposed to the model to change the state.
> ... Changed to:
>
> onBeforeRender() {
> ...
> getDefaultModel().set("state1"));
> }
>
> onAfterRender() {
> getDefaultModel().set("state2"));
> }
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 25, 2011 12:40 PM
> To: users@wicket.apache.org
> Subject: Re: Call onAfterRender and change default model without error
>
> whats the usecase?
>
> -igor
>
> On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>> I tried to do the following below but I got an error could not update
>> component hierarchy.
>> WicketMessage: Cannot modify component hierarchy after render phase
>> has started (page version cant change then anymore)
>>
>> Is there an event method (like onAfterRender) that I could use
>> without error?
>>
>> Component:
>>
>> onBeforeRender() {
>> ...
>> this.setDefaultModel(...);
>> }
>>
>> onAfterRender() {
>> this.setSetDefaultModel(...);
>> }
>>
>> Berlin Brown (POL)
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Call onAfterRender and change default model without error
Posted by Igor Vaynberg <ig...@gmail.com>.
not if your change of the flag results in change to the page version.
try setversioned(false) on your component, if that doesnt help then
store your state outside a model in a field or in metadata.
-igor
On Tue, Jan 25, 2011 at 11:41 AM, Brown, Berlin [GCG-PFS]
<Be...@primerica.com> wrote:
> "this still doesn't explain the need to switch it to disabled in onafterrender... "
>
> Because in my traffic light scenario, I want to return to the original state/value after the component has been rendered. If it were a traffic light, I guess once it turns red, it has to return to disabled.
>
> Is there an other type of event method that I could use to set a value, render the component and then return to the original value?
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 25, 2011 2:32 PM
> To: users@wicket.apache.org
> Subject: Re: Call onAfterRender and change default model without error
>
> this still doesnt explain the need to switch it to disabled in onafterrender...
>
> -igor
>
> On Tue, Jan 25, 2011 at 11:19 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>> Here is a use-case for my request below:
>>
>> Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component).
>>
>> WicketTrafficLight extends Panel {
>> WicketTrafficLight() {
>> super("trafficLight");
>> setDefaultModel(new Model<String>("EnabledLight"));
>> }
>>
>> onAfterRender() {
>> ...
>> setDefaultModel(new Model<String>("DisabledLight"));
>> }
>>
>> }
>>
>> Some Other Panel :
>>
>> addAjaxLink() {
>> onClick() {
>> setDefaultModel(new Model<String>("EnabledLight"));
>> }
>> }
>>
>> ...
>> <span wicket:id="trafficLight"></span>
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>> Sent: Tuesday, January 25, 2011 1:01 PM
>> To: users@wicket.apache.org
>> Subject: Re: Call onAfterRender and change default model without error
>>
>> you didnt answer my question
>>
>> -igor
>>
>> On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>>> If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
>>>
>>> onBeforeRender() {
>>> ...
>>> this.setDefaultModel(new ReadonlyStaticModel("state1"));
>>> }
>>>
>>> onAfterRender() {
>>> this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
>>> }
>>>
>>> I guess I could use the backing model object as opposed to the model to change the state.
>>> ... Changed to:
>>>
>>> onBeforeRender() {
>>> ...
>>> getDefaultModel().set("state1"));
>>> }
>>>
>>> onAfterRender() {
>>> getDefaultModel().set("state2"));
>>> }
>>>
>>>
>>> -----Original Message-----
>>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>>> Sent: Tuesday, January 25, 2011 12:40 PM
>>> To: users@wicket.apache.org
>>> Subject: Re: Call onAfterRender and change default model without
>>> error
>>>
>>> whats the usecase?
>>>
>>> -igor
>>>
>>> On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>>>> I tried to do the following below but I got an error could not
>>>> update component hierarchy.
>>>> WicketMessage: Cannot modify component hierarchy after render phase
>>>> has started (page version cant change then anymore)
>>>>
>>>> Is there an event method (like onAfterRender) that I could use
>>>> without error?
>>>>
>>>> Component:
>>>>
>>>> onBeforeRender() {
>>>> ...
>>>> this.setDefaultModel(...);
>>>> }
>>>>
>>>> onAfterRender() {
>>>> this.setSetDefaultModel(...);
>>>> }
>>>>
>>>> Berlin Brown (POL)
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Call onAfterRender and change default model without error
Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
"this still doesn't explain the need to switch it to disabled in onafterrender... "
Because in my traffic light scenario, I want to return to the original state/value after the component has been rendered. If it were a traffic light, I guess once it turns red, it has to return to disabled.
Is there an other type of event method that I could use to set a value, render the component and then return to the original value?
-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
Sent: Tuesday, January 25, 2011 2:32 PM
To: users@wicket.apache.org
Subject: Re: Call onAfterRender and change default model without error
this still doesnt explain the need to switch it to disabled in onafterrender...
-igor
On Tue, Jan 25, 2011 at 11:19 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
> Here is a use-case for my request below:
>
> Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component).
>
> WicketTrafficLight extends Panel {
> WicketTrafficLight() {
> super("trafficLight");
> setDefaultModel(new Model<String>("EnabledLight"));
> }
>
> onAfterRender() {
> ...
> setDefaultModel(new Model<String>("DisabledLight"));
> }
>
> }
>
> Some Other Panel :
>
> addAjaxLink() {
> onClick() {
> setDefaultModel(new Model<String>("EnabledLight"));
> }
> }
>
> ...
> <span wicket:id="trafficLight"></span>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 25, 2011 1:01 PM
> To: users@wicket.apache.org
> Subject: Re: Call onAfterRender and change default model without error
>
> you didnt answer my question
>
> -igor
>
> On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>> If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
>>
>> onBeforeRender() {
>> ...
>> this.setDefaultModel(new ReadonlyStaticModel("state1"));
>> }
>>
>> onAfterRender() {
>> this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
>> }
>>
>> I guess I could use the backing model object as opposed to the model to change the state.
>> ... Changed to:
>>
>> onBeforeRender() {
>> ...
>> getDefaultModel().set("state1"));
>> }
>>
>> onAfterRender() {
>> getDefaultModel().set("state2"));
>> }
>>
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>> Sent: Tuesday, January 25, 2011 12:40 PM
>> To: users@wicket.apache.org
>> Subject: Re: Call onAfterRender and change default model without
>> error
>>
>> whats the usecase?
>>
>> -igor
>>
>> On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>>> I tried to do the following below but I got an error could not
>>> update component hierarchy.
>>> WicketMessage: Cannot modify component hierarchy after render phase
>>> has started (page version cant change then anymore)
>>>
>>> Is there an event method (like onAfterRender) that I could use
>>> without error?
>>>
>>> Component:
>>>
>>> onBeforeRender() {
>>> ...
>>> this.setDefaultModel(...);
>>> }
>>>
>>> onAfterRender() {
>>> this.setSetDefaultModel(...);
>>> }
>>>
>>> Berlin Brown (POL)
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Call onAfterRender and change default model without error
Posted by Igor Vaynberg <ig...@gmail.com>.
this still doesnt explain the need to switch it to disabled in onafterrender...
-igor
On Tue, Jan 25, 2011 at 11:19 AM, Brown, Berlin [GCG-PFS]
<Be...@primerica.com> wrote:
> Here is a use-case for my request below:
>
> Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component).
>
> WicketTrafficLight extends Panel {
> WicketTrafficLight() {
> super("trafficLight");
> setDefaultModel(new Model<String>("EnabledLight"));
> }
>
> onAfterRender() {
> ...
> setDefaultModel(new Model<String>("DisabledLight"));
> }
>
> }
>
> Some Other Panel :
>
> addAjaxLink() {
> onClick() {
> setDefaultModel(new Model<String>("EnabledLight"));
> }
> }
>
> ...
> <span wicket:id="trafficLight"></span>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 25, 2011 1:01 PM
> To: users@wicket.apache.org
> Subject: Re: Call onAfterRender and change default model without error
>
> you didnt answer my question
>
> -igor
>
> On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>> If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
>>
>> onBeforeRender() {
>> ...
>> this.setDefaultModel(new ReadonlyStaticModel("state1"));
>> }
>>
>> onAfterRender() {
>> this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
>> }
>>
>> I guess I could use the backing model object as opposed to the model to change the state.
>> ... Changed to:
>>
>> onBeforeRender() {
>> ...
>> getDefaultModel().set("state1"));
>> }
>>
>> onAfterRender() {
>> getDefaultModel().set("state2"));
>> }
>>
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>> Sent: Tuesday, January 25, 2011 12:40 PM
>> To: users@wicket.apache.org
>> Subject: Re: Call onAfterRender and change default model without error
>>
>> whats the usecase?
>>
>> -igor
>>
>> On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>>> I tried to do the following below but I got an error could not update
>>> component hierarchy.
>>> WicketMessage: Cannot modify component hierarchy after render phase
>>> has started (page version cant change then anymore)
>>>
>>> Is there an event method (like onAfterRender) that I could use
>>> without error?
>>>
>>> Component:
>>>
>>> onBeforeRender() {
>>> ...
>>> this.setDefaultModel(...);
>>> }
>>>
>>> onAfterRender() {
>>> this.setSetDefaultModel(...);
>>> }
>>>
>>> Berlin Brown (POL)
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Call onAfterRender and change default model without error
Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
Here is a use-case for my request below:
Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component).
WicketTrafficLight extends Panel {
WicketTrafficLight() {
super("trafficLight");
setDefaultModel(new Model<String>("EnabledLight"));
}
onAfterRender() {
...
setDefaultModel(new Model<String>("DisabledLight"));
}
}
Some Other Panel :
addAjaxLink() {
onClick() {
setDefaultModel(new Model<String>("EnabledLight"));
}
}
...
<span wicket:id="trafficLight"></span>
-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
Sent: Tuesday, January 25, 2011 1:01 PM
To: users@wicket.apache.org
Subject: Re: Call onAfterRender and change default model without error
you didnt answer my question
-igor
On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
> If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
>
> onBeforeRender() {
> ...
> this.setDefaultModel(new ReadonlyStaticModel("state1"));
> }
>
> onAfterRender() {
> this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
> }
>
> I guess I could use the backing model object as opposed to the model to change the state.
> ... Changed to:
>
> onBeforeRender() {
> ...
> getDefaultModel().set("state1"));
> }
>
> onAfterRender() {
> getDefaultModel().set("state2"));
> }
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 25, 2011 12:40 PM
> To: users@wicket.apache.org
> Subject: Re: Call onAfterRender and change default model without error
>
> whats the usecase?
>
> -igor
>
> On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>> I tried to do the following below but I got an error could not update
>> component hierarchy.
>> WicketMessage: Cannot modify component hierarchy after render phase
>> has started (page version cant change then anymore)
>>
>> Is there an event method (like onAfterRender) that I could use
>> without error?
>>
>> Component:
>>
>> onBeforeRender() {
>> ...
>> this.setDefaultModel(...);
>> }
>>
>> onAfterRender() {
>> this.setSetDefaultModel(...);
>> }
>>
>> Berlin Brown (POL)
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Call onAfterRender and change default model without error
Posted by Igor Vaynberg <ig...@gmail.com>.
you didnt answer my question
-igor
On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS]
<Be...@primerica.com> wrote:
> If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
>
> onBeforeRender() {
> ...
> this.setDefaultModel(new ReadonlyStaticModel("state1"));
> }
>
> onAfterRender() {
> this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
> }
>
> I guess I could use the backing model object as opposed to the model to change the state.
> ... Changed to:
>
> onBeforeRender() {
> ...
> getDefaultModel().set("state1"));
> }
>
> onAfterRender() {
> getDefaultModel().set("state2"));
> }
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 25, 2011 12:40 PM
> To: users@wicket.apache.org
> Subject: Re: Call onAfterRender and change default model without error
>
> whats the usecase?
>
> -igor
>
> On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
>> I tried to do the following below but I got an error could not update
>> component hierarchy.
>> WicketMessage: Cannot modify component hierarchy after render phase
>> has started (page version cant change then anymore)
>>
>> Is there an event method (like onAfterRender) that I could use without
>> error?
>>
>> Component:
>>
>> onBeforeRender() {
>> ...
>> this.setDefaultModel(...);
>> }
>>
>> onAfterRender() {
>> this.setSetDefaultModel(...);
>> }
>>
>> Berlin Brown (POL)
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: Call onAfterRender and change default model without error
Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model?
onBeforeRender() {
...
this.setDefaultModel(new ReadonlyStaticModel("state1"));
}
onAfterRender() {
this.setDefaultModel(new ReadonlyStaticModel("state2-reset"));
}
I guess I could use the backing model object as opposed to the model to change the state.
... Changed to:
onBeforeRender() {
...
getDefaultModel().set("state1"));
}
onAfterRender() {
getDefaultModel().set("state2"));
}
-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
Sent: Tuesday, January 25, 2011 12:40 PM
To: users@wicket.apache.org
Subject: Re: Call onAfterRender and change default model without error
whats the usecase?
-igor
On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
> I tried to do the following below but I got an error could not update
> component hierarchy.
> WicketMessage: Cannot modify component hierarchy after render phase
> has started (page version cant change then anymore)
>
> Is there an event method (like onAfterRender) that I could use without
> error?
>
> Component:
>
> onBeforeRender() {
> ...
> this.setDefaultModel(...);
> }
>
> onAfterRender() {
> this.setSetDefaultModel(...);
> }
>
> Berlin Brown (POL)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Call onAfterRender and change default model without error
Posted by Igor Vaynberg <ig...@gmail.com>.
whats the usecase?
-igor
On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS]
<Be...@primerica.com> wrote:
> I tried to do the following below but I got an error could not update
> component hierarchy.
> WicketMessage: Cannot modify component hierarchy after render phase has
> started (page version cant change then anymore)
>
> Is there an event method (like onAfterRender) that I could use without
> error?
>
> Component:
>
> onBeforeRender() {
> ...
> this.setDefaultModel(...);
> }
>
> onAfterRender() {
> this.setSetDefaultModel(...);
> }
>
> Berlin Brown (POL)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org