You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by 9902468 <vi...@greenstreet.fi> on 2011/11/05 12:32:00 UTC

T5.3. rc3: event bubbling bug?

Hi,

T5.3 rc3:

I have a page, that has the following tml:

<t:modal t:id="dialog">
    <t:form t:id="productSizeForm" clientValidation="false">
        ....
    </form>
</t:modal>

And the modal component has the following contents:

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<div id="${id}" class="modal hide fade in" style="display:none;">
    <t:body />
</div>
</t:container>

I thought, that when the form is submitted, the modal component could listen
to onFailure + onSubmit events, but the events are never bubbled there? The
same methods work ok in the page class fine.

The method I'm using is

@OnEvent(value="failure")
public boolean onFailure() {
	return false;
}

Is this a bug, expected behaviour or what? I thought that the event should
bubble through the component hierarchy until aborted or the root is hit, but
this does not seem to be the case (anymore)?

I don't even know where to start looking, so any pointers are welcome. 

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4966490.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by 9902468 <vi...@greenstreet.fi>.
Furthermore, correct if I'm wrong, but the event bubbles through the
component hierarchy until the root component (page) or if the event bubbling
is explicitly aborted using event handler return value.
(http://tapestry.apache.org/component-events.html, see event bubbling.)

Thus the algorithm that checks if the event listener onMyEventFromX is
valid, it must go through whole component hierarchy and if it can find any
component with id X ("below" the component that declares the listener), the
resolution is successful?

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968863.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by 9902468 <vi...@greenstreet.fi>.
Ok,

so the event naming system changes the originating component to be the one
that is visible to the eventhandler writer. That makes sense.

Tested my use case and it works, thanks for setting me straight ;)

I closed the JIRA as invalid.

 - Ville
Ps. It has been a while since using T5 and it shows... :)

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4969263.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by Denis Stepanov <de...@gmail.com>.
If your hierarchy is:

> Page
> - MyComponent
>   - <t:form t:id="ProductSizeForm">


you should use onSuccessFromMyComponent, it is probably a bug if onSuccessFromProductSizeForm works inside the Page.

Denis

On 6.11.2011, at 17:35, 9902468 wrote:

> Ok, 
> 
> I think I confirmed this as a bug: if I disable the checking using 
> 
> configuration.add(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED,
> "false");
> 
> then my use case works ok, so my code is absolutely legit.
> 
> I have opened JIRA https://issues.apache.org/jira/browse/TAP5-1745 that
> should be IMHO be corrected before the 5.3 is released OR disable it by
> default. Otherwise every app will break that uses event bubbling..
> 
> Howard: as you implemented the original feature could you comment if this is
> right?
> 
> - Ville
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968931.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> 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.3. rc3: event bubbling bug?

Posted by 9902468 <vi...@greenstreet.fi>.
Ok, 

I think I confirmed this as a bug: if I disable the checking using 

configuration.add(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED,
"false");

then my use case works ok, so my code is absolutely legit.

I have opened JIRA https://issues.apache.org/jira/browse/TAP5-1745 that
should be IMHO be corrected before the 5.3 is released OR disable it by
default. Otherwise every app will break that uses event bubbling..

Howard: as you implemented the original feature could you comment if this is
right?

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968931.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by 9902468 <vi...@greenstreet.fi>.
The form is in the component.

This indicates that the events thrown by the components must be handled by
the component (or page) that declares the component throwing the event in
it's tml?

But how the event bubbling is going to work then?

My component should listen to the form events to be able to determine
whether 
a) success, everything ok, we can close the dialog
b) failure, not ok, let's keep the dialog open to show the errors

Form has perfect events for this, but the page containing the component
can't listen to those events due to the problem mentioned earlier. And my
Component can't listen for the events thrown by form that is declared in the
page, even if my component encloses the form. (The original topic of this
thread.)

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968826.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by Josh Canfield <jo...@gmail.com>.
Is the form in your page tml or the component tml? From your description it
sounds like it's not in the page, which is the error you are getting.
 On Nov 6, 2011 6:13 AM, "9902468" <vi...@greenstreet.fi> wrote:

> The saga continues:
>
> I have a "onSuccessFromProductSizeForm" -method on my page. When the form
> is
> enclosed in a component I get the following error message:
>
> Method
>
> com.orient.web.admin.pages.entity.ProductSizeBulkAdd.onSuccessFromProductSizeForm()
> references component id 'ProductSizeForm' which does not exist.
>
> So, I can't have event listeners anymore that listen to events thrown by
> components inside components?
>
> The hierarchy is this:
> Page
>  - MyComponent
>   - <t:form t:id="ProductSizeForm">...
>
> This is a bug in the "check that there is a component that can trigger the
> event that is listened by this method" routine I presume?
>
>  - Ville
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968614.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5.3. rc3: event bubbling bug?

Posted by Dimitris Zenios <di...@gmail.com>.
Sorry for the wrong reply.I havent read the whole list.

