apparently some people also use it as a post-construct callback, which
sort of makes sense. for example, to call overridable factory methods,
which you cannot do from the constructor.

the solution is to delay all calls to oninitialize until just before
the very first call to onconfigure. i have mixed feelings about it
because essentially when instantiating a new page you get an
incomplete/lazy-initialized object and it is hard to have any useful
methods on it that configure it further.

-igor


On Tue, Feb 1, 2011 at 3:35 AM, Pedro Santos <pedros...@gmail.com> wrote:
> onInitialize is only there to provide an place on the component code where
> you can rely on a path to the page from the component. It is useless inside
> an page.
>
> On Tue, Feb 1, 2011 at 9:25 AM, tetsuo <ronald.tet...@gmail.com> wrote:
>
>> Overriding onInitialize() on Pages certainly may cause some problems,
>> if you mix adding components there and in constructors in the same
>> class hierarchy, but it will work with some care. I'm using
>> onInitialize() to build Pages, because, in the infrastructure already
>> built in a project I'm working on, I have to instantiate Pages to
>> determine if a link to it is enabled or not. I don't use its
>> 'construction', I don't need components. I just instantiate it to call
>> a method 'hasPermission()' on it.
>>
>> Well, please don't tell me I shouldn't do it, it works and works well.
>> The only problem is that in 1.5 the method is final on Pages. Is there
>> any workaround? Would you consider reverting this change? Or will I
>> have to stay with 1.4 forever?
>>
>> Tetsuo
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Reply via email to