You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Allen Gilbert <al...@doane.edu> on 2011/12/28 23:41:55 UTC

Wicket.Ajax.registerPre/PostCallHandler filtering

Hello,

I have a Panel containing many child components that perform various ajax
actions.  Whenever an ajax request is initiated from the panel or any of
its children, I'd like to show an indicator on the panel and block user
interaction with it.  However, I don't want the indicator to be shown for
ajax requests initiated by other components on the page.  Is there a way to
access the context of an ajax request in a javascript pre- or post-ajax
call handler in order to determine what component is initiating the
request?  Looking at wicket-ajax.js, there doesn't seem to be.

Alternatively, is there a way to decorate all ajax request javascript for a
panel's child components?  I'd like to avoid having to modify every ajax
behavior of the Panel's child components in order to show the activity
indicator on the panel.

-Allen

Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Martin Grigorov <mg...@apache.org>.
Hi Allen,

This information will be available in Wicket 6.0 where Wicket Ajax is improved.
For 1.5 you can try with registering click event listener in the
capturing phase and extract the clicked element from
event.target(srcElement). But I guess IE<9 will fail you with this
approach.

On Thu, Dec 29, 2011 at 8:48 AM, Allen Gilbert <al...@doane.edu> wrote:
> Martin,
>
> I am familiar with IAjaxCallDecorator, and am using it extensively.
>  However, in this case, I'm trying to avoid having to
> override getAjaxCallDecorator() in every Ajax-enabled component under my
> Panel.  Instead, I'm trying to find a single place where I can decorate or
> pre- and post-process calls for the various ajax components in my Panel.
>
> -Allen
>
> On Thu, Dec 29, 2011 at 12:25 AM, Martin Grigorov <mg...@apache.org>wrote:
>
>> See IAjaxCallDecorator.
>> Each Ajax component can decorate its ajax call with pre- and post-
>> conditions. To remove the indicator use onSuccess and onFailure
>> callbacks
>>
>> On Thu, Dec 29, 2011 at 12:41 AM, Allen Gilbert <al...@doane.edu>
>> wrote:
>> > Hello,
>> >
>> > I have a Panel containing many child components that perform various ajax
>> > actions.  Whenever an ajax request is initiated from the panel or any of
>> > its children, I'd like to show an indicator on the panel and block user
>> > interaction with it.  However, I don't want the indicator to be shown for
>> > ajax requests initiated by other components on the page.  Is there a way
>> to
>> > access the context of an ajax request in a javascript pre- or post-ajax
>> > call handler in order to determine what component is initiating the
>> > request?  Looking at wicket-ajax.js, there doesn't seem to be.
>> >
>> > Alternatively, is there a way to decorate all ajax request javascript
>> for a
>> > panel's child components?  I'd like to avoid having to modify every ajax
>> > behavior of the Panel's child components in order to show the activity
>> > indicator on the panel.
>> >
>> > -Allen
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Allen Gilbert <al...@doane.edu>.
Martin,

I am familiar with IAjaxCallDecorator, and am using it extensively.
 However, in this case, I'm trying to avoid having to
override getAjaxCallDecorator() in every Ajax-enabled component under my
Panel.  Instead, I'm trying to find a single place where I can decorate or
pre- and post-process calls for the various ajax components in my Panel.

-Allen

On Thu, Dec 29, 2011 at 12:25 AM, Martin Grigorov <mg...@apache.org>wrote:

> See IAjaxCallDecorator.
> Each Ajax component can decorate its ajax call with pre- and post-
> conditions. To remove the indicator use onSuccess and onFailure
> callbacks
>
> On Thu, Dec 29, 2011 at 12:41 AM, Allen Gilbert <al...@doane.edu>
> wrote:
> > Hello,
> >
> > I have a Panel containing many child components that perform various ajax
> > actions.  Whenever an ajax request is initiated from the panel or any of
> > its children, I'd like to show an indicator on the panel and block user
> > interaction with it.  However, I don't want the indicator to be shown for
> > ajax requests initiated by other components on the page.  Is there a way
> to
> > access the context of an ajax request in a javascript pre- or post-ajax
> > call handler in order to determine what component is initiating the
> > request?  Looking at wicket-ajax.js, there doesn't seem to be.
> >
> > Alternatively, is there a way to decorate all ajax request javascript
> for a
> > panel's child components?  I'd like to avoid having to modify every ajax
> > behavior of the Panel's child components in order to show the activity
> > indicator on the panel.
> >
> > -Allen
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Martin Grigorov <mg...@apache.org>.
See IAjaxCallDecorator.
Each Ajax component can decorate its ajax call with pre- and post-
conditions. To remove the indicator use onSuccess and onFailure
callbacks

