The way I do it, is this:

protected void onBeforeRender() {
    //my init code
    super.onBeforeRender();
}

I think it can be documented in the javadoc, that it is mandatory to call
super at the end.
User can also have a problem if just override the onBeforeRender without
calling the super. 

I think, there is a lack of another life-cycle method which would not force
user to call super. Something like the below:

protected void onBeforeRender() {
    onBeforeRenderCalled()
    super.onBeforeRender();
}

where 
onBeforeRenderCalled()
is an empty method which would allow user to add his init logic.

Alex.

 


igor.vaynberg wrote:
> 
> the reason for it being final is that the super.onbeforerender() call HAS
> to
> be done last, otherwise new items do not get onbeforerender called on
> them.
> 
> so if we remove final will you remember to always call it last? i think
> the
> chances are that are pretty small, thus its final.
> 
> -igor
> 
> 
> On 9/6/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
>>
>>
>> I've grabbed the latest SNAPSHOT from the repository and have noticed
>> that
>> AbstractRepeater#onBeforeRender is final. I wonder what is the reason for
>> this? (I need to do something in it's subclass)
>>         /**
>>          * @see org.apache.wicket.Component#onBeforeRender()
>>          */
>>         protected final void onBeforeRender()
>>         {
>>                 if (isVisibleInHierarchy())
>>                 {
>>                         onPopulate();
>>                 }
>>                 super.onBeforeRender();
>>         }
>>
>> Alex
>> --
>> View this message in context:
>> http://www.nabble.com/Why-the-AbstractRepeater-onBeforeRender-is-final-wicket-1.3.0-SNAPSHOT-%286-sept-2007%29--tf4391492.html#a12520558
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-the-AbstractRepeater-onBeforeRender-is-final-wicket-1.3.0-SNAPSHOT-%286-sept-2007%29--tf4391492.html#a12524545
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to