On Sun, Nov 6, 2011 at 5:05 PM, Dimitris Zenios
<di...@gmail.com> wrote:
> You can try this in the java page
>
> @InjectComponent(id="ProductSizeForm")
> private Form ProductSizeForm;
>
>
> @OnEvent(value=EventConstants=SUCCESS,component="ProductSizeForm")
> public void formSuccess() {
> }
>
> And in the tml leave it as it is and try again.
>
>
>
> On Sun, Nov 6, 2011 at 4:13 PM, 9902468 <vi...@greenstreet.fi> wrote:
>> The saga continues:
>>
>> I have a "onSuccessFromProductSizeForm" -method on my page. When the form is
>> enclosed in a component I get the following error message:
>>
>> Method
>> com.orient.web.admin.pages.entity.ProductSizeBulkAdd.onSuccessFromProductSizeForm()
>> references component id 'ProductSizeForm' which does not exist.
>>
>> So, I can't have event listeners anymore that listen to events thrown by
>> components inside components?
>>
>> The hierarchy is this:
>> Page
>>  - MyComponent
>>   - <t:form t:id="ProductSizeForm">...
>>
>> This is a bug in the "check that there is a component that can trigger the
>> event that is listened by this method" routine I presume?
>>
>>  - Ville
>>
>> --
>> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968614.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> 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.3. rc3: event bubbling bug?

Posted by Dimitris Zenios <di...@gmail.com>.
You can try this in the java page

@InjectComponent(id="ProductSizeForm")
private Form ProductSizeForm;


@OnEvent(value=EventConstants=SUCCESS,component="ProductSizeForm")
public void formSuccess() {
}

And in the tml leave it as it is and try again.



On Sun, Nov 6, 2011 at 4:13 PM, 9902468 <vi...@greenstreet.fi> wrote:
> The saga continues:
>
> I have a "onSuccessFromProductSizeForm" -method on my page. When the form is
> enclosed in a component I get the following error message:
>
> Method
> com.orient.web.admin.pages.entity.ProductSizeBulkAdd.onSuccessFromProductSizeForm()
> references component id 'ProductSizeForm' which does not exist.
>
> So, I can't have event listeners anymore that listen to events thrown by
> components inside components?
>
> The hierarchy is this:
> Page
>  - MyComponent
>   - <t:form t:id="ProductSizeForm">...
>
> This is a bug in the "check that there is a component that can trigger the
> event that is listened by this method" routine I presume?
>
>  - Ville
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968614.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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.3. rc3: event bubbling bug?

Posted by 9902468 <vi...@greenstreet.fi>.
The saga continues:

I have a "onSuccessFromProductSizeForm" -method on my page. When the form is
enclosed in a component I get the following error message:

Method
com.orient.web.admin.pages.entity.ProductSizeBulkAdd.onSuccessFromProductSizeForm()
references component id 'ProductSizeForm' which does not exist.

So, I can't have event listeners anymore that listen to events thrown by
components inside components?

The hierarchy is this:
Page
 - MyComponent
   - <t:form t:id="ProductSizeForm">...

This is a bug in the "check that there is a component that can trigger the
event that is listened by this method" routine I presume?

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4968614.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by Bob Harner <bo...@gmail.com>.
This is news to me too (not having worked much with event bubbling)
and I think this is probably a widespread misunderstanding, since the
Tapestry usage differs significantly from the standard HTML/XML
"container" concept. I'll try to find places in the documentation
where this can be made clear.

On Sat, Nov 5, 2011 at 11:21 AM, 9902468 <vi...@greenstreet.fi> wrote:
> Ok, thanks for the info!
>
> This has been a really big misunderstanding from my part. Now that I know
> how it works I just have to think other ways to implement my use case.
>
>  - Ville
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4966901.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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.3. rc3: event bubbling bug?

Posted by 9902468 <vi...@greenstreet.fi>.
Ok, thanks for the info!

This has been a really big misunderstanding from my part. Now that I know
how it works I just have to think other ways to implement my use case.

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4966901.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.3. rc3: event bubbling bug?

Posted by Robert Zeigler <ro...@roxanemy.com>.
Expected behavior.

The modal component wraps the form, but it isn't the parent/container of the form.  That is, if you could @InjectContainer in the form, it would be the page, not the modal component. Basically, the way tapestry determines parent/child is: which template contains the component? In this case, the page's template contains the form, so the page is the parent.

Robert

On Nov 5, 2011, at 11/56:32 AM , 9902468 wrote:

> Hi,
> 
> T5.3 rc3:
> 
> I have a page, that has the following tml:
> 
> <t:modal t:id="dialog">
>    <t:form t:id="productSizeForm" clientValidation="false">
>        ....
>    </form>
> </t:modal>
> 
> And the modal component has the following contents:
> 
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
> <div id="${id}" class="modal hide fade in" style="display:none;">
>    <t:body />
> </div>
> </t:container>
> 
> I thought, that when the form is submitted, the modal component could listen
> to onFailure + onSubmit events, but the events are never bubbled there? The
> same methods work ok in the page class fine.
> 
> The method I'm using is
> 
> @OnEvent(value="failure")
> public boolean onFailure() {
> 	return false;
> }
> 
> Is this a bug, expected behaviour or what? I thought that the event should
> bubble through the component hierarchy until aborted or the root is hit, but
> this does not seem to be the case (anymore)?
> 
> I don't even know where to start looking, so any pointers are welcome. 
> 
> - Ville
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4966490.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> 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.3. rc3: event bubbling bug?

Posted by Ville <vi...@cerion.fi>.
Yep, figured it out already.

Too much time since using T5, and too much JSF in between. It's good to be
back ;)

 - Ville

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-rc3-event-bubbling-bug-tp4966490p4970859.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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