On Thu, Dec 29, 2011 at 12:41 AM, Allen Gilbert <al...@doane.edu> wrote:
> Hello,
>
> I have a Panel containing many child components that perform various ajax
> actions.  Whenever an ajax request is initiated from the panel or any of
> its children, I'd like to show an indicator on the panel and block user
> interaction with it.  However, I don't want the indicator to be shown for
> ajax requests initiated by other components on the page.  Is there a way to
> access the context of an ajax request in a javascript pre- or post-ajax
> call handler in order to determine what component is initiating the
> request?  Looking at wicket-ajax.js, there doesn't seem to be.
>
> Alternatively, is there a way to decorate all ajax request javascript for a
> panel's child components?  I'd like to avoid having to modify every ajax
> behavior of the Panel's child components in order to show the activity
> indicator on the panel.
>
> -Allen



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Allen Gilbert <al...@doane.edu>.
After a bit more digging, I'm not sure I'll be able to use
IAjaxIndicatorAware at this time:
https://issues.apache.org/jira/browse/WICKET-4257.  I have a few components
that currently use it, and we've noticed this issue as well.  For them,
it's simply an annoyance (the indicator graphic doesn't go away), but with
this Panel, it will be very problematic if the blocking div is not removed
properly.

On Thu, Dec 29, 2011 at 10:56 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> That's perfectly doable: put the loading indicator on top of the blocking
> div.
>
> On Thu, Dec 29, 2011 at 5:28 PM, Allen Gilbert <allen.gilbert@doane.edu
> >wrote:
>
> > Ernesto,
> >
> > Interesting...I've only used IAjaxIndicatorAware to display a loading
> gif,
> > but it might solve this problem if I can get it to nicely show and hide a
> > div that a) blocks the user from interacting with my panel and b) shows a
> > loading indicator.  I'll try it out.  Thanks!
> >
> > -Allen
> >
> > On Thu, Dec 29, 2011 at 3:40 AM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> > > Allen,
> > >
> > > Isn't it possible to make the panel implement IAjaxIndicatorAware?
> > >
> > > Regards,
> > >
> > > Ernesto
> > >
> > > On Wed, Dec 28, 2011 at 11:41 PM, Allen Gilbert <
> allen.gilbert@doane.edu
> > > >wrote:
> > >
> > > > Hello,
> > > >
> > > > I have a Panel containing many child components that perform various
> > ajax
> > > > actions.  Whenever an ajax request is initiated from the panel or any
> > of
> > > > its children, I'd like to show an indicator on the panel and block
> user
> > > > interaction with it.  However, I don't want the indicator to be shown
> > for
> > > > ajax requests initiated by other components on the page.  Is there a
> > way
> > > to
> > > > access the context of an ajax request in a javascript pre- or
> post-ajax
> > > > call handler in order to determine what component is initiating the
> > > > request?  Looking at wicket-ajax.js, there doesn't seem to be.
> > > >
> > > > Alternatively, is there a way to decorate all ajax request javascript
> > > for a
> > > > panel's child components?  I'd like to avoid having to modify every
> > ajax
> > > > behavior of the Panel's child components in order to show the
> activity
> > > > indicator on the panel.
> > > >
> > > > -Allen
> > > >
> > >
> >
>

Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
That's perfectly doable: put the loading indicator on top of the blocking
div.

On Thu, Dec 29, 2011 at 5:28 PM, Allen Gilbert <al...@doane.edu>wrote:

> Ernesto,
>
> Interesting...I've only used IAjaxIndicatorAware to display a loading gif,
> but it might solve this problem if I can get it to nicely show and hide a
> div that a) blocks the user from interacting with my panel and b) shows a
> loading indicator.  I'll try it out.  Thanks!
>
> -Allen
>
> On Thu, Dec 29, 2011 at 3:40 AM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > Allen,
> >
> > Isn't it possible to make the panel implement IAjaxIndicatorAware?
> >
> > Regards,
> >
> > Ernesto
> >
> > On Wed, Dec 28, 2011 at 11:41 PM, Allen Gilbert <allen.gilbert@doane.edu
> > >wrote:
> >
> > > Hello,
> > >
> > > I have a Panel containing many child components that perform various
> ajax
> > > actions.  Whenever an ajax request is initiated from the panel or any
> of
> > > its children, I'd like to show an indicator on the panel and block user
> > > interaction with it.  However, I don't want the indicator to be shown
> for
> > > ajax requests initiated by other components on the page.  Is there a
> way
> > to
> > > access the context of an ajax request in a javascript pre- or post-ajax
> > > call handler in order to determine what component is initiating the
> > > request?  Looking at wicket-ajax.js, there doesn't seem to be.
> > >
> > > Alternatively, is there a way to decorate all ajax request javascript
> > for a
> > > panel's child components?  I'd like to avoid having to modify every
> ajax
> > > behavior of the Panel's child components in order to show the activity
> > > indicator on the panel.
> > >
> > > -Allen
> > >
> >
>

Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Cemal Bayramoglu <jW...@cabouge.com>.
Allen,

