Author: pyaschenko
Date: 2010-05-06 05:56:55 -0400 (Thu, 06 May 2010)
New Revision: 16907
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js
Log:
https://jira.jboss.org/jira/browse/RF-7894
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js
===================================================================
---
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-05-06
08:41:13 UTC (rev 16906)
+++
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-05-06
09:56:55 UTC (rev 16907)
@@ -91,7 +91,7 @@
};
$.extend(QueueEntry.prototype, {
-
+ // now unused functions: isIgnoreDupResponses, ondrop, clearEntry
isIgnoreDupResponses: function() {
return this.options.ignoreDupResponses;
},
@@ -212,8 +212,9 @@
log.debug("richfaces.queue: Nothing to submit");
return;
}
+ var entry;
if (items[0].getReadyToSubmit()) {
- lastRequestedEntry = items.shift();
+ entry = lastRequestedEntry = items.shift();
log.debug("richfaces.queue: will submit request NOW");
var o = lastRequestedEntry.options;
// copy of event should be created otherwise IE will fail
@@ -221,9 +222,12 @@
//lastRequestedEntry.source.appendParameter("AJAX:EVENTS_COUNT",
lastRequestedEntry.eventsCount);
o["AJAX:EVENTS_COUNT"] = lastRequestedEntry.eventsCount;
richfaces.ajax.jsfRequest(lastRequestedEntry.source, e, o);
+
+ // call event handlers
if (o.queueonsubmit) {
o.queueonsubmit.call(lastRequestedEntry);
}
+ callEventHandler("onrequestdequeue", entry);
}
};
@@ -243,6 +247,22 @@
var lastIdx = items.length - 1;
items[lastIdx] = entry;
};
+
+ var callEventHandler = function (handlerName, entry) {
+ var handler = entry.options[handlerName];
+ if (handler) {
+ // what is a context should be??
+ handler.call(null, entry);
+ }
+ var opts, handler2;
+ if (entry.options.queueId &&
+ (opts=defaultQueueOptions[entry.options.queueId]) &&
+ (handler2=opts[handlerName])
+ && handler2!=handler) {
+ // the same about context
+ handler2.call(null, entry);
+ }
+ }
return {
/**
@@ -324,6 +344,10 @@
items.push(entry);
log.debug("New request added to queue.");
}
+ // call event handlers
+ callEventHandler("onrequestqueue", entry);
+
+ // start timer
entry.startTimer();
},