yep.  

one question:

i assume that some internal magic will attach any components
i add dynamically in onBeforeRender() in a second attachment 
phase.  this could be efficiently implemented by having MarkupContainer
add/replace/etc call an internal requestcycle method to add to a list if
onBeforeRender is being called and to throw an exception if attachment
phase has already happened and we're not in onBeforeRender.  then
we'd just traverse that list and attach each component after onBeforeRender 
returns but before actually rendering.

      jon


igor.vaynberg wrote:
> 
> i think if we expect 1.3 to be as long-lasting as we say it will be then
> we
> should bite the bullet and do this now because it will need to happen at
> some point anyway.
> 
> for end users this isnt so bad
> 1) move any code from onBeforeRender() to onAttach()
> 2) replace "protected void onAttach()" with "protected void
> onBeforeRender()"
> 3) replace "super.onAttach()" with "super.onBeforeRender()"
> then same for detach/afterrender
> 
> at least i think its as easy as that. we will have to do this to our
> codebase, so we should know if it will work or not and what the best way
> to
> do this is.
> 
> -igor
> 
> 
> On 4/14/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> see this issue: https://issues.apache.org/jira/browse/WICKET-4
>> some comment i make there:
>>
>> yes onAttach() and onBeforeRender is now purely for the render phase
>> (those
>> 2 methods are pretty much the same thing)
>>
>> onDetach() is called always so that models and components are detached
>> correctly.
>> And detach() must be called even if (the current) attach is not called
>> because of that.
>>
>> So when you submit a form and then respond/render to another page
>> the onAttach is not called for that page with that form. But detach is..
>>
>> I think this is wrong and i already have said i think on the user list
>> how
>> it should be: (last night i really needed that onattach anyway that i now
>> have found through IPageEntry...)
>>
>>
>> on submit request comes in respond to same page:
>>
>> Page.onAttach();
>> form.onSubmit();
>> Page.onBeginRender();
>> Page.render();
>> Page.onEndRender();
>> Page.onDetach();
>>
>>
>> on submit request comes in respond to another page:
>>
>> Page1.onAttach();
>> form.onSubmit();
>> Page2.onAttach();
>> Page2.onBeginRender();
>> Page2.render();
>> Page2.onEndRender();
>> Page2.onDetach();
>> Page.1onDetach();
>>
>> The problem is that this really breaks onAttach behavior..
>> because what is not onattach is then onbeforerender.
>> For example ListView builds up its new items in onattach that should be
>> done
>> then in onbefore render.
>> But we have a much nicer and better contract then when is what and we
>> have
>> a
>> callback method
>> when a page is used by wicket (when it comes out of the pagemap or when
>> it
>> is set/used as a response page)
>>
>> what do you guys think?
>>
>> johan
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Last-BIG-refactor%3A-onAttach-onBeforeRender-behavior-change-in-1.3-tf3577350.html#a10044135
Sent from the Wicket - Dev mailing list archive at Nabble.com.

Reply via email to