Re: Simple Event Propagation Problem

2010-10-08 Thread aertsko


Howard Lewis Ship wrote:
 
 Often, a component will capture action events from one or more
 components and trigger new events with names customized to what the
 component does; here is might trigger an edit event, and you would
 name your method onEditFromLayout().
 

Hi Howard,

This is exactly what I am looking for. 

Could you explain in more detail how the capturing and triggering of the
edit event works? I can capture the action event from my actionlink, but I
can't find how to trigger the edit event.

Tnx,
Koen
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Simple-Event-Propagation-Problem-tp2433285p3204228.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: Simple Event Propagation Problem

2010-10-08 Thread Thiago H. de Paula Figueiredo

On Fri, 08 Oct 2010 05:18:30 -0300, aertsko aert...@gmail.com wrote:


This is exactly what I am looking for.

Could you explain in more detail how the capturing and triggering of the
edit event works? I can capture the action event from my actionlink, but  
I can't find how to trigger the edit event.


@Inject ComponentResources then its triggerEvent(String eventType,  
Object[] contextValues, ComponentEventCallback callback) method. See its  
JavaDoc for more details.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Simple Event Propagation Problem

2010-03-17 Thread Nicolas Bouillon
Thank you Howard for the clear response. Of course it works well now.

I was a bit surprised that it doesn't worked because I had already done
this kind of event propagation for a method named onSuccess(). But I
believed it worked because I had not specified the name of the component.

On Tue, 16 Mar 2010 15:24:46 -0700, Howard Lewis Ship hls...@gmail.com
wrote:
 Because the action event was not caught by it's immediate container
 (the Layout component), it propagated up with a new origin: the Layout
 component itself.  so onActionFromLayout() would work (because the id
 'layout' will have been autoassigned by Tapestry).
 
 The concept here is that the Layout component should limit how much of
 its internal structure is exposed to the outside world: it should
 ideally be a black box.
 
 Often, a component will capture action events from one or more
 components and trigger new events with names customized to what the
 component does; here is might trigger an edit event, and you would
 name your method onEditFromLayout().
 
 
 
 On Tue, Mar 16, 2010 at 2:57 PM, Nicolas Bouillon nico...@bouil.org
 wrote:
 Hi,

 I have a simple problem. I use a component as a layout, and i want to
 have
 an action link that will be handled by the page that use the layout. I
 believed that the event from actionLink goes from the Layout Component
to
 my
 page containing the component (here it is Index)

 Here is the source excerpt :

 Index.tml :
 html t:type=layout p:title=title
   
 /html

 Layout.tml
 
   t:actionlink t:id=editEdit/t:actionlink
 ...
 div id=content
               h2${title}/h2
               t:body /
 /div
 

 Index.java

   @OnEvent(component = edit, value = EventConstants.ACTION)
   public Object onActionFromEdit() {
       return Edit.class;

   }

 And I got the following error :

 16/03/2010 22:51:51 ERROR
 org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler -
 Processing of request failed with uncaught exception: Request event
 'action'
 (on component w/Index:layout.edit) was not handled; you must provide a
 matching event handler method in the component or in one of its
 containers.
 org.apache.tapestry5.ioc.internal.util.TapestryException: Request event
 'action' (on component w/Index:layout.edit) was not handled; you must
 provide a matching event handler method in the component or in one of
its
 containers. [at classpath:org/bouil/tapestry/components/Layout.tml, line
 59]
   at

org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:79)
   at

org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
   at

$ComponentEventRequestHandler_12768f52a94.handle($ComponentEventRequestHandler_12768f52a94.java)
   at

org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
 ...

 What's wrong ?

 Thanks.
 Nicolas.


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



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



Re: Simple Event Propagation Problem

2010-03-16 Thread Howard Lewis Ship
Because the action event was not caught by it's immediate container
(the Layout component), it propagated up with a new origin: the Layout
component itself.  so onActionFromLayout() would work (because the id
'layout' will have been autoassigned by Tapestry).

The concept here is that the Layout component should limit how much of
its internal structure is exposed to the outside world: it should
ideally be a black box.

Often, a component will capture action events from one or more
components and trigger new events with names customized to what the
component does; here is might trigger an edit event, and you would
name your method onEditFromLayout().



On Tue, Mar 16, 2010 at 2:57 PM, Nicolas Bouillon nico...@bouil.org wrote:
 Hi,

 I have a simple problem. I use a component as a layout, and i want to have
 an action link that will be handled by the page that use the layout. I
 believed that the event from actionLink goes from the Layout Component to my
 page containing the component (here it is Index)

 Here is the source excerpt :

 Index.tml :
 html t:type=layout p:title=title
   
 /html

 Layout.tml
 
   t:actionlink t:id=editEdit/t:actionlink
 ...
 div id=content
               h2${title}/h2
               t:body /
 /div
 

 Index.java

   @OnEvent(component = edit, value = EventConstants.ACTION)
   public Object onActionFromEdit() {
       return Edit.class;

   }

 And I got the following error :

 16/03/2010 22:51:51 ERROR
 org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler -
 Processing of request failed with uncaught exception: Request event 'action'
 (on component w/Index:layout.edit) was not handled; you must provide a
 matching event handler method in the component or in one of its containers.
 org.apache.tapestry5.ioc.internal.util.TapestryException: Request event
 'action' (on component w/Index:layout.edit) was not handled; you must
 provide a matching event handler method in the component or in one of its
 containers. [at classpath:org/bouil/tapestry/components/Layout.tml, line 59]
   at
 org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:79)
   at
 org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
   at
 $ComponentEventRequestHandler_12768f52a94.handle($ComponentEventRequestHandler_12768f52a94.java)
   at
 org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
 ...

 What's wrong ?

 Thanks.
 Nicolas.


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





-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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