Hi Martin,

Yes, it is what I was looking to achieve, and I was afraid that the only solution was to register in the IJavaScriptLibrarySettings an alternate version of the wicket-ajax-jquery.js script, as this would mean I'll have to keep it in sync with changes made to the origin scripts whenever I upgrade the wicket version I'm using.

Thanks for your help, I'll look into the channels.js, as that might be a way for me to ensure that my own script works correctly both now and in future Wicket versions!

I was wondering if some other people might need this feature, or alternatively in a feature allowing to either create a hierarchy of AjaxChannel instances.

I was thinking of something along the lines:

- Channel A
 - Sub Channel A1
   - Sub Channel A11
 - ...

where a sub channel would be able to process its callbacks stack only when its parent chanel is not busy.

In the example above, Sub Channel A1 would be able to process its stack of callbacks only when Channel A is not busy anymore. And Channel A would notify its children when its busy state is set to false.

On the Java side of the API, I would add another constructor taking a parent AjaxChannel as its parent.

On the javascript side of the API, I'll enrich Channel and ChannelManager to be aware of the channels hierarchy, and handle the processing of the callback stacks and the notification of children channels whenever a busy parent channel is not busy anymore.

I like this solution as it is (I think) fully compatible with the current behavior of channels.

If that is the case, I'm willing to discuss this and implement it so that it may be integrated in Wicket later. Let me know if you're interested!

Otherwise, maybe I could create a Wicketstuff project for this.

Cheers,

Antoine.

-------------
Antoine Angénieux
Co-founder
mob: +33 6 60 21 09 18
aangeni...@clinigrid.com
-------------
Clinigrid
92/98 boulevard Victor Hugo
93300 Clichy Cedex
Tel: +33 1 55 90 66 84
-------------

Le 08/08/2013 16:48, Martin Grigorov a écrit :
Hi Antoine,

All this is possible but it is not supported by Wicket's ChannelManager at
the moment.

There is one Channel instance per channel name. It is reachable thru
Wicket.ChannelManager[channelName]. This instance keeps an array of all
scheduled functions (Wicket.Channel.callbacks).
As far as I understand you you want to have this functionality for all
channels, i.e. if there is a running request in channel1 with type Queue
then channel2 should wait for it.
Then in Channel.done() you have to notify all other channels when busy
becomes false. Here the tricky part is to decide whether you want to keep
order of the callbacks to execute in the other channels. I think there must
be order.

At the moment I'm not convinced that something like this should go in
Wicket itself, so you will have to use monkey-patching to implement it and
use it in your app.
You may use
https://github.com/apache/wicket/blob/master/wicket-core/src/test/js/channels.js
as
inspiration for unit testing your code.



On Thu, Aug 8, 2013 at 3:24 PM, Antoine Angenieux
<aangeni...@clinigrid.com>wrote:

Hi all!

In our application, we use two distinct Ajax Channels:
- The default one, using the default Queue type
- A dedicated channel for what we call "actions" of type Active

All "actions" use a same class of Behavior that sets the channel in the
ajax attributes.

What I'd like to achieve is that whenever a callback is scheduled in the
"action" channel, the action channel should wait that the default channel
(or all other channels registered in the channel manager) is no longer busy
before processing this callback.

Furthermore, I'd like that all attributes evaluation (being ajax
attributes extra parameters or dynamic extra parameters) be deferred until
no other channel is busy any more.

I was thinking of using an IAjaxCallListener in our ActionBehavior by
implementing the getBeforeHandler() method. Looking at the Wicket.Channel
and Wicket.ChannelManager, I guess it is relatively easy to determine
whether any other channel is busy, but I don't see how I could defer the
scheduling of the callback until then.

The other idea I came up with, but was not capable of implementing, is
wrapping the getCallbackScript() of our ActionBehavior in a function that
tests if any other channel is busy, and if so, simply reschedule its
execution by calling window.setTimeout(). But then, I do not see a way to
let this wrapping function return the result of the wrapped callback...

Does anyone have any idea on how to achieve this? Or if this is event
possible?

Thank you in advance!

Cheers,

Antoine.

--
-------------
Antoine Angénieux
Co-founder
mob: +33 6 60 21 09 18
aangeni...@clinigrid.com
-------------
Clinigrid
92/98 boulevard Victor Hugo
93300 Clichy Cedex
Tel: +33 1 55 90 66 84
-------------

------------------------------**------------------------------**---------
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
For additional commands, e-mail: users-h...@wicket.apache.org




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

Reply via email to