You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Blower, Andy" <An...@proquest.co.uk> on 2008/09/09 12:08:15 UTC

T5: Event bubbling

I'm trying to handle an event in a parent component of one that fires the event and it doesn't seem to work unless it's a generic catch all event handler like onAction(). If I specify the component id like onActionFromThing() or specifying component="thing" in an OnEvent annotation it doesn't catch the event from the child component in the parent component. I've scoured the T5 documentation, but I can't find any details on how to do this.

Can anyone help me with this?

RE: T5: Event bubbling

Posted by "Blower, Andy" <An...@proquest.co.uk>.
That's how I've been dealing with this scenario up til today, but this event is fired from a form submission so I can't change the event name. Well I don't think I can any way. ;-)

And thank you Howard for your explanation. That's fine, I don't think it's a big deal. I do still think it'd be great to cut and paste one of your explanations of this to the event bubbling section of the docs...

Cheers guys.

> -----Original Message-----
> From: joshcanfield@gmail.com [mailto:joshcanfield@gmail.com] On Behalf
> Of Josh Canfield
> Sent: 09 September 2008 18:45
> To: Tapestry users
> Subject: Re: T5: Event bubbling
>
> I think the best practice here is to create your own events, that way
> you
> don't have to build dependencies on child components internal
> structure.
> Your subcomponent would catch the events from it's dependencies and
> translate them to events that it exposes.
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/Compo
> nentResourcesCommon.html
> triggerEvent or triggerContextEvent
>
> Josh
>
> On Tue, Sep 9, 2008 at 3:32 AM, Blower, Andy
> <An...@proquest.co.uk>wrote:
>
> > I found the answer by searching the list (see:
> > http://markmail.org/message/fjev6gt76fpc6akq) but I think the T5
> > documentation should be updated to include these details.
> >
> > I also wonder if allowing more specificity would be useful as an
> option
> > even if it did mean that changes in the child component could break
> event
> > handlers in the parent. What I'm thinking of is allowing
> > @OnEvent(component="childcomponentid.eventfiringcomponentid") as an
> option.
> > Not sure how this could be expressed in a method name convention, but
> that's
> > not necessary for this IMHO.
> >
> > Now I'll wait for Howard to tell me an obvious reason this can't be
> done
> > that'll make me feel silly... lol
> >
> > Andy.
> >
> > > -----Original Message-----
> > > From: Blower, Andy
> > > Sent: 09 September 2008 11:08
> > > To: 'Tapestry users'
> > > Subject: T5: Event bubbling
> > >
> > > I'm trying to handle an event in a parent component of one that
> fires
> > > the event and it doesn't seem to work unless it's a generic catch
> all
> > > event handler like onAction(). If I specify the component id like
> > > onActionFromThing() or specifying component="thing" in an OnEvent
> > > annotation it doesn't catch the event from the child component in
> the
> > > parent component. I've scoured the T5 documentation, but I can't
> find
> > > any details on how to do this.
> > >
> > > Can anyone help me with this?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.

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


Re: T5: Event bubbling

Posted by Josh Canfield <jo...@thedailytube.com>.
I think the best practice here is to create your own events, that way you
don't have to build dependencies on child components internal structure.
Your subcomponent would catch the events from it's dependencies and
translate them to events that it exposes.
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ComponentResourcesCommon.html
triggerEvent or triggerContextEvent

Josh

On Tue, Sep 9, 2008 at 3:32 AM, Blower, Andy
<An...@proquest.co.uk>wrote:

> I found the answer by searching the list (see:
> http://markmail.org/message/fjev6gt76fpc6akq) but I think the T5
> documentation should be updated to include these details.
>
> I also wonder if allowing more specificity would be useful as an option
> even if it did mean that changes in the child component could break event
> handlers in the parent. What I'm thinking of is allowing
> @OnEvent(component="childcomponentid.eventfiringcomponentid") as an option.
> Not sure how this could be expressed in a method name convention, but that's
> not necessary for this IMHO.
>
> Now I'll wait for Howard to tell me an obvious reason this can't be done
> that'll make me feel silly... lol
>
> Andy.
>
> > -----Original Message-----
> > From: Blower, Andy
> > Sent: 09 September 2008 11:08
> > To: 'Tapestry users'
> > Subject: T5: Event bubbling
> >
> > I'm trying to handle an event in a parent component of one that fires
> > the event and it doesn't seem to work unless it's a generic catch all
> > event handler like onAction(). If I specify the component id like
> > onActionFromThing() or specifying component="thing" in an OnEvent
> > annotation it doesn't catch the event from the child component in the
> > parent component. I've scoured the T5 documentation, but I can't find
> > any details on how to do this.
> >
> > Can anyone help me with this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5: Event bubbling

Posted by Howard Lewis Ship <hl...@gmail.com>.
Just technical reasons inside Tapestry.  I still feel, strongly, that
an event that bubbles up should not expose the originating component.

For those following from the sidelines:

P --> A --> B

Page P contains component A which contains component B.

An action event is triggered on B.

A sees the event as originating in B.

If it bubbles up, P will see the event as originating (somewhere in) A.

Instead, I see the containing component as responsible for capturing
and rethrowing the event ... but currently, that turns into an endless
loop!

On Tue, Sep 9, 2008 at 3:32 AM, Blower, Andy
<An...@proquest.co.uk> wrote:
> I found the answer by searching the list (see: http://markmail.org/message/fjev6gt76fpc6akq) but I think the T5 documentation should be updated to include these details.
>
> I also wonder if allowing more specificity would be useful as an option even if it did mean that changes in the child component could break event handlers in the parent. What I'm thinking of is allowing @OnEvent(component="childcomponentid.eventfiringcomponentid") as an option. Not sure how this could be expressed in a method name convention, but that's not necessary for this IMHO.
>
> Now I'll wait for Howard to tell me an obvious reason this can't be done that'll make me feel silly... lol
>
> Andy.
>
>> -----Original Message-----
>> From: Blower, Andy
>> Sent: 09 September 2008 11:08
>> To: 'Tapestry users'
>> Subject: T5: Event bubbling
>>
>> I'm trying to handle an event in a parent component of one that fires
>> the event and it doesn't seem to work unless it's a generic catch all
>> event handler like onAction(). If I specify the component id like
>> onActionFromThing() or specifying component="thing" in an OnEvent
>> annotation it doesn't catch the event from the child component in the
>> parent component. I've scoured the T5 documentation, but I can't find
>> any details on how to do this.
>>
>> Can anyone help me with this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


RE: T5: Event bubbling

Posted by "Blower, Andy" <An...@proquest.co.uk>.
I found the answer by searching the list (see: http://markmail.org/message/fjev6gt76fpc6akq) but I think the T5 documentation should be updated to include these details.

I also wonder if allowing more specificity would be useful as an option even if it did mean that changes in the child component could break event handlers in the parent. What I'm thinking of is allowing @OnEvent(component="childcomponentid.eventfiringcomponentid") as an option. Not sure how this could be expressed in a method name convention, but that's not necessary for this IMHO.

Now I'll wait for Howard to tell me an obvious reason this can't be done that'll make me feel silly... lol

Andy.

> -----Original Message-----
> From: Blower, Andy
> Sent: 09 September 2008 11:08
> To: 'Tapestry users'
> Subject: T5: Event bubbling
>
> I'm trying to handle an event in a parent component of one that fires
> the event and it doesn't seem to work unless it's a generic catch all
> event handler like onAction(). If I specify the component id like
> onActionFromThing() or specifying component="thing" in an OnEvent
> annotation it doesn't catch the event from the child component in the
> parent component. I've scoured the T5 documentation, but I can't find
> any details on how to do this.
>
> Can anyone help me with this?

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