You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ma...@bmw.ch on 2007/05/07 12:01:03 UTC
How to pass custom arguments to @EventListener
I'm successfully listening to a custom javacript method being called on
an element.
Now, I'd like to access the argument(s) that were passed to this method.
Is there an easy way to achieve this? I've looked at the BrowserEvent
object passed to the listener, but this didn't help.
Thanks for any hints,
Marcus
RE: How to pass custom arguments to @EventListener
Posted by Ma...@bmw.ch.
Unfortunately, I explicitly do NOT want to post the form on each event.
I have a relatively big form partitioned into several js-Tabs. Switching
tabs
should not submit the form. I could, of course do an asynchronous submit
of
a different form. But then I'd have to find a way to render the form
somewhere outside the form enclosing my component, which would also be
relatively cumbersome, I'm afraid.
Marcus
> -----Original Message-----
> From: Christian Dutaret [mailto:cdtapestry@gmail.com]
> Sent: Tuesday, May 08, 2007 1:47 PM
> To: Tapestry users
> Subject: Re: How to pass custom arguments to @EventListener
>
> What I do as a workaround is store the javascript parameters
> into form hidden properties from within my custom javascript
> function. Since the EventListener handler posts the form
> before calling the listener, I can retrieve the values from there
>
> HTH
> Ch.
>
> 2007/5/8, Marcus.Schulte@bmw.ch <Ma...@bmw.ch>:
> >
> > I'm now working around this by doing the tapestry.bind
> directly from
> > my JavaScript calling the directevent service. Of course,
> my component
> > now implements IDirect and the @EventListener annotation is
> not used
> > anymore.
> >
> > Nevertheless, I think passing a stringified version of the
> intercepted
> > functions (first) parameter through would be much nicer I think. It
> > would also provide for some symmetry between native browser
> events and
> > custom methods. I don't really want to make you unhappy,
> however ...
> > ;)
> >
> > > -----Original Message-----
> > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > Sent: Tuesday, May 08, 2007 12:01 AM
> > > To: Tapestry users
> > > Subject: Re: How to pass custom arguments to @EventListener
> > >
> > > I've been wary of trying to serialize function parameters as that
> > > could get very tricky on non simple object structures.
> > > (json recursion and such)
> > >
> > > I guess if they were acceptable to send to the server "as is"
> > > doing the equivalent of a toString() on them I could add that in.
> > > (but not be happy about it ;) ) Would that work ?
> > >
> > > On 5/7/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > > >
> > > > I'm successfully listening to a custom javacript method
> > > being called
> > > > on an element.
> > > > Now, I'd like to access the argument(s) that were passed to
> > > this method.
> > > > Is there an easy way to achieve this? I've looked at the
> > > BrowserEvent
> > > > object passed to the listener, but this didn't help.
> > > > Thanks for any hints,
> > > >
> > > > Marcus
> > > >
> > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.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: How to pass custom arguments to @EventListener
Posted by Christian Dutaret <cd...@gmail.com>.
What I do as a workaround is store the javascript parameters into form
hidden properties from within my custom javascript function. Since the
EventListener handler posts the form before calling the listener, I can
retrieve the values from there
HTH
Ch.
2007/5/8, Marcus.Schulte@bmw.ch <Ma...@bmw.ch>:
>
> I'm now working around this by doing the tapestry.bind directly from my
> JavaScript calling the directevent service. Of course, my component now
> implements IDirect and the @EventListener annotation is not used
> anymore.
>
> Nevertheless, I think passing a stringified version of the intercepted
> functions (first) parameter through would be much nicer I think. It
> would also provide for some symmetry between native browser events and
> custom methods. I don't really want to make you unhappy, however ... ;)
>
> > -----Original Message-----
> > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > Sent: Tuesday, May 08, 2007 12:01 AM
> > To: Tapestry users
> > Subject: Re: How to pass custom arguments to @EventListener
> >
> > I've been wary of trying to serialize function parameters as
> > that could get very tricky on non simple object structures.
> > (json recursion and such)
> >
> > I guess if they were acceptable to send to the server "as is"
> > doing the equivalent of a toString() on them I could add that
> > in. (but not be happy about it ;) ) Would that work ?
> >
> > On 5/7/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > >
> > > I'm successfully listening to a custom javacript method
> > being called
> > > on an element.
> > > Now, I'd like to access the argument(s) that were passed to
> > this method.
> > > Is there an easy way to achieve this? I've looked at the
> > BrowserEvent
> > > object passed to the listener, but this didn't help.
> > > Thanks for any hints,
> > >
> > > Marcus
> > >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: How to pass custom arguments to @EventListener, TabSet, persistent props in XHR's
Posted by Jesse Kuhnert <jk...@gmail.com>.
Ah good good..
I'm not sure if it was announced yet or not but I'll probably be integrating
the new 0.9 version of dojo in a 4.2 tapestry release. The internal
bickering is done and the performance / no code bloat people have won. The
library has also been broken up into three modules to make things easier for
whatever your greatest interest is.
Needless to say the performance of that version is about as good as it can
be. (not to mention size of download) It'll be exciting playing with it
soon!
On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
>
> > What do you mean by forbidden? And also by changing page
> > properties in an XHR request?
> >
> > I do this quite often myself so maybe it's just a matter of
> > ~when~ you try to change the properties.
>
> Oops, silly mistake in the component. It works perfectly well.
>
> >
> > p.s. Have you guys noticed any performance gains? Besides
> > ognl I've been squeezing every millisecond out that I can via
> > yourkit profiler. It's almost in a state where I don't think
> > there's a whole lot more I can do to make it faster but I'm
> > sure there is...
> >
>
> Rendering time is generally very fast. I've absolutely no issues with
> that (never had, to be honest, compared to DB- and network- roundtrip
> times (some 100ms), tapestry's rendering time was always negligible).
> My biggest performance-"issue" is dojo-initialisation on page-reload. At
> least I think it's that. Firebug tells me that about 1000ms are spent in
> dojo.loaded. Some 900 ms of these seem to come from
> buildWidgetFromParseTree.
>
> I don't really know whether there's something which can be done about
> this - it's not really a problem for us. Maybe it's just the price to
> pay for some the really snappy XHR requests ...
>
> Marcus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
RE: How to pass custom arguments to @EventListener, TabSet, persistent props in XHR's
Posted by Ma...@bmw.ch.
> What do you mean by forbidden? And also by changing page
> properties in an XHR request?
>
> I do this quite often myself so maybe it's just a matter of
> ~when~ you try to change the properties.
Oops, silly mistake in the component. It works perfectly well.
>
> p.s. Have you guys noticed any performance gains? Besides
> ognl I've been squeezing every millisecond out that I can via
> yourkit profiler. It's almost in a state where I don't think
> there's a whole lot more I can do to make it faster but I'm
> sure there is...
>
Rendering time is generally very fast. I've absolutely no issues with
that (never had, to be honest, compared to DB- and network- roundtrip
times (some 100ms), tapestry's rendering time was always negligible).
My biggest performance-"issue" is dojo-initialisation on page-reload. At
least I think it's that. Firebug tells me that about 1000ms are spent in
dojo.loaded. Some 900 ms of these seem to come from
buildWidgetFromParseTree.
I don't really know whether there's something which can be done about
this - it's not really a problem for us. Maybe it's just the price to
pay for some the really snappy XHR requests ...
Marcus
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to pass custom arguments to @EventListener, TabSet, persistent props in XHR's
Posted by Jesse Kuhnert <jk...@gmail.com>.
What do you mean by forbidden? And also by changing page properties in an
XHR request?
I do this quite often myself so maybe it's just a matter of ~when~ you try
to change the properties.
p.s. Have you guys noticed any performance gains? Besides ognl I've been
squeezing every millisecond out that I can via yourkit profiler. It's almost
in a state where I don't think there's a whole lot more I can do to make it
faster but I'm sure there is...
On 5/8/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
> While I'm at it:
> what I did was to replace the dojo-TabContainer (which is next to
> useless thanks to its incredibly bad performance) with another one based
> on the TabSet from Tassel.
>
> I wanted to store the selected Tab at the server, so that the user can
> scroll through a set of tabbed detail-screens while always staying on
> the same tab.
>
> Another quirk I had with that is that it seems to be forbidden to change
> persistent page-properties in a DirectEvent (XHR-Request). I worked
> around this by forwarding the change to an ASO, but that's hacky, of
> course, since the active tab is clearly something which belongs to the
> page.
>
> <snipped>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
RE: How to pass custom arguments to @EventListener, TabSet, persistent props in XHR's
Posted by Ma...@bmw.ch.
While I'm at it:
what I did was to replace the dojo-TabContainer (which is next to
useless thanks to its incredibly bad performance) with another one based
on the TabSet from Tassel.
I wanted to store the selected Tab at the server, so that the user can
scroll through a set of tabbed detail-screens while always staying on
the same tab.
Another quirk I had with that is that it seems to be forbidden to change
persistent page-properties in a DirectEvent (XHR-Request). I worked
around this by forwarding the change to an ASO, but that's hacky, of
course, since the active tab is clearly something which belongs to the
page.
> -----Original Message-----
> From: Marcus.Schulte@bmw.ch [mailto:Marcus.Schulte@bmw.ch]
> Sent: Tuesday, May 08, 2007 8:20 AM
> To: users@tapestry.apache.org
> Subject: RE: How to pass custom arguments to @EventListener
>
> I'm now working around this by doing the tapestry.bind
> directly from my JavaScript calling the directevent service.
> Of course, my component now implements IDirect and the
> @EventListener annotation is not used anymore.
>
> Nevertheless, I think passing a stringified version of the
> intercepted functions (first) parameter through would be much
> nicer I think. It would also provide for some symmetry
> between native browser events and custom methods. I don't
> really want to make you unhappy, however ... ;)
>
> > -----Original Message-----
> > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > Sent: Tuesday, May 08, 2007 12:01 AM
> > To: Tapestry users
> > Subject: Re: How to pass custom arguments to @EventListener
> >
> > I've been wary of trying to serialize function parameters as that
> > could get very tricky on non simple object structures.
> > (json recursion and such)
> >
> > I guess if they were acceptable to send to the server "as is"
> > doing the equivalent of a toString() on them I could add
> that in. (but
> > not be happy about it ;) ) Would that work ?
> >
> > On 5/7/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > >
> > > I'm successfully listening to a custom javacript method
> > being called
> > > on an element.
> > > Now, I'd like to access the argument(s) that were passed to
> > this method.
> > > Is there an easy way to achieve this? I've looked at the
> > BrowserEvent
> > > object passed to the listener, but this didn't help.
> > > Thanks for any hints,
> > >
> > > Marcus
> > >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.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: How to pass custom arguments to @EventListener
Posted by Ma...@bmw.ch.
I'm now working around this by doing the tapestry.bind directly from my
JavaScript calling the directevent service. Of course, my component now
implements IDirect and the @EventListener annotation is not used
anymore.
Nevertheless, I think passing a stringified version of the intercepted
functions (first) parameter through would be much nicer I think. It
would also provide for some symmetry between native browser events and
custom methods. I don't really want to make you unhappy, however ... ;)
> -----Original Message-----
> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> Sent: Tuesday, May 08, 2007 12:01 AM
> To: Tapestry users
> Subject: Re: How to pass custom arguments to @EventListener
>
> I've been wary of trying to serialize function parameters as
> that could get very tricky on non simple object structures.
> (json recursion and such)
>
> I guess if they were acceptable to send to the server "as is"
> doing the equivalent of a toString() on them I could add that
> in. (but not be happy about it ;) ) Would that work ?
>
> On 5/7/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> >
> > I'm successfully listening to a custom javacript method
> being called
> > on an element.
> > Now, I'd like to access the argument(s) that were passed to
> this method.
> > Is there an easy way to achieve this? I've looked at the
> BrowserEvent
> > object passed to the listener, but this didn't help.
> > Thanks for any hints,
> >
> > Marcus
> >
>
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to pass custom arguments to @EventListener
Posted by Jesse Kuhnert <jk...@gmail.com>.
I've been wary of trying to serialize function parameters as that could get
very tricky on non simple object structures. (json recursion and such)
I guess if they were acceptable to send to the server "as is" doing the
equivalent of a toString() on them I could add that in. (but not be happy
about it ;) ) Would that work ?
On 5/7/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
> I'm successfully listening to a custom javacript method being called on
> an element.
> Now, I'd like to access the argument(s) that were passed to this method.
> Is there an easy way to achieve this? I've looked at the BrowserEvent
> object passed to the listener, but this didn't help.
> Thanks for any hints,
>
> Marcus
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com