Mistake in Scenario #1. Read as: Good, but if A calculates isVisible = _FALSE_

2008/11/20 Marat Radchenko <[EMAIL PROTECTED]>:
> Hello, Wicket team and Wicket users.
>
> We broke our mind this week while trying to understand onBeforeRender 
> behavior.
>
> Scenario #1:
> Parent component A overrides onBeforeRender (and sets visibility
> there) and returns true from callOnBeforeRenderIfNotVisible. Child
> component B does the same. Then, onBeforeRender always happens on both
> components regardless any of them is visible or not.
> Good, but if A calculates isVisible = true then there it is impossible
> for component B to become visible (well, actually B could set
> visibility on A but this is very error-prone) so there's no point in
> invoking onBeforeRender because B won't be rendered.
>
> Scenario #2:
> Parent component A overrides isVisible (and sets visibility there).
> Child component B overrides isVisible too. Then B onBeforeRender will
> be called only if A is visible and B is visible.
> Good, no unnecessary job is done (B won't be processed at all when A
> is not visible).
>
> Scenario #3:
> Parent component A overrides onBeforeRender and
> callOnBeforeRenderIfNotVisible (and sets visibility there to FALSE).
> Child B doesn't override callOnBeforeRenderIfNotVisible and doesn't
> override isVisible. Then B's onBeforeRender will be called unless B is
> not visible.
>
> Scenario #4:
> Parent component A overrides isVisible and doesn't use
> callOnBeforeRenderIfNotVisible. Then, if it visible, all its children
> are recursively processed, otherwise no before/after rendering happens
> to them at all. Even if they override callOnBeforeRenderIfNotVisible.
> That's first confusing point. Javadocs on
> callOnBeforeRenderIfNotVisible promise us that onBeforeRender will be
> called even if component is not visible, but it is a lie.
> onBeforeRender will be called only if (component is visible OR
> callOnBeforeRenderIfNotVisible returns true) AND onBeforeRender was
> called on parent.
>
> Thoughts:
> 1) Javadocs on callOnBeforeRenderIfNotVisible are wrong. See above,
> there are conditions when onBeforeRender on B won't be called even if
> it returns true from callOnBeforeRenderIfNotVisible.
> 2) Child behavior depends on parent's.
> 3) There is no way to set isVisible to FALSE in parent component and
> avoid processing children (because Wicket requires calling
> super.onBeforeRender which processes children). I'm thinking about a
> feature request for this one.
>
> This all seems to be very complicated & confusing. I hope my analisys
> will help to invent better behavior.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to