but when you are inside something like a FormComponent you wouldnt
know right? only if you are something that has markup itself like a
page or a panel it will work in the constructor.

i think this would serve two purposes

a) it would allow all components to know their markup at the earliest
opportunity
b) it will serve as a one-time-init callback that some users prefer to
constructors

we do not need to store the markup fragment as a field because it will
mainly be used for initialization - so we can just pass it in

Component#onAttach(IMarkupFragment)

the contract is that onattach() is called on the component when the
markup is resolved and when the entire path to the page is available.
it is also called when the component is moved within the hierarchy.

i think such a feature will be very useful.

-igor

On Fri, Jun 19, 2009 at 10:25 AM, Juergen
Donnerstag<[email protected]> wrote:
> Not sure there is a need for it. You can call getMarkup() (==
> getParent().getMarkup(child)) any time. There is nothing like a markup
> variable with Component, hence no need to explicitly attach the markup
> fragment First I thought about it to improve speed and use it as
> temporary cache. But how and when do you clear it in case the locale,
> style or variation changes? We would need some notification system.
> And which Pages do you notify? Besides we would need these very ugly
> Component.set/getTemporaryMarkup() methods.
>
> Juergen
>
> On Wed, Jun 17, 2009 at 5:56 PM, Igor Vaynberg<[email protected]> wrote:
>> found it.
>>
>> WICKET-2238
>>
>> -igor
>>
>> On Wed, Jun 17, 2009 at 8:55 AM, Igor Vaynberg<[email protected]> 
>> wrote:
>>> there was a jira issue, cant find it right now, where we talked about
>>> having a callback that is basically
>>> Component#onMarkupResolved(IMarkupFragment) that would be called as
>>> soon as the markup is known and before render to allow component a
>>> chance to perform markup-specific initialization.
>>>
>>> i think that combined with this would be a very powerful feature.
>>>
>>> -igor
>>>
>>> On Wed, Jun 17, 2009 at 1:33 AM, Juergen
>>> Donnerstag<[email protected]> wrote:
>>>> Just to let know. I have a working copy of IMarkupFragment on my
>>>> computer. Except for IScopeComponent, all junit tests pass, some
>>>> examples still fail. It is based on current 1.4 trunk and allows to
>>>> get access to a components markup as soon as the parent container is
>>>> known. That means it is not available in the Components constructor,
>>>> but can be accessed via parent.getMarkup(child) before you do
>>>> parent.add(child).
>>>>
>>>> Today, a components markup is usually only available during the render 
>>>> process.
>>>>
>>>> For Page, Panel etc. it obviously is available in the constructor.
>>>>
>>>> Besides that it allows access to the markup much earlier, it will
>>>> allow us to change the render process from markup driven to component
>>>> driven which in turn will ease ajax development.
>>>>
>>>> Juergen
>>>>
>>>
>>
>

Reply via email to