That's why I used the terminology onWire() as opposed to onAdd(). My
point was that you should shift the burden of isInitialized() away from
the end-user over to Wicket. When a component's ancestors (all the way
up to the top-most component) are connected the first time or changed at
some later time Wicket invokes onWire(), at which point the component
modifies its state accordingly. This behavior differs from onAttach() in
that the latter assumes that wiring will always take place at render
time. onWire() allows you to do the wiring either shortly after
construction time or at render-time depending on whether all ancestors
have been defined or not.

        It guarantees that errors will be thrown as soon as technically 
possible.

Gili

Eelco Hillenius wrote:
> The problem with that is that the 2.0 constructor actually forced the
> whole parent hierarchy to be in place, while add in 1.x just means it
> is added to the parent without any guarantee the parent is added to
> the parent yet. So even if we would provide onWire (though onAdd would
> be better then) it wouldn't be safe to do things like getMarkupId.
> onAttach is safe for that, as by then the rendering phase is reached.
> 
> Eelco
> 
> 
> On 3/8/07, cowwoc <[EMAIL PROTECTED]> wrote:
>>         Alternatively:
>>
>> 1) Components are POJOs. Users can define whatever constructor they want.
>>
>> 2) Users always use add() to associate a parent with a component but you
>> move the component wiring out of the constructor and into a onWire()
>> method. Now, whenever the hierarchy/parent changes onWire() gets
>> invoked. So components with dynamic hierarchies get onWire() once per
>> rendering whereas components with static hierarchies only have this
>> method invoked once. Users can then remove isInitialized() so long as
>> they invoke their methods from inside onWire().
>>
>> Gili
>>
>> Eelco Hillenius wrote:
>>>>         How about a hybrid system?
>>>>
>>>>         Is there a clear-cut way to know up-front which components have an
>>>> immutable parent versus others that might require it to change during
>>>> rendering time? If so, couldn't you require the use of constructors that
>>>> take a parent for components whose parents are immutable and then for
>>>> all other components use the add() paradigm?
>>> The largest problem with that would be that it would be inconsistent
>>> for users. So apart from whether this is achievable, I wouldn't like
>>> it as it would be too confusing.
>>>
>>> Eelco
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>>> opinions on IT & business topics through brief surveys-and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> Wicket-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>
>>
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to