We shouldnt call it onInitialize, onFirstRender is fine, onInitialize
looks like a really after constructor call to me, but it is called
much later, if it is called (onvisible checks and so on)

On 4/26/08, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> On Sat, Apr 26, 2008 at 4:17 AM, John Patterson <[EMAIL PROTECTED]> wrote:
> >
> >  Sorry, I did find a discussion which was related [1] which ended with
> Igor
> >  saying:
> >
> >  "yes, but its also easy to fix. Just don't call any overridible methods
> >  inside constructors. And for everything else there is onbeforerender()"
>
> this has come up more then a few times since we discussed it last, and
> i am willing to change my mind on this. I am willing to add an
> onInitialize() or onFirstRender() callback to Component. my big worry
> is that it will be severly abused by our users.
>
> so for example instead of just
>
> class mypanel extends panel {
>   public mypanel(string id, string foo) {
>     super(id);
>     add(new label("l", foo);
>   }
> }
>
> some users will start doing
>
> class mypanel extends panel {
>   private String foo;
>   public mypanel(string id, string foo) {
>     super(id);
>      this.foo=foo;
>   }
>   protected void onInitialize() {
>     add(new label("l", foo);
>   }
> }
>
> makes the code much uglier with plenty more room for abuse. what do
> others think?
>
> -igor
>
>
>
>
> >  [1]
> >
> http://www.nabble.com/Re%3A-Jira-issue-moved-to-the-list%3A-constructors-and-init-of-components-p13569575.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to