You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steve Eynon <st...@alienfactory.co.uk> on 2011/11/02 12:47:17 UTC

[T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Hiya,

I have this snippet of tml:

<t:loop source="1..10" value="var:i" t:mixins="loopMixin">
	${var:i}
</t:loop>

and this Mixin:

public class LoopMixin {
	void beginRender() {
		System.err.println("LoopMixin: @beginRender");
	}
	void afterRender() {
		System.err.println("LoopMixin: @afterRender");
	}
}

I see the beginRender method called 10 times but the afterRender
method is never called.

Is this a bug or is it defined Mixin behaviour? I was under the
impression Mixins should receive all component render phase events...?

Steve.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Here's the Jira to commit against:

https://issues.apache.org/jira/browse/TAP5-1742

I understand why returning false (and effectively cancelling the
render phase, e.g. setupRender) can be advantageous, but I can't think
of a use case where returning true "and" cancelling / short circuiting
the render phase is of any use...? What example am I missing?

Steve.


On 3 November 2011 12:42, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>
> Sounds good. I will try to do it today
>
> regards
> Taha
>
> On Nov 2, 2011, at 11:13 PM, Steve Eynon wrote:
>
>> Awesome, found it:
>>
>> http://tapestry.apache.org/component-rendering.html#ComponentRendering-ShortCircuiting
>>
>> I was thinking along these lines but wasn't sure what the exact
>> semantics of returning true / false was.
>>
>> Am I right in thinking the Jira would be:
>>
>> AfterRender() in Loop component should not short circuit - return
>> False and Null but not True.
>>
>>
>>
>> On 3 November 2011 01:17, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>>> Hi Steve
>>>
>>> Short Circuiting
>>> If a method returns a true or false value, this will short circuit processing. Other methods within the phase that would ordinarily be invoked will not be invoked.
>>>
>>> Most render phase methods should return void, to avoid unintentionally short circuiting other methods for the same phase.
>>>
>>>
>>> Seems like it deserves a jira.
>>>
>>> regards
>>> Taha
>>>
>>> On Nov 2, 2011, at 10:02 PM, Steve Eynon wrote:
>>>
>>>> Cheers Taha,
>>>>
>>>>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
>>>>
>>>> Ah, okay (thanks). So the Mixin should be called when Loop afterRender
>>>> method finally returns true ... but I'm not seeing it called at all,
>>>> not even once!?
>>>>
>>>>
>>>> P.S. Does this then mean that when using the @MixinAfter, the mixin's
>>>> "later render phase" events occur before the components?
>>>>
>>>>
>>>> (By the way, the MixinAfter docs just say, "Normally, mixins occur
>>>> before the component." but mentions nothing of the later phases.)
>>>>
>>>> Steve.
>>>>
>>>>
>>>> On 3 November 2011 00:02, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>>>>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Sounds good. I will try to do it today 

regards
Taha

On Nov 2, 2011, at 11:13 PM, Steve Eynon wrote:

> Awesome, found it:
> 
> http://tapestry.apache.org/component-rendering.html#ComponentRendering-ShortCircuiting
> 
> I was thinking along these lines but wasn't sure what the exact
> semantics of returning true / false was.
> 
> Am I right in thinking the Jira would be:
> 
> AfterRender() in Loop component should not short circuit - return
> False and Null but not True.
> 
> 
> 
> On 3 November 2011 01:17, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>> Hi Steve
>> 
>> Short Circuiting
>> If a method returns a true or false value, this will short circuit processing. Other methods within the phase that would ordinarily be invoked will not be invoked.
>> 
>> Most render phase methods should return void, to avoid unintentionally short circuiting other methods for the same phase.
>> 
>> 
>> Seems like it deserves a jira.
>> 
>> regards
>> Taha
>> 
>> On Nov 2, 2011, at 10:02 PM, Steve Eynon wrote:
>> 
>>> Cheers Taha,
>>> 
>>>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
>>> 
>>> Ah, okay (thanks). So the Mixin should be called when Loop afterRender
>>> method finally returns true ... but I'm not seeing it called at all,
>>> not even once!?
>>> 
>>> 
>>> P.S. Does this then mean that when using the @MixinAfter, the mixin's
>>> "later render phase" events occur before the components?
>>> 
>>> 
>>> (By the way, the MixinAfter docs just say, "Normally, mixins occur
>>> before the component." but mentions nothing of the later phases.)
>>> 
>>> Steve.
>>> 
>>> 
>>> On 3 November 2011 00:02, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>>>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Awesome, found it:

http://tapestry.apache.org/component-rendering.html#ComponentRendering-ShortCircuiting

I was thinking along these lines but wasn't sure what the exact
semantics of returning true / false was.

Am I right in thinking the Jira would be:

AfterRender() in Loop component should not short circuit - return
False and Null but not True.



On 3 November 2011 01:17, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
> Hi Steve
>
> Short Circuiting
> If a method returns a true or false value, this will short circuit processing. Other methods within the phase that would ordinarily be invoked will not be invoked.
>
> Most render phase methods should return void, to avoid unintentionally short circuiting other methods for the same phase.
>
>
> Seems like it deserves a jira.
>
> regards
> Taha
>
> On Nov 2, 2011, at 10:02 PM, Steve Eynon wrote:
>
>> Cheers Taha,
>>
>>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
>>
>> Ah, okay (thanks). So the Mixin should be called when Loop afterRender
>> method finally returns true ... but I'm not seeing it called at all,
>> not even once!?
>>
>>
>> P.S. Does this then mean that when using the @MixinAfter, the mixin's
>> "later render phase" events occur before the components?
>>
>>
>> (By the way, the MixinAfter docs just say, "Normally, mixins occur
>> before the component." but mentions nothing of the later phases.)
>>
>> Steve.
>>
>>
>> On 3 November 2011 00:02, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Hi Steve

Short Circuiting
If a method returns a true or false value, this will short circuit processing. Other methods within the phase that would ordinarily be invoked will not be invoked.

Most render phase methods should return void, to avoid unintentionally short circuiting other methods for the same phase.


Seems like it deserves a jira. 

regards
Taha

On Nov 2, 2011, at 10:02 PM, Steve Eynon wrote:

> Cheers Taha,
> 
>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
> 
> Ah, okay (thanks). So the Mixin should be called when Loop afterRender
> method finally returns true ... but I'm not seeing it called at all,
> not even once!?
> 
> 
> P.S. Does this then mean that when using the @MixinAfter, the mixin's
> "later render phase" events occur before the components?
> 
> 
> (By the way, the MixinAfter docs just say, "Normally, mixins occur
> before the component." but mentions nothing of the later phases.)
> 
> Steve.
> 
> 
> On 3 November 2011 00:02, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
>> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Cheers Taha,

> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.

Ah, okay (thanks). So the Mixin should be called when Loop afterRender
method finally returns true ... but I'm not seeing it called at all,
not even once!?


P.S. Does this then mean that when using the @MixinAfter, the mixin's
"later render phase" events occur before the components?


(By the way, the MixinAfter docs just say, "Normally, mixins occur
before the component." but mentions nothing of the later phases.)

Steve.


On 3 November 2011 00:02, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
> in the later phases (AfterRender, CleanupRender) the order of executing is reversed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Render Phase Ordering
All mixins for a component execute their render phase methods before the component's render phase methods for most phases. However, in the later phases (AfterRender, CleanupRender) the order of executing is reversed.

So if afterRender() of loop skips it, it never reaches the the mixin

regards
Taha

On Nov 2, 2011, at 9:22 PM, Steve Eynon wrote:

> T5.3-rc-2 has the same behaviour.
> 
> Can someone tell me I'm not crazy and that I *should* see the
> afterRender event firing? Or am I just missing something fundamental?
> 
> I know the Loop component uses afterRender to return true / false to
> perform the loop, but I would still expect the Mixin render phase
> event to fire... or is this not the case?
> 
> Steve.
> 
> On 2 November 2011 19:47, Steve Eynon <st...@alienfactory.co.uk> wrote:
>> Hiya,
>> 
>> I have this snippet of tml:
>> 
>> <t:loop source="1..10" value="var:i" t:mixins="loopMixin">
>>        ${var:i}
>> </t:loop>
>> 
>> and this Mixin:
>> 
>> public class LoopMixin {
>>        void beginRender() {
>>                System.err.println("LoopMixin: @beginRender");
>>        }
>>        void afterRender() {
>>                System.err.println("LoopMixin: @afterRender");
>>        }
>> }
>> 
>> I see the beginRender method called 10 times but the afterRender
>> method is never called.
>> 
>> Is this a bug or is it defined Mixin behaviour? I was under the
>> impression Mixins should receive all component render phase events...?
>> 
>> Steve.
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


Re: [T5.2.6] AfterRender phase method not called on Mixin when attached to Loop component

Posted by Steve Eynon <st...@alienfactory.co.uk>.
T5.3-rc-2 has the same behaviour.

Can someone tell me I'm not crazy and that I *should* see the
afterRender event firing? Or am I just missing something fundamental?

I know the Loop component uses afterRender to return true / false to
perform the loop, but I would still expect the Mixin render phase
event to fire... or is this not the case?

Steve.

On 2 November 2011 19:47, Steve Eynon <st...@alienfactory.co.uk> wrote:
> Hiya,
>
> I have this snippet of tml:
>
> <t:loop source="1..10" value="var:i" t:mixins="loopMixin">
>        ${var:i}
> </t:loop>
>
> and this Mixin:
>
> public class LoopMixin {
>        void beginRender() {
>                System.err.println("LoopMixin: @beginRender");
>        }
>        void afterRender() {
>                System.err.println("LoopMixin: @afterRender");
>        }
> }
>
> I see the beginRender method called 10 times but the afterRender
> method is never called.
>
> Is this a bug or is it defined Mixin behaviour? I was under the
> impression Mixins should receive all component render phase events...?
>
> Steve.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org