in case of enclosure none of the inconsistencies matej spoke off will be applicable because enclosure sets visibility only on component that are its direct children, so none of them have been rendered before the visibilty change. it also restores the visibility after the render is done.
this was mostly to appease the added-but-not-rendered debug check we have. if we didnt have that then the enclosure can simply skip its tag when not visible. -igor On Fri, Sep 25, 2009 at 6:31 AM, Juergen Donnerstag <[email protected]> wrote: > Take a look at Enclosure.java. Enclosure instances are created when > <wicket:enclosure> tag are detected in the markup during the render > phase. Enclosure.onComponentTag() than uses the "child"'s visibilty to > determine the enclosures visibility. But that of the body; the tag > <wicket:enclosure> should always be rendered. Thus moving the > visibility logic into onBeforeRender doesn't work either. > > It works today because we have so called auto-components which are > ignored for hierarchy checks. I'm currently working on using > IMarkupFragments for the render process and wanted to remove this > whole auto-component stuff. This is when I came across the hierarchy > check. > > Juergen > > On Fri, Sep 25, 2009 at 2:19 PM, Matej Knopp <[email protected]> wrote: >> the entire state change thing is bit out dated. >> Why do you need to change visibility during render? I think the >> problem here is possible inconsistency. If you hide component before >> it has been rendered it will not render. But if you hide it after >> nothing will change. >> >> -Matej >> >> On Thu, Sep 24, 2009 at 11:36 PM, Juergen Donnerstag >> <[email protected]> wrote: >>> Hi, >>> >>> question to the experts: If called during the render phase >>> Component.setVisible() will throw an exception saying "Cannot modify >>> component hierarchy after render phase has started (page version cant >>> change then anymore)"); >>> >>> That is because Component.setVisible() -> >>> Page.componentStateChanging(..) -> >>> versionManager.componentStateChanging(change), with >>> SecondLevelCachePageVersionManager being the default version manager >>> implementation. Its implementation of componentStateChanging() however >>> is empty. Thus it should actually be possible to make that change >>> during the render phase, correct? >>> >>> Is there anything I'm missing here? >>> >>> Thanks for your help >>> Juergen >>> >> >
