JBoss Rich Faces SVN: r11340 - in trunk/ui/core/src: main/java/org/ajax4jsf/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-24 17:45:49 -0500 (Mon, 24 Nov 2008)
New Revision: 11340
Added:
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java
Log:
Queue code refactored
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java (from rev 11305, trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIQueue.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java 2008-11-24 22:45:49 UTC (rev 11340)
@@ -0,0 +1,115 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public abstract class UIQueue extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Queue";
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Queue";
+
+ public abstract String getName();
+ public abstract void setName(String name);
+
+ public abstract String getOnsubmit();
+ public abstract void setOnsubmit(String onsubmit);
+
+ public abstract String getOncomplete();
+ public abstract void setOncomplete(String oncomplete);
+
+ public abstract String getOnbeforedomupdate();
+ public abstract void setOnbeforedomupdate(String onbeforedomupdate);
+
+ public abstract String getOnerror();
+ public abstract void setOnerror(String onerror);
+
+ public abstract String getOnsizeexceeded();
+ public abstract void setOnsizeexceeded(String onsizeexceeded);
+
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+
+ public abstract int getSize();
+ public abstract void setSize(int size);
+
+ public abstract String getSizeExceededBehavior();
+ public abstract void setSizeExceededBehavior(String behavior);
+
+ public abstract int getTimeout();
+ public abstract void setTimeout(int timeout);
+
+ public abstract int getRequestDelay();
+ public abstract void setRequestDelay(int requestDelay);
+
+ public abstract boolean isIgnoreDupResponses();
+ public abstract void setIgnoreDupResponses(boolean ignoreDupResponses);
+
+
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ private UIComponent findParentForm() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIForm)) {
+ component = component.getParent();
+ }
+
+ return component;
+ }
+
+ public String getClientName(FacesContext context) {
+ UIComponent form = findParentForm();
+ String name = getName();
+ String clientName;
+
+ if (form != null) {
+ String formClientId = form.getClientId(context);
+
+ if (name != null && name.length() != 0) {
+ clientName = formClientId + NamingContainer.SEPARATOR_CHAR + name;
+ } else {
+ clientName = formClientId;
+ }
+ } else {
+ if (name == null || name.length() == 0) {
+ name = QueueRegistry.GLOBAL_QUEUE_NAME;
+ }
+
+ clientName = context.getExternalContext().encodeNamespace(name);
+ }
+
+ return clientName;
+ }
+}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-11-24 20:46:10 UTC (rev 11339)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-11-24 22:45:49 UTC (rev 11340)
@@ -175,8 +175,9 @@
UIQueue queue = (UIQueue) component;
if (!queue.isDisabled()) {
- QueueRegistry.registerQueue(context, queue.getClientName(context),
- createRendererData(context, queue));
+ QueueRegistry.getInstance(context).registerQueue(context,
+ queue.getClientName(context),
+ createRendererData(context, queue));
}
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 20:46:10 UTC (rev 11339)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 22:45:49 UTC (rev 11340)
@@ -95,9 +95,9 @@
if (requestMap.get(resourceKey) == null) {
requestMap.put(resourceKey, Boolean.TRUE);
- Map<String, Object> queues = QueueRegistry.getRegisteredQueues(context);
- if (queues != null && !queues.isEmpty()) {
- super.encode(resource, context, queues, attributes);
+ QueueRegistry queueRegistry = QueueRegistry.getInstance(context);
+ if (queueRegistry.hasRegisteredQueues()) {
+ super.encode(resource, context, queueRegistry.getRegisteredQueues(context), attributes);
}
}
}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java 2008-11-24 20:46:10 UTC (rev 11339)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java 2008-11-24 22:45:49 UTC (rev 11340)
@@ -128,7 +128,7 @@
HtmlPage page = renderView();
String queueScript = getQueueScript(page);
- assertEquals(createQueueInitString(UIQueue.GLOBAL_QUEUE_NAME, null, null), queueScript);
+ assertEquals(createQueueInitString(QueueRegistry.GLOBAL_QUEUE_NAME, null, null), queueScript);
}
public void testFormQueueName() throws Exception {
17 years, 1 month
JBoss Rich Faces SVN: r11339 - trunk/framework/impl/src/main/java/org/ajax4jsf/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-24 15:46:10 -0500 (Mon, 24 Nov 2008)
New Revision: 11339
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
Log:
QueueScript requested and encoded only if there are some queues
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-11-24 20:22:29 UTC (rev 11338)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-11-24 20:46:10 UTC (rev 11339)
@@ -459,14 +459,18 @@
Map<String, Object> queues = QueueRegistry.getRegisteredQueues(context);
if (Boolean.valueOf(getInitParameterValue(context, "org.richfaces.queue.global.enabled"))) {
String encodedGlobalQueueName = context.getExternalContext().encodeNamespace(UIQueue.GLOBAL_QUEUE_NAME);
-
+
+ //TODO opimize this
if (queues == null || !queues.containsKey(encodedGlobalQueueName)) {
QueueRegistry.registerQueue(context, encodedGlobalQueueName, null);
}
}
- InternetResource queueScriptResource = resourceBuilder.getResource(QUEUE_SCRIPT_RESOURCE);
- queueScriptResource.encode(context, null);
+ queues = QueueRegistry.getRegisteredQueues(context);
+ if (queues != null && !queues.isEmpty()) {
+ InternetResource queueScriptResource = resourceBuilder.getResource(QUEUE_SCRIPT_RESOURCE);
+ queueScriptResource.encode(context, queues);
+ }
// Append Skin StyleSheet after a
if (null != skinStyleSheetUri) {
17 years, 1 month
JBoss Rich Faces SVN: r11338 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-24 15:22:29 -0500 (Mon, 24 Nov 2008)
New Revision: 11338
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
Log:
Several logging statements added to queue
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-24 20:00:12 UTC (rev 11337)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-24 20:22:29 UTC (rev 11338)
@@ -11,10 +11,12 @@
//queue constructor
A4J.AJAX.EventQueue = function() {
- var Pipeline = function(size, gate) {
+ var Pipeline = function(size, gate, queue) {
this.size = size || -1;
this.gate = gate;
+ this.queue = queue;
+
this.items = new Array();
};
@@ -29,6 +31,7 @@
},
createRequest: function(data) {
+ LOG.debug("Queue '" + this.queue.name + "' will submit request NOW");
this.request = data.submit();
this.similarityGroupingId = data.getSimilarityGroupingId();
this.request.shouldNotifyQueue = true;
@@ -77,6 +80,7 @@
submitNext: function() {
this.clearRequest();
+ LOG.debug("After request: queue '" + this.queue.name + "'");
if (this.getSize() > 0) {
this.submit();
@@ -99,6 +103,8 @@
abortCurrentRequest: function() {
if (this.request) {
+ LOG.debug("Current request in queue '" + this.queue.name + "' has been aborted");
+
this.request.shouldNotifyQueue = false;
this.request.abort();
this.clearRequest();
@@ -113,7 +119,9 @@
}
}());
- var Gate = function() {
+ var Gate = function(queue) {
+ this.queue = queue;
+
this.eventsCounter = 0;
};
@@ -135,6 +143,9 @@
startRequestDelay: function() {
var delay = this.data.getRequestDelay();
+
+ LOG.debug("Queue will wait " + (delay || 0) + "ms before submit");
+
if (delay) {
var _this = this;
this.timer = setTimeout(function() {
@@ -191,11 +202,13 @@
var similarityGroupingId = data.getSimilarityGroupingId();
if (this.similarityGroupingId == similarityGroupingId) {
+ LOG.debug("Similar request already in queue '" + this.queue.name + "'");
this.data = data;
data.setEventsCounter(++this.eventsCounter);
this.resetRequestDelay();
} else {
+ LOG.debug("New event added to queue '" + this.queue.name + "'. Queue similarityGroupingId changed to " + similarityGroupingId);
if (this.data) {
this.stopRequestDelay();
this.pipeline.addEvent(this.pop());
@@ -206,7 +219,7 @@
if (this.pipeline.isFull()) {
var behavior = data.getSizeExceededBehavior();
- var queue = data.queue;
+ var queue = this.queue;
var queueOptions = queue.queueOptions;
if (queueOptions.onsizeexceeded) {
@@ -214,7 +227,7 @@
var options = data.options;
var event = data.event;
- queueOptions.onsizeexceeded.call(data.queue, query, options, event);
+ queueOptions.onsizeexceeded.call(this.queue, query, options, event);
}
if (behavior == DROP_NEW ||
@@ -251,8 +264,8 @@
this.queueOptions = queueOptions || {};
this.requestOptions = requestOptions || {};
- this.gate = new Gate();
- this.pipeline = new Pipeline(this.queueOptions.size, this.gate);
+ this.gate = new Gate(this);
+ this.pipeline = new Pipeline(this.queueOptions.size, this.gate, this);
this.gate.pipeline = this.pipeline;
};
}();
@@ -278,8 +291,6 @@
delete A4J.AJAX._eventQueues[name];
};
-//TODO A4J.AJAX.EventQueue.getQueue ?
-
A4J.AJAX.EventQueue.getOrCreateQueue = function(){
var qualifyName = function(name, prefix) {
if (prefix) {
@@ -328,106 +339,7 @@
}
}();
-
A4J.AJAX.EventQueue.prototype = function() {
-
-
- /*
- * Queue: {
- * pop: {
- * pop();
- * barrier.unlock();
- *
- * if (!empty) {
- * submit();
- * } else {
- * barrier.transferIfReady();
- * }
- * },
- *
- * push: {
- * if (full) {
- * throw e;
- * }
- *
- * push();
- *
- * if (full) {
- * barrier.lock();
- * }
- *
- * if (!submitted) {
- * submit();
- * }
- * }
- *
- * submit: {
- * submit();
- * }
- *
- * }
- *
- * Barrier: {
- * match: {
- * //not matches if empty
- * }
- *
- * push: {
- * if (match()) {
- * //queue size stays the same
- *
- * assign();
- * increaseCounter();
- *
- * //reset can do immediate transfer
- * clearTimeout();
- * setTimeout(transferIfQueueEmpty())
- * } else {
- * //queue size increased by one
- *
- * if (!empty) {
- * clearTimeout();
- * delayPassed = true;
- * transfer();
- * }
- *
- * if (locked) {
- * //special unlock case when size = 1
- * unlock();
- * }
- *
- * assign();
- * setTimeout(transferIfQueueEmpty())
- * }
- * }
- *
- * pop: {
- * applyCounter();
- * resetCounter();
- * delayPassed = false;
- * empty = true;
- * }
- *
- * transfer: {
- * queue.push(pop());
- * }
- *
- * transferIfQueueEmpty: {
- * if (queue.isEmpty()) {
- * transfer();
- * } else {
- * delayPassed = true;
- * }
- * }
- *
- * transferIfReady: {
- * if (delayPassed) {
- * transfer();
- * }
- * }
- * }
- */
-
var EventQueueData = function(queue, query, options, event) {
this.queue = queue;
this.query = query;
@@ -477,9 +389,11 @@
// LOG.debug("Queue will wait " + (delay || 0) + "ms before submit");
// LOG.debug("Similar request already in queue '" + this.name + "'");
+
// LOG.debug("After request: queue '" + this.name + "' is empty now");
// LOG.debug("Deleting transient queue '" + this.name + "' from queues registry");
// LOG.debug("After request: queue not empty, processing next event in queue '" + this.name + "'");
+
// LOG.debug("Queue '" + this.name + "' will submit request NOW");
// LOG.debug("Delay for request not passed yet, have to wait");
// LOG.debug("Queue '" + this.name + "' is empty, nothing to submit");
17 years, 1 month
JBoss Rich Faces SVN: r11337 - trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-24 15:00:12 -0500 (Mon, 24 Nov 2008)
New Revision: 11337
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
Log:
Added namespace encoding for queue script client id in non-ajax requests
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 19:34:21 UTC (rev 11336)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 20:00:12 UTC (rev 11337)
@@ -33,6 +33,7 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
@@ -101,12 +102,23 @@
}
}
+ private String encodeQueueScriptId(FacesContext context) {
+ String encodedId = QUEUE_SCRIPT_ID;
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if (!ajaxContext.isAjaxRequest()) {
+ encodedId = context.getExternalContext().encodeNamespace(encodedId);
+ }
+
+ return encodedId;
+ }
+
@Override
public void encode(InternetResource resource, FacesContext context,
Object data, Map<String, Object> attributes) throws IOException {
Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
- newAttributes.put(HTML.id_ATTRIBUTE, context.getExternalContext().encodeNamespace(QUEUE_SCRIPT_ID));
+ newAttributes.put(HTML.id_ATTRIBUTE, encodeQueueScriptId(context));
doEncode(resource, context, data, newAttributes);
}
@@ -116,8 +128,7 @@
Object data) throws IOException {
doEncode(resource, context, data,
- Collections.singletonMap(HTML.id_ATTRIBUTE,
- (Object) context.getExternalContext().encodeNamespace(QUEUE_SCRIPT_ID)));
+ Collections.singletonMap(HTML.id_ATTRIBUTE, (Object) encodeQueueScriptId(context)));
}
@Override
17 years, 1 month
JBoss Rich Faces SVN: r11336 - in trunk/ui/core: src/main/java/org/ajax4jsf/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-24 14:34:21 -0500 (Mon, 24 Nov 2008)
New Revision: 11336
Added:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
Removed:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRegistry.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
Modified:
trunk/ui/core/pom.xml
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4957
https://jira.jboss.org/jira/browse/RF-5049
Modified: trunk/ui/core/pom.xml
===================================================================
--- trunk/ui/core/pom.xml 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/pom.xml 2008-11-24 19:34:21 UTC (rev 11336)
@@ -40,16 +40,6 @@
</library>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- TODO uncomment this -->
- <exclude>**/ImplicitQueuesTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
</plugins>
</build>
<dependencies>
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRegistry.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRegistry.java 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRegistry.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -1,64 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-package org.ajax4jsf.renderkit.html;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueRegistry {
-
- private static final String REGISTRY_ATTRIBUTE_NAME = QueueRegistry.class.getName();
-
- public static void registerQueue(FacesContext context, String clientName, QueueRendererData data) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- Map<String, QueueRendererData> registryMap = (Map<String, QueueRendererData>)
- requestMap.get(REGISTRY_ATTRIBUTE_NAME);
-
- if (registryMap == null) {
- registryMap = new LinkedHashMap<String, QueueRendererData>();
- requestMap.put(REGISTRY_ATTRIBUTE_NAME, registryMap);
- }
-
- if (!registryMap.containsKey(clientName)) {
- registryMap.put(clientName, data);
- } else {
- context.getExternalContext().log("Queue with name '" + clientName + "' has already been registered");
- }
- }
-
- public static Map<String, QueueRendererData> getRegisteredQueues(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- return (Map<String, QueueRendererData>) requestMap.get(REGISTRY_ATTRIBUTE_NAME);
- }
-}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -27,6 +27,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.component.QueueRegistry;
import org.ajax4jsf.component.UIQueue;
import org.ajax4jsf.javascript.AjaxScript;
import org.ajax4jsf.javascript.JSFunctionDefinition;
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -1,61 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-package org.ajax4jsf.renderkit.html;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * @author Denis Morozov
- * @since 3.3.0
- */
-public class QueueRendererData {
-
- private Map<String, Object> queueAttributes;
-
- private Map<String, Object> requestAttributes;
-
- public void addQueueAttribute(String key, Object value) {
- if (queueAttributes == null) {
- queueAttributes = new LinkedHashMap<String, Object>();
- }
-
- queueAttributes.put(key, value);
- }
-
- public void addRequestAttribute(String key, Object value) {
- if (requestAttributes == null) {
- requestAttributes = new LinkedHashMap<String, Object>();
- }
-
- requestAttributes.put(key, value);
- }
-
- public Map<String, Object> getQueueAttributes() {
- return queueAttributes;
- }
-
- public Map<String, Object> getRequestAttributes() {
- return requestAttributes;
- }
-}
Added: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.ajax4jsf.renderkit.html;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author Denis Morozov
+ * @since 3.3.0
+ */
+public class QueueRendererData {
+
+ private Map<String, Object> queueAttributes;
+
+ private Map<String, Object> requestAttributes;
+
+ public void addQueueAttribute(String key, Object value) {
+ if (queueAttributes == null) {
+ queueAttributes = new LinkedHashMap<String, Object>();
+ }
+
+ queueAttributes.put(key, value);
+ }
+
+ public void addRequestAttribute(String key, Object value) {
+ if (requestAttributes == null) {
+ requestAttributes = new LinkedHashMap<String, Object>();
+ }
+
+ requestAttributes.put(key, value);
+ }
+
+ public Map<String, Object> getQueueAttributes() {
+ return queueAttributes;
+ }
+
+ public Map<String, Object> getRequestAttributes() {
+ return requestAttributes;
+ }
+}
Property changes on: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -1,52 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.renderkit.html.scripts;
-
-import org.ajax4jsf.resource.InternetResourceBase;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.resource.ResourceRenderer;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueScript extends InternetResourceBase {
-
- private static final ResourceRenderer renderer = new QueueScriptResourceRenderer();
-
- private String key = getClass().getName();
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public ResourceRenderer getRenderer(ResourceContext resourceContext) {
- return renderer;
- }
-
- @Override
- public boolean isCacheable(ResourceContext resourceContext) {
- return false;
- }
-}
Added: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.renderkit.html.scripts;
+
+import org.ajax4jsf.resource.InternetResourceBase;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.resource.ResourceRenderer;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueScript extends InternetResourceBase {
+
+ private static final ResourceRenderer renderer = new QueueScriptResourceRenderer();
+
+ private String key = getClass().getName();
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public ResourceRenderer getRenderer(ResourceContext resourceContext) {
+ return renderer;
+ }
+
+ @Override
+ public boolean isCacheable(ResourceContext resourceContext) {
+ return false;
+ }
+}
Property changes on: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -1,159 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-package org.ajax4jsf.renderkit.html.scripts;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.UIQueue;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.renderkit.html.QueueRegistry;
-import org.ajax4jsf.renderkit.html.QueueRendererData;
-import org.ajax4jsf.resource.BaseResourceRenderer;
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueScriptResourceRenderer extends BaseResourceRenderer {
-
- //TODO rename?
- public static final String QUEUE_SCRIPT_ID = "richfaces:ajaxqueues";
-
- private void encodeQueue(ResponseWriter writer, String queueName, QueueRendererData queueData)
- throws IOException {
-
- Map<String, Object> queueAttributes = null;
- Map<String, Object> requestAttributes = null;
-
- if (queueData != null) {
- queueAttributes = queueData.getQueueAttributes();
- requestAttributes = queueData.getRequestAttributes();
- }
-
- writer.writeText("A4J.AJAX.EventQueue.addQueue(", null);
- writer.writeText(
- new JSObject("A4J.AJAX.EventQueue",
- queueName,
- queueAttributes,
- requestAttributes
- ).toScript(), null);
- writer.writeText(");", null);
- }
-
- @Override
- protected void customEncode(InternetResource resource,
- FacesContext context, Object data) throws IOException {
- super.customEncode(resource, context, data);
-
- ResponseWriter writer = context.getResponseWriter();
-
- Map<String, QueueRendererData> queues = QueueRegistry.getRegisteredQueues(context);
-
- ExternalContext externalContext = context.getExternalContext();
- if (Boolean.valueOf(externalContext.getInitParameter("org.richfaces.queue.global.enabled"))) {
- String encodedGlobalQueueName = externalContext.encodeNamespace(UIQueue.GLOBAL_QUEUE_NAME);
-
- if (queues == null || !queues.containsKey(encodedGlobalQueueName)) {
- encodeQueue(writer, encodedGlobalQueueName, null);
- }
- }
-
- if (queues != null && !queues.isEmpty()) {
- for (Entry<String, QueueRendererData> entry : queues.entrySet()) {
- encodeQueue(writer, entry.getKey(), entry.getValue());
- }
- }
- }
-
- protected void doEncode(InternetResource resource, FacesContext context,
- Object data, Map<String, Object> attributes) throws IOException {
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- //TODO nick - what if ajax request?
- if (!ajaxContext.isAjaxRequest(context)) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- String resourceKey = resource.getKey();
- if (requestMap.get(resourceKey) == null) {
- requestMap.put(resourceKey, Boolean.TRUE);
-
- super.encode(resource, context, data, attributes);
- }
- } else {
- context.getExternalContext().log("");
- }
- }
-
- @Override
- public void encode(InternetResource resource, FacesContext context,
- Object data, Map<String, Object> attributes) throws IOException {
-
- Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
- newAttributes.put(HTML.id_ATTRIBUTE, context.getExternalContext().encodeNamespace(QUEUE_SCRIPT_ID));
-
- doEncode(resource, context, data, newAttributes);
- }
-
- @Override
- public void encode(InternetResource resource, FacesContext context,
- Object data) throws IOException {
-
- doEncode(resource, context, data,
- Collections.singletonMap(HTML.id_ATTRIBUTE,
- (Object) context.getExternalContext().encodeNamespace(QUEUE_SCRIPT_ID)));
- }
-
- @Override
- protected String[][] getCommonAttrs() {
- return new String[][] {
- {HTML.TYPE_ATTR, getContentType()},
- };
- }
-
- @Override
- protected String getHrefAttr() {
- return null;
- }
-
- @Override
- protected String getTag() {
- return HTML.SCRIPT_ELEM;
- }
-
- public String getContentType() {
- return "text/javascript";
- }
-
-}
Added: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -0,0 +1,144 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.ajax4jsf.renderkit.html.scripts;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.javascript.JSObject;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.html.QueueRendererData;
+import org.ajax4jsf.resource.BaseResourceRenderer;
+import org.ajax4jsf.resource.InternetResource;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueScriptResourceRenderer extends BaseResourceRenderer {
+
+ public static final String QUEUE_SCRIPT_ID = "org.ajax4jsf.queue_script";
+
+ private void encodeQueue(ResponseWriter writer, String queueName, QueueRendererData queueData)
+ throws IOException {
+
+ Map<String, Object> queueAttributes = null;
+ Map<String, Object> requestAttributes = null;
+
+ if (queueData != null) {
+ queueAttributes = queueData.getQueueAttributes();
+ requestAttributes = queueData.getRequestAttributes();
+ }
+
+ writer.writeText("if (!EventQueue.getQueue(" + ScriptUtils.toScript(queueName) + ")) { EventQueue.addQueue(", null);
+ writer.writeText(
+ new JSObject("EventQueue",
+ queueName,
+ queueAttributes,
+ requestAttributes
+ ).toScript(), null);
+ writer.writeText(") };", null);
+ }
+
+ @Override
+ protected void customEncode(InternetResource resource,
+ FacesContext context, Object data) throws IOException {
+ super.customEncode(resource, context, data);
+
+ Map<String, Object> queues = (Map<String, Object>) data;
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.writeText("with (A4J.AJAX) {", null);
+ for (Entry<String, Object> entry : queues.entrySet()) {
+ encodeQueue(writer, entry.getKey(), (QueueRendererData) entry.getValue());
+ }
+ writer.writeText("};", null);
+ }
+
+ protected void doEncode(InternetResource resource, FacesContext context,
+ Object data, Map<String, Object> attributes) throws IOException {
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ String resourceKey = resource.getKey();
+ if (requestMap.get(resourceKey) == null) {
+ requestMap.put(resourceKey, Boolean.TRUE);
+
+ Map<String, Object> queues = QueueRegistry.getRegisteredQueues(context);
+ if (queues != null && !queues.isEmpty()) {
+ super.encode(resource, context, queues, attributes);
+ }
+ }
+ }
+
+ @Override
+ public void encode(InternetResource resource, FacesContext context,
+ Object data, Map<String, Object> attributes) throws IOException {
+
+ Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
+ newAttributes.put(HTML.id_ATTRIBUTE, context.getExternalContext().encodeNamespace(QUEUE_SCRIPT_ID));
+
+ doEncode(resource, context, data, newAttributes);
+ }
+
+ @Override
+ public void encode(InternetResource resource, FacesContext context,
+ Object data) throws IOException {
+
+ doEncode(resource, context, data,
+ Collections.singletonMap(HTML.id_ATTRIBUTE,
+ (Object) context.getExternalContext().encodeNamespace(QUEUE_SCRIPT_ID)));
+ }
+
+ @Override
+ protected String[][] getCommonAttrs() {
+ return new String[][] {
+ {HTML.TYPE_ATTR, getContentType()},
+ };
+ }
+
+ @Override
+ protected String getHrefAttr() {
+ return null;
+ }
+
+ @Override
+ protected String getTag() {
+ return HTML.SCRIPT_ELEM;
+ }
+
+ public String getContentType() {
+ return "text/javascript";
+ }
+
+}
Property changes on: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java 2008-11-24 19:33:30 UTC (rev 11335)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java 2008-11-24 19:34:21 UTC (rev 11336)
@@ -48,10 +48,6 @@
return s.replace(" ", "");
}
- private static final String QUEUE_INIT_PROLOG = "A4J.AJAX.EventQueue.addQueue(new A4J.AJAX.EventQueue(";
-
- private static final String QUEUE_INIT_PROLOG_DRIED = dry(QUEUE_INIT_PROLOG);
-
/**
* @param name
*/
@@ -86,9 +82,35 @@
private String getQueueScript(HtmlPage page) throws JaxenException {
List<?> list = page.getByXPath("//head/script[@id='" + QueueScriptResourceRenderer.QUEUE_SCRIPT_ID + "']/text()");
DomText text = (DomText) list.get(0);
- return text.getData();
+ String scriptData = text.getData();
+
+ return scriptData.replaceAll("^\\Qwith (A4J.AJAX) {\\E|\\Q};\\E$", "");
}
+
+ private String[] splitScript(String s) {
+ String[] split = s.split(";");
+ for (int i = 0; i < split.length; i++) {
+ split[i] = split[i] + ";";
+ }
+
+ return split;
+ }
+
+ private String createQueueInitString(String queueName, String queueParams, String requestParams) {
+ StringBuilder builder = new StringBuilder("if (!EventQueue.getQueue('").append(queueName).append("')) { EventQueue.addQueue(new EventQueue('").
+ append(queueName).append("'");
+ builder.append(",");
+ builder.append(String.valueOf(queueParams));
+
+ builder.append(",");
+ builder.append(String.valueOf(requestParams));
+
+ builder.append(")) };");
+
+ return builder.toString();
+ }
+
public void testViewQueueName() throws Exception {
UIQueue queue = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
queue.setName("test_view_queue");
@@ -96,7 +118,8 @@
HtmlPage page = renderView();
String queueScript = getQueueScript(page);
- assertTrue(queueScript.startsWith(QUEUE_INIT_PROLOG + "'test_view_queue'"));
+
+ assertEquals(createQueueInitString("test_view_queue", null, null), queueScript);
}
public void testViewQueueDefaultName() throws Exception {
@@ -105,7 +128,7 @@
HtmlPage page = renderView();
String queueScript = getQueueScript(page);
- assertTrue(queueScript.startsWith(QUEUE_INIT_PROLOG + "'" + UIQueue.GLOBAL_QUEUE_NAME + "'"));
+ assertEquals(createQueueInitString(UIQueue.GLOBAL_QUEUE_NAME, null, null), queueScript);
}
public void testFormQueueName() throws Exception {
@@ -115,7 +138,7 @@
HtmlPage page = renderView();
String queueScript = getQueueScript(page);
- assertTrue(queueScript.startsWith(QUEUE_INIT_PROLOG + "'theform:test_view_queue'"));
+ assertEquals(createQueueInitString("theform:test_view_queue", null, null), queueScript);
}
public void testFormQueueDefaultName() throws Exception {
@@ -124,7 +147,7 @@
HtmlPage page = renderView();
String queueScript = getQueueScript(page);
- assertTrue(queueScript.startsWith(QUEUE_INIT_PROLOG + "'theform'"));
+ assertEquals(createQueueInitString("theform", null, null), queueScript);
}
public void testRenderQueueAttributes() throws Exception {
@@ -146,18 +169,17 @@
HtmlPage page = renderView();
String queueScript = dry(getQueueScript(page));
- String[] scripts = queueScript.split(";");
+ String[] scripts = splitScript(queueScript);
assertEquals(3, scripts.length);
- assertEquals(QUEUE_INIT_PROLOG_DRIED +
- "'theform',{'size':10,'sizeExceededBehavior':'dropNext','onsizeexceeded':function(query,options,event){sizeexceeded_handler()}},null))",
+ assertEquals(dry(createQueueInitString("theform",
+ "{'size':10,'sizeExceededBehavior':'dropNext','onsizeexceeded':function(query,options,event){sizeexceeded_handler()}}",
+ null)),
scripts[0]);
- assertEquals(QUEUE_INIT_PROLOG_DRIED +
- "'theform:unsizedQueue',{'size':-1},null))", scripts[1]);
+ assertEquals(dry(createQueueInitString("theform:unsizedQueue", "{'size':-1}", null)), scripts[1]);
- assertEquals(QUEUE_INIT_PROLOG_DRIED +
- "'theform:defaultSizeQueue',null,null))", scripts[2]);
+ assertEquals(dry(createQueueInitString("theform:defaultSizeQueue", null, null)), scripts[2]);
}
public void testRenderRequestAttributes() throws Exception {
@@ -181,11 +203,14 @@
HtmlPage page = renderView();
String queueScript = dry(getQueueScript(page));
- String[] scripts = queueScript.split(";");
+ String[] scripts = splitScript(queueScript);
assertEquals(2, scripts.length);
- assertEquals(QUEUE_INIT_PROLOG_DRIED + "'theform:queue1',null,{'timeout':50021,'queueonsubmit':function(request){submit_queue_handler()},'queueonerror':function(request,status,message){error_queue_handler()}}))", scripts[0]);
- assertEquals(QUEUE_INIT_PROLOG_DRIED + "'theform:queue2',null,{'ignoreDupResponses':true,'requestDelay':600,'queueonbeforedomupdate':function(request,event,data){beforedomupdate_handler()},'queueoncomplete':function(request,event,data){complete_handler()}}))", scripts[1]);
+ assertEquals(dry(createQueueInitString("theform:queue1", null,
+ "{'timeout':50021,'queueonsubmit':function(request){submit_queue_handler()},'queueonerror':function(request,status,message){error_queue_handler()}}")), scripts[0]);
+ assertEquals(dry(createQueueInitString("theform:queue2", null,
+ "{'ignoreDupResponses':true,'requestDelay':600,'queueonbeforedomupdate':function(request,event,data){beforedomupdate_handler()},'queueoncomplete':function(request,event,data){complete_handler()}}")),
+ scripts[1]);
}
public void testInvalidSizeExceededBehavior() throws Exception {
@@ -215,10 +240,10 @@
HtmlPage page = renderView();
String queueScript = dry(getQueueScript(page));
- String[] scripts = queueScript.split(";");
+ String[] scripts = splitScript(queueScript);
assertEquals(1, scripts.length);
- assertEquals(QUEUE_INIT_PROLOG_DRIED + "'theform:testQueue',{'size':2},null))", scripts[0]);
+ assertEquals(dry(createQueueInitString("theform:testQueue", "{'size':2}",null)), scripts[0]);
}
}
17 years, 1 month
JBoss Rich Faces SVN: r11335 - in trunk/framework/impl/src/main: java/org/ajax4jsf/context and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-24 14:33:30 -0500 (Mon, 24 Nov 2008)
New Revision: 11335
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
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-4957
https://jira.jboss.org/jira/browse/RF-5049
Copied: trunk/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java (from rev 11304, trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRegistry.java)
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java 2008-11-24 19:33:30 UTC (rev 11335)
@@ -0,0 +1,64 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.ajax4jsf.component;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueRegistry {
+
+ private static final String REGISTRY_ATTRIBUTE_NAME = QueueRegistry.class.getName();
+
+ public static void registerQueue(FacesContext context, String clientName, Object data) {
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ Map<String, Object> registryMap = (Map<String, Object>)
+ requestMap.get(REGISTRY_ATTRIBUTE_NAME);
+
+ if (registryMap == null) {
+ registryMap = new LinkedHashMap<String, Object>();
+ requestMap.put(REGISTRY_ATTRIBUTE_NAME, registryMap);
+ }
+
+ if (!registryMap.containsKey(clientName)) {
+ registryMap.put(clientName, data);
+ } else {
+ context.getExternalContext().log("Queue with name '" + clientName + "' has already been registered");
+ }
+ }
+
+ public static Map<String, Object> getRegisteredQueues(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ return (Map<String, Object>) requestMap.get(REGISTRY_ATTRIBUTE_NAME);
+ }
+}
Property changes on: trunk/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-11-24 19:14:35 UTC (rev 11334)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-11-24 19:33:30 UTC (rev 11335)
@@ -25,7 +25,6 @@
import java.io.StringWriter;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -42,6 +41,8 @@
import javax.faces.render.RenderKitFactory;
import javax.faces.render.Renderer;
+import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.component.UIQueue;
import org.ajax4jsf.io.SAXResponseWriter;
import org.ajax4jsf.renderkit.HeaderResourceProducer;
import org.ajax4jsf.renderkit.HeaderResourceProducer2;
@@ -171,6 +172,8 @@
public static final String SKINNING_STYLES_PATH = "/org/richfaces/renderkit/html/css/";
+ public static final String QUEUE_SCRIPT_RESOURCE = "org.ajax4jsf.renderkit.html.scripts.QueueScript";
+
private boolean extendedSkinningAllowed;
private boolean processScripts;
@@ -453,6 +456,18 @@
context.setResponseWriter(componentWriter);
+ Map<String, Object> queues = QueueRegistry.getRegisteredQueues(context);
+ if (Boolean.valueOf(getInitParameterValue(context, "org.richfaces.queue.global.enabled"))) {
+ String encodedGlobalQueueName = context.getExternalContext().encodeNamespace(UIQueue.GLOBAL_QUEUE_NAME);
+
+ if (queues == null || !queues.containsKey(encodedGlobalQueueName)) {
+ QueueRegistry.registerQueue(context, encodedGlobalQueueName, null);
+ }
+ }
+
+ InternetResource queueScriptResource = resourceBuilder.getResource(QUEUE_SCRIPT_RESOURCE);
+ queueScriptResource.encode(context, null);
+
// Append Skin StyleSheet after a
if (null != skinStyleSheetUri) {
String resourceURL = context.getApplication()
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-11-24 19:14:35 UTC (rev 11334)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-11-24 19:33:30 UTC (rev 11335)
@@ -289,7 +289,30 @@
}
return data;
},
+
+ _evaluateScript: function(node) {
+ var includeComments = !A4J.AJAX.isXhtmlScriptMode();
+ var newscript = A4J.AJAX.getText(node, includeComments) ; // TODO - Mozilla disable innerHTML in XML page ..."";
+
+ try {
+ LOG.debug("Evaluate script replaced area in document: ", newscript);
+ if (window.execScript) {
+ window.execScript( newscript );
+ } else {
+ window.eval(newscript);
+ }
+ } catch(e){
+ LOG.error("ERROR Evaluate script: Error name: " + e.name + e.message?". Error message: "+e.message:"");
+ }
+ },
+ evaluateQueueScript: function() {
+ var queueScript = this.getElementById('org.ajax4jsf.queue_script');
+ if (queueScript) {
+ this._evaluateScript(queueScript);
+ }
+ },
+
evalScripts : function(node, isLast){
var newscripts = this.getElementsByTagName("script",node);
LOG.debug("Scripts in updated part count : " + newscripts.length);
@@ -297,19 +320,7 @@
var _this = this;
window.setTimeout(function() {
for (var i = 0; i < newscripts.length; i++){
- var includeComments = !A4J.AJAX.isXhtmlScriptMode();
- var newscript = A4J.AJAX.getText(newscripts[i], includeComments) ; // TODO - Mozilla disable innerHTML in XML page ..."";
-
- try {
- LOG.debug("Evaluate script replaced area in document: ", newscript);
- if (window.execScript) {
- window.execScript( newscript );
- } else {
- window.eval(newscript);
- }
- } catch(e){
- LOG.error("ERROR Evaluate script: Error name: " + e.name + e.message?". Error message: "+e.message:"");
- }
+ _this._evaluateScript(newscripts[i]);
}
newscripts = null;
if (isLast)
@@ -838,6 +849,8 @@
A4J.AJAX.processResponseAfterUpdateHeadElements = function (req, ids)
{
+ req.evaluateQueueScript();
+
for ( var k =0; k < ids.length ; k++ ) {
var id = ids[k];
LOG.debug("Update page part from call parameter for ID " + id);
@@ -1087,6 +1100,7 @@
*/
A4J.AJAX.finishRequest = function(request){
var options = request.options;
+
// we can set listener for complete request - for example,
// it can shedule next request for update page.
var oncomp = request.getElementById('org.ajax4jsf.oncomplete');
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-24 19:14:35 UTC (rev 11334)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-24 19:33:30 UTC (rev 11335)
@@ -9,254 +9,260 @@
}
};
-var Pipeline = function(size, gate) {
- this.size = size || -1;
-
- this.gate = gate;
- this.items = new Array();
-};
+//queue constructor
+A4J.AJAX.EventQueue = function() {
+ var Pipeline = function(size, gate) {
+ this.size = size || -1;
+
+ this.gate = gate;
+ this.items = new Array();
+ };
-extend(Pipeline.prototype, function() {
-
- return {
- submit: function() {
- var data = this.items.shift();
- if (data) {
- this.createRequest(data);
- }
- },
+ extend(Pipeline.prototype, function() {
- createRequest: function(data) {
- this.request = data.submit();
- this.similarityGroupingId = data.getSimilarityGroupingId();
- this.request.shouldNotifyQueue = true;
- },
-
- clearRequest: function() {
- this.request = undefined;
- this.similarityGroupingId = undefined;
- },
-
- getSize: function() {
- var size = this.items.length;
+ return {
+ submit: function() {
+ var data = this.items.shift();
+ if (data) {
+ this.createRequest(data);
+ }
+ },
- if (this.request) {
- size++;
- }
+ createRequest: function(data) {
+ this.request = data.submit();
+ this.similarityGroupingId = data.getSimilarityGroupingId();
+ this.request.shouldNotifyQueue = true;
+ },
- return size;
- },
-
- dropFirst: function() {
- this.items.shift();
- },
-
- fireFirst: function() {
- var data = this.items.shift();
- if (data) {
- data.submit()
+ clearRequest: function() {
+ this.request = undefined;
+ this.similarityGroupingId = undefined;
+ },
+
+ getSize: function() {
+ var size = this.items.length;
+
+ if (this.request) {
+ size++;
+ }
+
+ return size;
+ },
+
+ dropFirst: function() {
+ this.items.shift();
+ },
+
+ fireFirst: function() {
+ var data = this.items.shift();
+ if (data) {
+ data.submit()
+ }
+ },
+
+ addEvent: function(data) {
+ if (!this.isFull()) {
+ this.items.push(data);
+ } else {
+ //log error
+ }
+ },
+
+ //TODO new good name!
+ submitEvent: function() {
+ if (!this.request && !this.isEmpty()) {
+ this.submit();
+ }
+ },
+
+ submitNext: function() {
+ this.clearRequest();
+
+ if (this.getSize() > 0) {
+ this.submit();
+ } else {
+ this.gate.transferIfReady();
+ }
+ },
+
+ isFull: function() {
+ return this.getSize() == this.size;
+ },
+
+ isEmpty: function() {
+ return this.getSize() == 0;
+ },
+
+ hasNext: function() {
+ return this.items.length != 0;
+ },
+
+ abortCurrentRequest: function() {
+ if (this.request) {
+ this.request.shouldNotifyQueue = false;
+ this.request.abort();
+ this.clearRequest();
+ }
+ },
+
+ abortDupResponses: function(data) {
+ if (!this.hasNext() && data.getSimilarityGroupingId() == this.similarityGroupingId) {
+ this.abortCurrentRequest();
+ }
}
- },
+ }
+ }());
- addEvent: function(data) {
- if (!this.isFull()) {
- this.items.push(data);
- } else {
- //log error
+ var Gate = function() {
+ this.eventsCounter = 0;
+ };
+
+ extend(Gate.prototype, {
+
+ stopRequestDelay: function () {
+ if (this.timer) {
+ clearTimeout(this.timer);
+ this.timer = undefined;
}
},
- //TODO new good name!
- submitEvent: function() {
- if (!this.request && !this.isEmpty()) {
- this.submit();
- }
+ resetRequestDelay: function() {
+ this.delayPassed = false;
+
+ this.stopRequestDelay();
+ this.startRequestDelay();
},
- submitNext: function() {
- this.clearRequest();
-
- if (this.getSize() > 0) {
- this.submit();
+ startRequestDelay: function() {
+ var delay = this.data.getRequestDelay();
+ if (delay) {
+ var _this = this;
+ this.timer = setTimeout(function() {
+ try {
+ _this.transferIfEmpty();
+ _this.timer = undefined;
+ } finally {
+ _this = undefined;
+ }
+ }, delay);
} else {
- this.gate.transferIfReady();
+ this.transferIfEmpty();
}
},
- isFull: function() {
- return this.getSize() == this.size;
+ transferIfEmpty: function() {
+ this.delayPassed = true;
+
+ if (this.pipeline.isEmpty()) {
+ this.pipeline.addEvent(this.pop());
+ this.pipeline.submitEvent();
+ }
},
- isEmpty: function() {
- return this.getSize() == 0;
+ transferIfReady: function() {
+ if (this.delayPassed) {
+ this.pipeline.addEvent(this.pop());
+ this.pipeline.submitEvent();
+ }
},
- hasNext: function() {
- return this.items.length != 0;
+ pop: function() {
+ var data = this.data;
+ this.data = undefined;
+
+ this.eventsCounter = 0;
+ this.similarityGroupingId = undefined;
+ this.delayPassed = false;
+
+ return data;
},
-
- abortCurrentRequest: function() {
- if (this.request) {
- this.request.shouldNotifyQueue = false;
- this.request.abort();
- this.clearRequest();
- }
- },
-
- abortDupResponses: function(data) {
- if (!this.hasNext() && data.getSimilarityGroupingId() == this.similarityGroupingId) {
- this.abortCurrentRequest();
- }
- }
- }
-}());
-var Gate = function() {
- this.eventsCounter = 0;
-};
+ push: function() {
+ var DROP_NEW = 'dropNew';
+ var DROP_NEXT = 'dropNext';
+ var FIRE_NEW = 'fireNew';
+ var FIRE_NEXT = 'fireNext';
-extend(Gate.prototype, {
-
- stopRequestDelay: function () {
- if (this.timer) {
- clearTimeout(this.timer);
- this.timer = undefined;
- }
- },
-
- resetRequestDelay: function() {
- this.delayPassed = false;
-
- this.stopRequestDelay();
- this.startRequestDelay();
- },
-
- startRequestDelay: function() {
- var delay = this.data.getRequestDelay();
- if (delay) {
- var _this = this;
- this.timer = setTimeout(function() {
- try {
- _this.transferIfEmpty();
- _this.timer = undefined;
- } finally {
- _this = undefined;
+ return function(data) {
+ if (data.isIgnoreDupResponses()) {
+ this.pipeline.abortDupResponses(data);
}
- }, delay);
- } else {
- this.transferIfEmpty();
- }
- },
-
- transferIfEmpty: function() {
- this.delayPassed = true;
+
+ var similarityGroupingId = data.getSimilarityGroupingId();
+
+ if (this.similarityGroupingId == similarityGroupingId) {
+ this.data = data;
+ data.setEventsCounter(++this.eventsCounter);
+
+ this.resetRequestDelay();
+ } else {
+ if (this.data) {
+ this.stopRequestDelay();
+ this.pipeline.addEvent(this.pop());
+ }
- if (this.pipeline.isEmpty()) {
- this.pipeline.addEvent(this.pop());
- this.pipeline.submitEvent();
- }
- },
-
- transferIfReady: function() {
- if (this.delayPassed) {
- this.pipeline.addEvent(this.pop());
- this.pipeline.submitEvent();
- }
- },
-
- pop: function() {
- var data = this.data;
- this.data = undefined;
-
- this.eventsCounter = 0;
- this.similarityGroupingId = undefined;
- this.delayPassed = false;
-
- return data;
- },
+ var newDataHandled = false;
+
+ if (this.pipeline.isFull()) {
+ var behavior = data.getSizeExceededBehavior();
+
+ var queue = data.queue;
+ var queueOptions = queue.queueOptions;
+
+ if (queueOptions.onsizeexceeded) {
+ var query = data.query;
+ var options = data.options;
+ var event = data.event;
- push: function() {
- var DROP_NEW = 'dropNew';
- var DROP_NEXT = 'dropNext';
- var FIRE_NEW = 'fireNew';
- var FIRE_NEXT = 'fireNext';
+ queueOptions.onsizeexceeded.call(data.queue, query, options, event);
+ }
+
+ if (behavior == DROP_NEW ||
+ (behavior == DROP_NEXT && !(this.pipeline.hasNext()))) {
+
+ newDataHandled = true;
+ } else if (behavior == FIRE_NEW ||
+ (behavior == FIRE_NEXT && !(this.pipeline.hasNext()))) {
- return function(data) {
- if (data.isIgnoreDupResponses()) {
- this.pipeline.abortDupResponses(data);
- }
-
- var similarityGroupingId = data.getSimilarityGroupingId();
-
- if (this.similarityGroupingId == similarityGroupingId) {
- this.data = data;
- data.setEventsCounter(++this.eventsCounter);
-
- this.resetRequestDelay();
- } else {
- if (this.data) {
- this.stopRequestDelay();
- this.pipeline.addEvent(this.pop());
- }
-
- var newDataHandled = false;
-
- if (this.pipeline.isFull()) {
- var behavior = data.getSizeExceededBehavior();
+ data.submit();
+ newDataHandled = true;
+ } else if (behavior == DROP_NEXT) {
+ this.pipeline.dropFirst();
+ } else if (behavior == FIRE_NEXT) {
+ this.pipeline.fireFirst();
+ }
- var queue = data.queue;
- var queueOptions = queue.queueOptions;
-
- if (queueOptions.onsizeexceeded) {
- var query = data.query;
- var options = data.options;
- var event = data.event;
-
- queueOptions.onsizeexceeded.call(data.queue, query, options, event);
}
- if (behavior == DROP_NEW ||
- (behavior == DROP_NEXT && !(this.pipeline.hasNext()))) {
-
- newDataHandled = true;
- } else if (behavior == FIRE_NEW ||
- (behavior == FIRE_NEXT && !(this.pipeline.hasNext()))) {
+ this.pipeline.submitEvent();
- data.submit();
- newDataHandled = true;
- } else if (behavior == DROP_NEXT) {
- this.pipeline.dropFirst();
- } else if (behavior == FIRE_NEXT) {
- this.pipeline.fireFirst();
+ if (!newDataHandled) {
+ this.data = data;
+ this.similarityGroupingId = similarityGroupingId;
+ this.startRequestDelay();
}
-
}
-
- this.pipeline.submitEvent();
-
- if (!newDataHandled) {
- this.data = data;
- this.similarityGroupingId = similarityGroupingId;
- this.startRequestDelay();
- }
}
- }
- }()
-});
+ }()
+ });
-//queue constructor
-A4J.AJAX.EventQueue = function(name, queueOptions, requestOptions) {
- this.name = name;
- this.queueOptions = queueOptions || {};
- this.requestOptions = requestOptions || {};
-
- this.gate = new Gate();
- this.pipeline = new Pipeline(this.queueOptions.size, this.gate);
- this.gate.pipeline = this.pipeline;
-};
+ return function(name, queueOptions, requestOptions) {
+ this.name = name;
+ this.queueOptions = queueOptions || {};
+ this.requestOptions = requestOptions || {};
+
+ this.gate = new Gate();
+ this.pipeline = new Pipeline(this.queueOptions.size, this.gate);
+ this.gate.pipeline = this.pipeline;
+ };
+}();
A4J.AJAX.EventQueue.DEFAULT_QUEUE_NAME = "org.richfaces.queue.global";
+A4J.AJAX.EventQueue.getQueue = function(name) {
+ return A4J.AJAX._eventQueues[name];
+};
+
A4J.AJAX.EventQueue.addQueue = function(queue) {
var name = queue.name;
@@ -435,16 +441,16 @@
extend(EventQueueData.prototype, {
submit: function() {
this.query.appendParameter("AJAX:EVENTS_COUNT", this.eventsCount);
- var request = A4J.AJAX.SubmitQuery(this.query, this.options)
+ this.request = A4J.AJAX.SubmitQuery(this.query, this.options)
+
var queue = this.queue;
+ this.request.queue = queue;
- request.queue = queue;
-
if (this.options.queueonsubmit) {
- this.options.queueonsubmit.call(queue, request);
+ this.options.queueonsubmit.call(queue, this.request);
}
- return request;
+ return this.request;
},
getSimilarityGroupingId: function() {
@@ -465,10 +471,6 @@
setEventsCounter: function(count) {
this.eventsCount = count;
- },
-
- setRequest: function() {
- //TODO nick
}
});
17 years, 1 month
JBoss Rich Faces SVN: r11334 - trunk/test-applications/jsp/src/main/java/rich.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-24 14:14:35 -0500 (Mon, 24 Nov 2008)
New Revision: 11334
Modified:
trunk/test-applications/jsp/src/main/java/rich/RichBean.java
Log:
+queue
Modified: trunk/test-applications/jsp/src/main/java/rich/RichBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2008-11-24 19:12:12 UTC (rev 11333)
+++ trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2008-11-24 19:14:35 UTC (rev 11334)
@@ -74,6 +74,7 @@
map.add("DataGrid", add("/DataGrid/DataGrid", new boolean [] {false, true, false}));
map.add("ExtendedDataTable", add("/ExtendedDataTable/ExtendedDataTable", new boolean [] {false, true, false}));
map.add("Editor", add("/Editor/Editor", new boolean [] {true, true, false}));
+ map.add("Queue", add("/Queue/Queue", new boolean [] {false, true, true}));
Iterator<String> iterator = map.getSet().iterator();
while(iterator.hasNext()){
list.add(new SelectItem(iterator.next()));
17 years, 1 month
JBoss Rich Faces SVN: r11333 - trunk/test-applications/jsp/src/main/java/util/data.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-24 14:12:12 -0500 (Mon, 24 Nov 2008)
New Revision: 11333
Modified:
trunk/test-applications/jsp/src/main/java/util/data/Data.java
Log:
add Serializable
Modified: trunk/test-applications/jsp/src/main/java/util/data/Data.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/data/Data.java 2008-11-24 19:11:22 UTC (rev 11332)
+++ trunk/test-applications/jsp/src/main/java/util/data/Data.java 2008-11-24 19:12:12 UTC (rev 11333)
@@ -1,9 +1,14 @@
package util.data;
+import java.io.Serializable;
import java.util.Date;
import java.util.Random;
-public class Data {
+public class Data implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8273312619735128830L;
public static final String[] statusIcon = {"/pics/error.gif", "/pics/fatal.gif", "/pics/info.gif", "/pics/passed.gif", "/pics/warn.gif"};
public static final String[] status = {"error", "fatal", "info", "passed", "warn"};
17 years, 1 month
JBoss Rich Faces SVN: r11332 - trunk/test-applications/jsp/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-24 14:11:22 -0500 (Mon, 24 Nov 2008)
New Revision: 11332
Modified:
trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml 2008-11-24 19:08:35 UTC (rev 11331)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml 2008-11-24 19:11:22 UTC (rev 11332)
@@ -197,7 +197,7 @@
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
- /WEB-INF/faces-config-Editor.xml,/WEB-INF/faces-config-ExtendedDataTable.xml,/WEB-INF/faces-config-DataGrid.xml,/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/f!
aces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-RichTest.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAnd!
Filtering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-Fi
leUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml
+ /WEB-INF/faces-config-Queue.xml,/WEB-INF/faces-config-Editor.xml,/WEB-INF/faces-config-ExtendedDataTable.xml,/WEB-INF/faces-config-DataGrid.xml,/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/fa!
ces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-RichTest.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,!
/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-St
yle.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml
</param-value>
</context-param>
@@ -211,6 +211,11 @@
<param-value>false</param-value>
</context-param>
+ <context-param>
+ <param-name>org.richfaces.queue.global.enabled</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
@@ -272,7 +277,7 @@
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
- </filter-mapping>
+ </filter-mapping>
<session-config>
<session-timeout>600</session-timeout>
17 years, 1 month
JBoss Rich Faces SVN: r11331 - trunk/test-applications/jsp/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-11-24 14:08:35 -0500 (Mon, 24 Nov 2008)
New Revision: 11331
Added:
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Queue.xml
Log:
Queue config
Added: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Queue.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Queue.xml (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Queue.xml 2008-11-24 19:08:35 UTC (rev 11331)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+<faces-config>
+ <managed-bean>
+ <managed-bean-name>queue</managed-bean-name>
+ <managed-bean-class>queue.Queue</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>queueComponent</managed-bean-name>
+ <managed-bean-class>queue.QueueComponent</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
17 years, 1 month