[richfaces-svn-commits] JBoss Rich Faces SVN: r11650 - trunk/framework/impl/src/main/javascript/ajaxjsf.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Dec 8 12:34:44 EST 2008


Author: nbelaevski
Date: 2008-12-08 12:34:44 -0500 (Mon, 08 Dec 2008)
New Revision: 11650

Modified:
   trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
   trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
Log:
https://jira.jboss.org/jira/browse/RF-5244

Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js	2008-12-08 17:24:32 UTC (rev 11649)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js	2008-12-08 17:34:44 UTC (rev 11650)
@@ -55,11 +55,9 @@
  				if(window.document.documentElement != _this._documentElement){
           			LOG.warn("Page for current request have been unloaded - abort processing" );
  					_this.abort();
- 					_this = undefined;
  					return;
  				};
  				if(_this._aborted){
- 					_this = undefined;
  					return;
  				};
           		LOG.debug("Reqest state : "+_this._request.readyState );

Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js	2008-12-08 17:24:32 UTC (rev 11649)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js	2008-12-08 17:34:44 UTC (rev 11650)
@@ -121,6 +121,10 @@
 			
 			setEventsCount: function(newCount) {
 				this.eventsCount = newCount;
+			},
+			
+			getEventArguments: function() {
+				return [this.query, this.options, this.event];
 			}
 		});
 		
@@ -161,7 +165,11 @@
 			}
 		},
 		
-		getQueueSize: function() {
+		getSize: function() {
+			return this.items.length;
+		},
+		
+		getMaximumSize: function() {
 			return this.queueOptions.size;
 		},
 		
@@ -174,6 +182,24 @@
 			return policy;
 		},
 		
+		queue: function(entry) {
+			this.items.push(entry);
+			
+			if (this.queueOptions.onrequestqueue) {
+				LOG.debug("Call onrequestqueue handler");
+				this.queueOptions.onrequestqueue.apply(this, entry.getEventArguments());
+			}
+		},
+		
+		dequeue: function() {
+			var entry = this.items.shift();
+			
+			if (this.queueOptions.onrequestdequeue) {
+				LOG.debug("Call onrequestdequeue handler");
+				this.queueOptions.onrequestdequeue.apply(this, entry.getEventArguments());
+			}
+		},
+
 		push: function(query, opts, event) {
 			var options = extendOptions.call(this, opts);
 			
@@ -198,7 +224,7 @@
 							LOG.debug("Current request in queue '" + this.name + "' has been aborted");
 							
 							//remove last (that is actually first) from queue - will be safer to do that in LinkedList
-							this.items.shift();
+							this.dequeue();
 						}
 					} else {
 						LOG.debug("Combine similar requests and reset timer");
@@ -231,7 +257,7 @@
 					}
 					
 					if (this.queueOptions.onsizeexceeded) {
-						this.queueOptions.onsizeexceeded.call(this, query, opts, event);
+						this.queueOptions.onsizeexceeded.apply(this, entry.getEventArguments());
 					}
 					// TODO: create one function that will be implement this functionality // function (behaviorFlag, entry): should return handled flag
 					if (b == DROP_NEW) {
@@ -274,7 +300,7 @@
 			}
 
 			if (!handled) {
-				this.items.push(entry);
+				this.queue(entry);
 
 				LOG.debug("New request added to queue '" + this.name + "'. Queue similarityGroupingId changed to " + similarityGroupingId);
 				
@@ -285,7 +311,7 @@
 		pop: function() {
 			LOG.debug("After request: queue '" + this.name + "'");
 
-			this.items.shift();
+			this.dequeue();
 			
 			LOG.debug("There are " + this.items.length + " requests more in this queue");
 			




More information about the richfaces-svn-commits mailing list