You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jan Vermeulen <ja...@isencia.com> on 2007/05/08 17:24:29 UTC

Backporting from 2.0: onAttach() or beforeRender() ?

In the former 2.0, we created components within a repeater in the onAttach()
method (during rendering, no changes to the component graph were allowed).
And as I see, that's also what the Wicket ListView did.

In the current trunk, things have changed, so we can no longer create these
components in onAttach() (one reason is that during resolve, onAttach() is
called on the resolved page). Looking at the new code of ListView, it seems
that beforeRender() is the right place to create these components.

But then there is another problem: Page:renderPage() and
Component:renderComponent() call isActionAuthorized(RENDER) BEFORE the call
to beforeRender(). That means that this authorization is no longer called
for any components created during the beforeRender() ! In the former 2.0, it
was because it is called after the onAttach().

I saw this comment in the code of Component:renderComponent():
	// check authorization
	// first the component itself
	// (after attach as otherwise list views etc wont work)
	setRenderAllowed(isActionAuthorized(RENDER));
Since there is no longer onAttach() logic in the ListView, I do not
understand the comment, unless it means that the intention is to call the
authorization on the dynamically created components of the listView. In that
case, that has stopped working.

So the question is: is it correct that the authorization is checked before
the call to beforeRender() ? In that case, we should call the authorization
ourselves on the components created in beforeRender(). And maybe ListView
should do the same. Or is this a bug ?

Jan.
-- 
View this message in context: http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10377931
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Backporting from 2.0: onAttach() or beforeRender() ?

Posted by Johan Compagner <jc...@gmail.com>.
done

On 5/8/07, Jan Vermeulen <ja...@isencia.com> wrote:
>
>
>
> Johan Compagner wrote:
> >
> > onBeforeRender call moved a few lines above
> > So that it is on the same place onAttach() was
> > So before the authorization check
> >
> > johan
> >
>
> Yes, I saw that in the code. Thanks a lot.
> But can it be changed in Component:renderComponent() too ?
>
> Jan.
>
> --
> View this message in context:
> http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10379393
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>

Re: Backporting from 2.0: onAttach() or beforeRender() ?

Posted by Jan Vermeulen <ja...@isencia.com>.

Johan Compagner wrote:
> 
> onBeforeRender call moved a few lines above
> So that it is on the same place onAttach() was
> So before the authorization check
> 
> johan
> 

Yes, I saw that in the code. Thanks a lot.
But can it be changed in Component:renderComponent() too ?

Jan.

-- 
View this message in context: http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10379393
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Backporting from 2.0: onAttach() or beforeRender() ?

Posted by Johan Compagner <jc...@gmail.com>.
onBeforeRender call moved a few lines above
So that it is on the same place onAttach() was
So before the authorization check

johan


On 5/8/07, Jan Vermeulen <ja...@isencia.com> wrote:
>
>
>
> Johan Compagner wrote:
> >
> > i moved it up (where attach was)
> >
>
> Sorry, can you explain a bit ? What did you move up ?
>
> Jan.
> --
> View this message in context:
> http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10378315
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>

Re: Backporting from 2.0: onAttach() or beforeRender() ?

Posted by Jan Vermeulen <ja...@isencia.com>.

Johan Compagner wrote:
> 
> i moved it up (where attach was)
> 

Sorry, can you explain a bit ? What did you move up ?

Jan.
-- 
View this message in context: http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10378315
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Backporting from 2.0: onAttach() or beforeRender() ?

Posted by Jan Vermeulen <ja...@isencia.com>.

Johan Compagner wrote:
> 
> i moved it up (where attach was)
> 

I see, you changed it in Page.
Can it be changed in Component:renderComponent() too ? (counterpart for ajax
rendering)

Jan.
-- 
View this message in context: http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10378350
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Backporting from 2.0: onAttach() or beforeRender() ?

Posted by Johan Compagner <jc...@gmail.com>.
i moved it up (where attach was)

On 5/8/07, Jan Vermeulen <ja...@isencia.com> wrote:
>
>
> In the former 2.0, we created components within a repeater in the
> onAttach()
> method (during rendering, no changes to the component graph were allowed).
> And as I see, that's also what the Wicket ListView did.
>
> In the current trunk, things have changed, so we can no longer create
> these
> components in onAttach() (one reason is that during resolve, onAttach() is
> called on the resolved page). Looking at the new code of ListView, it
> seems
> that beforeRender() is the right place to create these components.
>
> But then there is another problem: Page:renderPage() and
> Component:renderComponent() call isActionAuthorized(RENDER) BEFORE the
> call
> to beforeRender(). That means that this authorization is no longer called
> for any components created during the beforeRender() ! In the former 2.0,
> it
> was because it is called after the onAttach().
>
> I saw this comment in the code of Component:renderComponent():
>         // check authorization
>         // first the component itself
>         // (after attach as otherwise list views etc wont work)
>         setRenderAllowed(isActionAuthorized(RENDER));
> Since there is no longer onAttach() logic in the ListView, I do not
> understand the comment, unless it means that the intention is to call the
> authorization on the dynamically created components of the listView. In
> that
> case, that has stopped working.
>
> So the question is: is it correct that the authorization is checked before
> the call to beforeRender() ? In that case, we should call the
> authorization
> ourselves on the components created in beforeRender(). And maybe ListView
> should do the same. Or is this a bug ?
>
> Jan.
> --
> View this message in context:
> http://www.nabble.com/Backporting-from-2.0%3A-onAttach%28%29-or-beforeRender%28%29---tf3710300.html#a10377931
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>