You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Joost Schouten (mailing lists)" <jo...@jsportal.com> on 2009/06/20 01:31:07 UTC

Generic Component javascript events in Tapestry

Hi,

I would like to propose an addition to almost every component, so
maybe it would be a low-level feature or a mixin, of a
t:ajaxeventtrigger parameter which takes a js event which should be
triggered.

This would look something like:

@Component(id = "myTextField", parameters = {"value=myValue",
"ajaxeventtrigger=onblur", "ajaxeventcontext=context"})
private TextField myTextField;

@OnEvent(component = "myTextField", value="onblur")
private Object handleTextOnBlur(Long context) {
      .... do something ....
      return WhateverIsRequired
}

I still need to do some more thinking about how to handel multiple
events on one component and how this would work nicely with
potentially different contexts for each event.

I really miss this flexibility of setting off a server side event from
any of the js events. I will build this myself as a Mixin. But if this
already exist, please let me know where, if not, is there a wider need
for this and should we consider making this part of Tapestry?

Cheers,
Joost

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


Re: Generic Component javascript events in Tapestry

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
Thanks for the reply, I'll post to this list once I'm done with the result.

Cheers,
Joost

On Sat, Jun 20, 2009 at 1:25 PM, Thiago H. de Paula
Figueiredo<th...@gmail.com> wrote:
> Em Fri, 19 Jun 2009 20:31:07 -0300, Joost Schouten (mailing lists)
> <jo...@jsportal.com> escreveu:
>
>> Hi,
>
> Hi!
>
>> I would like to propose an addition to almost every component, so
>> maybe it would be a low-level feature or a mixin, of a
>> t:ajaxeventtrigger parameter which takes a js event which should be
>> triggered.
>
> I prefer the mixin route, as it is more reusable and could even be added to
> HTML elements (using the Any component).
>
>> I still need to do some more thinking about how to handel multiple
>> events on one component
>
> I don't see more than a single couple event for the same component at least
> 90% of the time. Do you? So, if you want to handle more than one event in
> the same component, create one event handler method and create others that
> call the first one.
>
>> and how this would work nicely with
>> potentially different contexts for each event.
>
> Don't forget about EventContext. It's a catch-all.
>
>> I really miss this flexibility of setting off a server side event from
>> any of the js events.
>
> Me too, especially coupled with updating a component. That's the only thing
> I miss from Tapestry 4.
>
>> I will build this myself as a Mixin. But if this
>> already exist, please let me know where, if not, is there a wider need
>> for this and should we consider making this part of Tapestry?
>
> I think Tapestry 5 should have this mixin as part of the core library.
> ChenilleKit already has something like that, the OnEvent mixin
> (http://www.chenillekit.org/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/mixins/OnEvent.html,
> http://www.chenillekit.org/demo/tapcomp/oneventdemo), but I would like
> something that could update zones, not only a JSON response (maybe this
> could be a second mixin).
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

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


Re: Generic Component javascript events in Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 19 Jun 2009 20:31:07 -0300, Joost Schouten (mailing lists)  
<jo...@jsportal.com> escreveu:

> Hi,

Hi!

> I would like to propose an addition to almost every component, so
> maybe it would be a low-level feature or a mixin, of a
> t:ajaxeventtrigger parameter which takes a js event which should be
> triggered.

I prefer the mixin route, as it is more reusable and could even be added  
to HTML elements (using the Any component).

> I still need to do some more thinking about how to handel multiple
> events on one component

I don't see more than a single couple event for the same component at  
least 90% of the time. Do you? So, if you want to handle more than one  
event in the same component, create one event handler method and create  
others that call the first one.

> and how this would work nicely with
> potentially different contexts for each event.

Don't forget about EventContext. It's a catch-all.

> I really miss this flexibility of setting off a server side event from
> any of the js events.

Me too, especially coupled with updating a component. That's the only  
thing I miss from Tapestry 4.

> I will build this myself as a Mixin. But if this
> already exist, please let me know where, if not, is there a wider need
> for this and should we consider making this part of Tapestry?

I think Tapestry 5 should have this mixin as part of the core library.
ChenilleKit already has something like that, the OnEvent mixin  
(http://www.chenillekit.org/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/mixins/OnEvent.html,  
http://www.chenillekit.org/demo/tapcomp/oneventdemo), but I would like  
something that could update zones, not only a JSON response (maybe this  
could be a second mixin).

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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