Is this what yo uneed?

http://wicketinaction.com/2008/12/preventing-double-ajax-requests-in-3-lines-of-code/#more-302

Regards - Cemal
jWeekend
Training, Consulting, Development
http://jWeekend.com

On 29 December 2011 16:28, Allen Gilbert <al...@doane.edu> wrote:
>
> Ernesto,
>
> Interesting...I've only used IAjaxIndicatorAware to display a loading gif,
> but it might solve this problem if I can get it to nicely show and hide a
> div that a) blocks the user from interacting with my panel and b) shows a
> loading indicator.  I'll try it out.  Thanks!
>
> -Allen
>
> On Thu, Dec 29, 2011 at 3:40 AM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > Allen,
> >
> > Isn't it possible to make the panel implement IAjaxIndicatorAware?
> >
> > Regards,
> >
> > Ernesto
> >
> > On Wed, Dec 28, 2011 at 11:41 PM, Allen Gilbert <allen.gilbert@doane.edu
> > >wrote:
> >
> > > Hello,
> > >
> > > I have a Panel containing many child components that perform various ajax
> > > actions.  Whenever an ajax request is initiated from the panel or any of
> > > its children, I'd like to show an indicator on the panel and block user
> > > interaction with it.  However, I don't want the indicator to be shown for
> > > ajax requests initiated by other components on the page.  Is there a way
> > to
> > > access the context of an ajax request in a javascript pre- or post-ajax
> > > call handler in order to determine what component is initiating the
> > > request?  Looking at wicket-ajax.js, there doesn't seem to be.
> > >
> > > Alternatively, is there a way to decorate all ajax request javascript
> > for a
> > > panel's child components?  I'd like to avoid having to modify every ajax
> > > behavior of the Panel's child components in order to show the activity
> > > indicator on the panel.
> > >
> > > -Allen
> > >
> >

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


Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Allen Gilbert <al...@doane.edu>.
Ernesto,

Interesting...I've only used IAjaxIndicatorAware to display a loading gif,
but it might solve this problem if I can get it to nicely show and hide a
div that a) blocks the user from interacting with my panel and b) shows a
loading indicator.  I'll try it out.  Thanks!

-Allen

On Thu, Dec 29, 2011 at 3:40 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Allen,
>
> Isn't it possible to make the panel implement IAjaxIndicatorAware?
>
> Regards,
>
> Ernesto
>
> On Wed, Dec 28, 2011 at 11:41 PM, Allen Gilbert <allen.gilbert@doane.edu
> >wrote:
>
> > Hello,
> >
> > I have a Panel containing many child components that perform various ajax
> > actions.  Whenever an ajax request is initiated from the panel or any of
> > its children, I'd like to show an indicator on the panel and block user
> > interaction with it.  However, I don't want the indicator to be shown for
> > ajax requests initiated by other components on the page.  Is there a way
> to
> > access the context of an ajax request in a javascript pre- or post-ajax
> > call handler in order to determine what component is initiating the
> > request?  Looking at wicket-ajax.js, there doesn't seem to be.
> >
> > Alternatively, is there a way to decorate all ajax request javascript
> for a
> > panel's child components?  I'd like to avoid having to modify every ajax
> > behavior of the Panel's child components in order to show the activity
> > indicator on the panel.
> >
> > -Allen
> >
>

Re: Wicket.Ajax.registerPre/PostCallHandler filtering

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Allen,

Isn't it possible to make the panel implement IAjaxIndicatorAware?

Regards,

Ernesto

On Wed, Dec 28, 2011 at 11:41 PM, Allen Gilbert <al...@doane.edu>wrote:

> Hello,
>
> I have a Panel containing many child components that perform various ajax
> actions.  Whenever an ajax request is initiated from the panel or any of
> its children, I'd like to show an indicator on the panel and block user
> interaction with it.  However, I don't want the indicator to be shown for
> ajax requests initiated by other components on the page.  Is there a way to
> access the context of an ajax request in a javascript pre- or post-ajax
> call handler in order to determine what component is initiating the
> request?  Looking at wicket-ajax.js, there doesn't seem to be.
>
> Alternatively, is there a way to decorate all ajax request javascript for a
> panel's child components?  I'd like to avoid having to modify every ajax
> behavior of the Panel's child components in order to show the activity
> indicator on the panel.
>
> -Allen
>