Author: abelevich
Date: 2011-02-10 01:56:41 -0500 (Thu, 10 Feb 2011)
New Revision: 21583
Added:
trunk/examples/core-demo/src/main/java/org/richfaces/demo/AttachQueueBean.java
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js
trunk/core/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js
trunk/examples/core-demo/src/main/webapp/attachQueue.xhtml
Log:
https://issues.jboss.org/browse/RF-10421 a4j:attachQueue - @requestGroupId doesn't
work
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2011-02-10
04:31:43 UTC (rev 21582)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2011-02-10
06:56:41 UTC (rev 21583)
@@ -121,15 +121,15 @@
}
}
- if (typeof this.queueOptions.requestGroupId == "undefined") {
- this.queueOptions.requestGroupId = typeof this.source == "string" ?
this.source : this.source.id;
+ if (typeof this.queueOptions.requestGroupingId == "undefined") {
+ this.queueOptions.requestGroupingId = typeof this.source == "string" ?
this.source : this.source.id;
}
// copy of event should be created otherwise IE will fail
this.event = $.extend({}, event);
- //requestGroupId is mutable, thus we need special field for it
- this.requestGroupId = this.queueOptions.requestGroupId;
+ //requestGroupingId is mutable, thus we need special field for it
+ this.requestGroupingId = this.queueOptions.requestGroupingId;
this.eventsCount = 1;
};
@@ -140,15 +140,15 @@
},
getRequestGroupId: function() {
- return this.requestGroupId;
+ return this.requestGroupingId;
},
setRequestGroupId: function(id) {
- this.requestGroupId = id;
+ this.requestGroupingId = id;
},
resetRequestGroupId: function() {
- this.requestGroupId = undefined;
+ this.requestGroupingId = undefined;
},
setReadyToSubmit: function(isReady) {
@@ -306,7 +306,7 @@
var pushEntry = function (entry) {
items.push(entry);
- log.debug("New request added to queue. Queue requestGroupId changed to " +
entry.getRequestGroupId());
+ log.debug("New request added to queue. Queue requestGroupingId changed to "
+ entry.getRequestGroupId());
// call event handlers
callEventHandler("onrequestqueue", entry);
}
@@ -362,12 +362,12 @@
* */
push: function (source, event, options) {
var entry = new QueueEntry(this, source, event, options);
- var requestGroupId = entry.getRequestGroupId();
+ var requestGroupingId = entry.getRequestGroupId();
var lastEntry = getLastEntry();
if (lastEntry) {
- if (lastEntry.getRequestGroupId() == requestGroupId) {
+ if (lastEntry.getRequestGroupId() == requestGroupingId) {
log.debug("Similar request currently in queue");
log.debug("Combine similar requests and reset timer");
Modified: trunk/core/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js
===================================================================
---
trunk/core/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js 2011-02-10
04:31:43 UTC (rev 21582)
+++
trunk/core/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js 2011-02-10
06:56:41 UTC (rev 21583)
@@ -96,7 +96,7 @@
jsf.ajax.eventHandlers[i]({type:"event", status:"success"});
}
equals(typeof options.queueId, "undefined", "options.queueId");
- equals(typeof options.requestGroupId, "undefined",
"options.requestGroupId");
+ equals(typeof options.requestGroupingId, "undefined",
"options.requestGroupingId");
equals(options.param, "value", "options.param");
}
@@ -106,7 +106,7 @@
'</table>'+
'</form>');
- var options1 = {param:"value1", requestGroupId: 999};
+ var options1 = {param:"value1", requestGroupingId: 999};
RichFaces.queue.setQueueOptions({'testQueueId1': options1});
document.getElementById("testButton2").click({type:"onclick"});
RichFaces.queue.clear();
@@ -121,7 +121,7 @@
jsf.ajax.eventHandlers[i]({type:"event", status:"success"});
}
equals(typeof options.queueId, "undefined", "options.queueId");
- equals(typeof options.requestGroupId, "undefined",
"options.requestGroupId");
+ equals(typeof options.requestGroupingId, "undefined",
"options.requestGroupingId");
equals(options.param, "newValue", "options.param");
}
@@ -131,8 +131,8 @@
'</table>'+
'</form>');
- var options1 = {queueId: 'testQueueId2', param:"value1",
requestGroupId: 888};
- var options2 = {param:"value1", requestGroupId: 777};
+ var options1 = {queueId: 'testQueueId2', param:"value1",
requestGroupingId: 888};
+ var options2 = {param:"value1", requestGroupingId: 777};
RichFaces.queue.setQueueOptions({'testQueueId1': options1,
'testQueueId2': options2});
document.getElementById("testButton3").click({type:"onclick"});
@@ -181,8 +181,8 @@
Timer.endSimulation();
});
- //jsf.ajax.request - equal requestGroupId
- test("jsf.ajax.request - equal requestGroupId", function() {
+ //jsf.ajax.request - equal requestGroupingId
+ test("jsf.ajax.request - equal requestGroupingId", function() {
Timer.beginSimulation();
var time;
var newTime;
@@ -217,7 +217,7 @@
'</table>'+
'</form>');
- var options1 = {requestGroupId: 888, requestDelay:1000};
+ var options1 = {requestGroupingId: 888, requestDelay:1000};
RichFaces.queue.setQueueOptions({'testQueueId1': options1});
window.setTimeout(onTimeOut, 2000);
@@ -228,8 +228,8 @@
Timer.endSimulation();
});
- //jsf.ajax.request - not equal requestGroupId
- test("jsf.ajax.request - not equal requestGroupId", function() {
+ //jsf.ajax.request - not equal requestGroupingId
+ test("jsf.ajax.request - not equal requestGroupingId", function() {
Timer.beginSimulation();
var time;
var newTime;
@@ -275,8 +275,8 @@
'</table>'+
'</form>');
- var options1 = {requestGroupId: 888, requestDelay:1000};
- var options2 = {requestGroupId: 999, requestDelay:1000};
+ var options1 = {requestGroupingId: 888, requestDelay:1000};
+ var options2 = {requestGroupingId: 999, requestDelay:1000};
RichFaces.queue.setQueueOptions({'testQueueId1': options1,
'testQueueId2': options2});
window.setTimeout(onTimeOut, 2000);
Added: trunk/examples/core-demo/src/main/java/org/richfaces/demo/AttachQueueBean.java
===================================================================
--- trunk/examples/core-demo/src/main/java/org/richfaces/demo/AttachQueueBean.java
(rev 0)
+++
trunk/examples/core-demo/src/main/java/org/richfaces/demo/AttachQueueBean.java 2011-02-10
06:56:41 UTC (rev 21583)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+@ManagedBean
+@SessionScoped
+public class AttachQueueBean {
+ String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Modified: trunk/examples/core-demo/src/main/webapp/attachQueue.xhtml
===================================================================
--- trunk/examples/core-demo/src/main/webapp/attachQueue.xhtml 2011-02-10 04:31:43 UTC
(rev 21582)
+++ trunk/examples/core-demo/src/main/webapp/attachQueue.xhtml 2011-02-10 06:56:41 UTC
(rev 21583)
@@ -9,8 +9,29 @@
<h:head>
</h:head>
<h:body>
+ <a4j:queue requestDelay="750"></a4j:queue>
<h:form id="form">
+ <h:panelGrid columns="2">
+ <a4j:commandButton value="Set Name to Alex" render="rep
">
+ <a4j:attachQueue requestGroupingId="group1"
requestDelay="5000"/>
+ <a4j:param name="username" value="Alex"
assignTo="#{attachQueueBean.name}" />
+ <a4j:param name="username" value="Alex"
assignTo="#{attachQueueBean.name1}" />
+ </a4j:commandButton>
+
+ <a4j:commandButton value="Set Name to John" render="rep
">
+ <a4j:attachQueue requestGroupingId="group1"
requestDelay="5000" />
+ <a4j:param name="username" value="John"
assignTo="#{attachQueueBean.name1}" />
+ </a4j:commandButton>
+ </h:panelGrid>
+
+ <div>
+ <h:outputText id="rep" value="Selected
Name:#{attachQueueBean.name}" />
+ <h:outputText id="rep" value="Selected
Name:#{attachQueueBean.name}" />
+ <h:outputText id="rep" value="Selected
Name:#{attachQueueBean.name}" />
+
+ </div>
+
<a4j:ajax>
<h:inputText />