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/08/28 12:54:35 UTC
Event handlers with multiple parameters
Hi, after quite a while using Tapestry I've got a situation where I need an event handler that accepts an unknown amount multiple parameters.
mark(boolean checked, String[] itemIds)
mark(boolean checked, String... itemIds)
mark(boolean checked, List<String> itemIds)
I've tried these and the Last one works after a fashion. Basically the first element of the itemIds list is the checked Boolean value in string form. This seems like a bug to me, but I've been struggling to get this working so I might be being stupid here. What do you all think?
Also, Tapestry doesn't appear to be able to distinguish between that method signature and this
mark(boolean checked, String itemId)
which does tie up with the documentation I suppose, but this is why I was trying the String... way. Anyway I can use two different events to get round this.
Thanks,
Andy.
RE: Event handlers with multiple parameters
Posted by "Blower, Andy" <An...@proquest.co.uk>.
Thanks for the reply Thiago, I missed EventContext in the docs. Looks to me like using EventContext to parse the context params myself is the best solution here. Unless anyone can suggest a better way?
Thanks,
Andy
> -----Original Message-----
> From: Thiago H. de Paula Figueiredo [mailto:thiagohp@gmail.com]
> Sent: 28 August 2008 20:33
> To: Tapestry users
> Subject: Re: Event handlers with multiple parameters
>
> Em Thu, 28 Aug 2008 08:21:50 -0300, Blower, Andy
> <An...@proquest.co.uk> escreveu:
>
> > mark(boolean checked, String[] itemIds)
> >
> > mark(boolean checked, String... itemIds)
> >
> > mark(boolean checked, List<String> itemIds)
>
> As far as I know, none of the would work because Tapestry would not
> handle
> an event handler method with one one String[] or List parameter AND
> other
> parameters. It handles String[], List and EventContext, each one as the
> single parameter, for that matter.
>
> Thiago
>
> ---------------------------------------------------------------------
> 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: Event handlers with multiple parameters
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 28 Aug 2008 08:21:50 -0300, Blower, Andy
<An...@proquest.co.uk> escreveu:
> mark(boolean checked, String[] itemIds)
>
> mark(boolean checked, String... itemIds)
>
> mark(boolean checked, List<String> itemIds)
As far as I know, none of the would work because Tapestry would not handle
an event handler method with one one String[] or List parameter AND other
parameters. It handles String[], List and EventContext, each one as the
single parameter, for that matter.
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Event handlers with multiple parameters
Posted by "Blower, Andy" <An...@proquest.co.uk>.
(Sending again since the formatting was really bad and I have more to add/clarify)
Hi, after quite a while using Tapestry I've got a situation where I need an event handler that accepts an unknown amount multiple parameters.
mark(boolean checked, String[] itemIds)
mark(boolean checked, String... itemIds)
mark(boolean checked, List<String> itemIds)
I've tried these and the Last one works after a fashion. Basically the first element of the itemIds list is the checked Boolean value in string form. This seems like a bug to me, but I've been struggling to get this working so I might be being stupid here. What do you all think?
It also seems strange that you can only get back what is essentially an Array of Strings as a List (Arrays.ArrayList) which then has to have its array extracted and copied into a real ArrayList just so the Boolean can be removed using remove().
Also, another couple of weird things. Tapestry doesn't appear to be able to distinguish between that method signature and this
mark(boolean checked, String itemId)
which does tie up with the documentation I suppose, but this is why I was trying the String... itemIds way. Anyway I can use two different events to get round this.
Creating an action link for the event using createActionLink(EVENT, false, checked, itemIds.toArray()); where checked is a Boolean means that the id's are not written into the link correctly. No matter what I put before the itemId's, String, Object etc the array of Id's is not output correctly.
Thanks,
Andy.
(Hope this makes more sense than the last message)