Re: Cannot modify component hierarchy after render phase has started
Hello Martin, okay, it was a misunderstanding. I will file a new issue and attach the quickstart. Cheers, Dirk -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711p4676766.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cannot modify component hierarchy after render phase has started
Hi Dirk, I think Sven said that this is a bug (caused most probably by the support for queueing components). Please file a bug report in JIRA and attach the quickstart app. Thank you! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Jan 16, 2017 at 7:47 AM, Dirk Forchel wrote: > Sven Meier wrote > > problem is that TestPanel.onConfigure() is called during render phase > > only, while in 7.4 it was (correctly) called in #beforeRender() (where > > hierarchy changes are still allowed). > > Hi Sven, > to be honest I didn't get it. Livecycle stages of a component are > "initializing", "rendering" and "removing", where hook methods involved > are: > > Initialization: /onInitialize/ > Rendering (sorted by execution order): /onConfigure/, /onBeforeRender/, > /onRender/, /onComponentTag/, o/nComponentTagBody/, > /onAfterRenderChildren/, > /onAfterRender/ > Removing: /onRemove/ > > The /onConfigure/ method is a good point to manage the component states > such > as its visibility. This method is called before the render phase starts. I > assume, changing children hierarchy is still allowed. But we're trying to > change the model object of a component, which, in my point of view, is > completely different from changing the children hierarchy > (/isVisibilityAllowed/ or /isEnabledAllowed/ is not called). > > The /onBeforeRender/ method is called after the /onConfigure/ method. This > method is called before a component starts its rendering phase and would be > the last chance to change its children hierarchy. But we don't do so. > > So why it is not allowed to change the model object of a panel which is a > child of a border component? > We're doing this in our application at least since Wicket 1.5. > > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/Cannot-modify-component-hierarchy-after- > render-phase-has-started-tp4676711p4676760.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Cannot modify component hierarchy after render phase has started
Sven Meier wrote > problem is that TestPanel.onConfigure() is called during render phase > only, while in 7.4 it was (correctly) called in #beforeRender() (where > hierarchy changes are still allowed). Hi Sven, to be honest I didn't get it. Livecycle stages of a component are "initializing", "rendering" and "removing", where hook methods involved are: Initialization: /onInitialize/ Rendering (sorted by execution order): /onConfigure/, /onBeforeRender/, /onRender/, /onComponentTag/, o/nComponentTagBody/, /onAfterRenderChildren/, /onAfterRender/ Removing: /onRemove/ The /onConfigure/ method is a good point to manage the component states such as its visibility. This method is called before the render phase starts. I assume, changing children hierarchy is still allowed. But we're trying to change the model object of a component, which, in my point of view, is completely different from changing the children hierarchy (/isVisibilityAllowed/ or /isEnabledAllowed/ is not called). The /onBeforeRender/ method is called after the /onConfigure/ method. This method is called before a component starts its rendering phase and would be the last chance to change its children hierarchy. But we don't do so. So why it is not allowed to change the model object of a panel which is a child of a border component? We're doing this in our application at least since Wicket 1.5. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711p4676760.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cannot modify component hierarchy after render phase has started
Hi Dirk, problem is that TestPanel.onConfigure() is called during render phase only, while in 7.4 it was (correctly) called in #beforeRender() (where hierarchy changes are still allowed). So I assume this is caused by WICKET-6216, component queuing might be involved. Regards Sven Stacktrace 7.5.0 org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) at org.apache.wicket.Component.checkHierarchyChange(Component.java:3674) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Page.dirty(Page.java:271) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:332) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Page.dirty(Page.java:250) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Page.componentModelChanging(Page.java:904) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.modelChanging(Component.java:2230) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.setDefaultModelObject(Component.java:3133) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1579) ~[wicket-core-7.5.0.jar:7.5.0] at com.mycompany.front.wicket.components.TestPanel.onConfigure(TestPanel.java:30) ~[classes/:?] at org.apache.wicket.Component.configure(Component.java:1069) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalBeforeRender(Component.java:954) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.beforeRender(Component.java:1031) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1836) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.onBeforeRender(Component.java:3928) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalBeforeRender(Component.java:963) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.beforeRender(Component.java:1031) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalPrepareForRender(Component.java:2248) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.render(Component.java:2337) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1526) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1729) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1704) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1659) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:517) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalRenderComponent(Component.java:2613) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1668) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onRender(Border.java:527) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalRender(Component.java:2413) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.render(Component.java:2341) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1526) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1729) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1704) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1659) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalRenderComponent(Component.java:2613) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1668) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.internalRender(Component.java:2413) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.Component.render(Component.java:2341) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1526) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1729) ~[wicket-core-7.5.0.jar:7.5.0] at org.apache.wicket.MarkupContainer.renderComponentTagBody(Marku
Re: Cannot modify component hierarchy after render phase has started
Hi Sven, attached you can find a quickstart which demonstrates the problem. I've added 3 test pages all with a TextField and a Panel with a TextField. For each component, the model object is set at the onConfigure method. At the first page both components are added to the page itself. At the second page both components are added to the border body container of a Border component. At the third page both components are added to a "Layout" container (a Border component too). With Wicket 7.4.0 all pages are rendered without any problem, with Wicket 7.5.0 the third page isn't. Instead the following exception is thrown: org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) at org.apache.wicket.Component.checkHierarchyChange(Component.java:3674) at org.apache.wicket.Page.dirty(Page.java:271) at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:332) at org.apache.wicket.Page.dirty(Page.java:250) at org.apache.wicket.Page.componentModelChanging(Page.java:904) at org.apache.wicket.Component.modelChanging(Component.java:2230) at org.apache.wicket.Component.setDefaultModelObject(Component.java:3133) at org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1579) at com.mycompany.front.wicket.components.TestPanel.onConfigure(TestPanel.java:30) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711p4676736.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cannot modify component hierarchy after render phase has started
Hi Sven, could it be that this belongs to https://issues.apache.org/jira/browse/WICKET-6303? I'm not sure, but after migrating to Wicket 7.5.0 we've got several errors belonging to this issue. I'll try to provide a quickstart though. Thanks, Dirk -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711p4676728.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cannot modify component hierarchy after render phase has started
Hi, a quick lock on a 7.4-7.5 diff didn't reveal any change that has something to do with checking the hierarchy. Could you provide a quickstart, so I can find the difference? Sven On 12.01.2017 08:56, Dirk Forchel wrote: Hi, I would like to know why we shouldn't change the model object within the configure phase for Wicket components. We're running our application with Wicket 7.4 and all works as expected. After migrating to Wicket 7.5 we get the following exception for different pages, mainly due to modifying the model object. Could someone explain why this is a bad thing to do? org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) at org.apache.wicket.Component.checkHierarchyChange(Component.java:3662) at org.apache.wicket.Page.dirty(Page.java:271) at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:332) at org.apache.wicket.Page.dirty(Page.java:250) at org.apache.wicket.Page.componentModelChanging(Page.java:904) at org.apache.wicket.Component.modelChanging(Component.java:2218) at org.apache.wicket.Component.setDefaultModelObject(Component.java:3121) at org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1579) at com.mycompany.wicket.components.TestPanel.onConfigure(TestPanel.java:111) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org