Re: beforeRender() - Cannot modify component hierarchy during render phase?
what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: beforeRender() - Cannot modify component hierarchy during render phase?
Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: beforeRender() - Cannot modify component hierarchy during render phase?
don't override beforeRender, but *onBeforeRender* Martijn On 11/9/07, William Hoover [EMAIL PROTECTED] wrote: Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: beforeRender() - Cannot modify component hierarchy during render phase?
I am affraid you can't modify a component from a behavior before render. Unline onBeforeRender in component, the behavior's beforeRender is called right before component rendering, i.e. during the rendering process. In the next verion we will probably rename the before/afterRender methods in behavior and add onBefore/after render method consistent with component's onBeforeRender/onAfterRender. -Matej On Nov 9, 2007 5:06 PM, William Hoover [EMAIL PROTECTED] wrote: Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: beforeRender() - Cannot modify component hierarchy during render phase?
Ah, this is about behaviors... never mind. /me crawls back in the hole called book writing On 11/9/07, Martijn Dashorst [EMAIL PROTECTED] wrote: don't override beforeRender, but *onBeforeRender* Martijn On 11/9/07, William Hoover [EMAIL PROTECTED] wrote: Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/ -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: beforeRender() - Cannot modify component hierarchy during render phase?
Is there any way that to dynamically update a StringResourceModel? -Original Message- From: Matej Knopp [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 11:11 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? I am affraid you can't modify a component from a behavior before render. Unline onBeforeRender in component, the behavior's beforeRender is called right before component rendering, i.e. during the rendering process. In the next verion we will probably rename the before/afterRender methods in behavior and add onBefore/after render method consistent with component's onBeforeRender/onAfterRender. -Matej On Nov 9, 2007 5:06 PM, William Hoover [EMAIL PROTECTED] wrote: Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: beforeRender() - Cannot modify component hierarchy during render phase?
changet the model value itself. instead of setting a new model On Nov 9, 2007 5:30 PM, William Hoover [EMAIL PROTECTED] wrote: Is there any way that to dynamically update a StringResourceModel? -Original Message- From: Matej Knopp [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 11:11 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? I am affraid you can't modify a component from a behavior before render. Unline onBeforeRender in component, the behavior's beforeRender is called right before component rendering, i.e. during the rendering process. In the next verion we will probably rename the before/afterRender methods in behavior and add onBefore/after render method consistent with component's onBeforeRender/onAfterRender. -Matej On Nov 9, 2007 5:06 PM, William Hoover [EMAIL PROTECTED] wrote: Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: beforeRender() - Cannot modify component hierarchy during render phase?
Gottcha... works (see below), Thanks Johan! new AbstractBehavior(){ @Override public final void beforeRender(Component component) { component.getModel().setObject(new StringResourceModel(getResourceKey(), refComponent, null).getString()); } } -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 11:39 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? changet the model value itself. instead of setting a new model On Nov 9, 2007 5:30 PM, William Hoover [EMAIL PROTECTED] wrote: Is there any way that to dynamically update a StringResourceModel? -Original Message- From: Matej Knopp [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 11:11 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? I am affraid you can't modify a component from a behavior before render. Unline onBeforeRender in component, the behavior's beforeRender is called right before component rendering, i.e. during the rendering process. In the next verion we will probably rename the before/afterRender methods in behavior and add onBefore/after render method consistent with component's onBeforeRender/onAfterRender. -Matej On Nov 9, 2007 5:06 PM, William Hoover [EMAIL PROTECTED] wrote: Its 1.3.0-beta4 Is it still an issue? -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 10:15 AM To: users@wicket.apache.org Subject: Re: beforeRender() - Cannot modify component hierarchy during render phase? what version of wicket is that code? I guess 1.2? then you should use onAttach() because onBeforeRender you can't change anything anymore because the page is already rendering. johan On Nov 9, 2007 4:00 PM, William Hoover [EMAIL PROTECTED] wrote: I'm curious if my approach is incorrect when implementing AbstractBehaviour and changing the model before it renders? Seems odd that I'm getting an exception stating that I cannot modify a component hierarchy during render phase when overriding the beforeRender method... am I missing something here? public final void beforeRender(Component component) { component.setModel(new StringResourceModel( some.resource, refComponent, null)); } org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase at org.apache.wicket.Component.checkHierarchyChange(Component.java :2931) at org.apache.wicket.Component.addStateChange(Component.java:2863) at org.apache.wicket.Component.setModel(Component.java:2436) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]