JBoss Rich Faces SVN: r11070 - in trunk/sandbox: samples/queue-sample/src/main/webapp and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2008-11-10 12:06:53 -0500 (Mon, 10 Nov 2008)
New Revision: 11070
Added:
trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/OversizeBean.java
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/sized-queue.xhtml
trunk/sandbox/samples/queue-sample/src/main/webapp/templates/navigation.xhtml
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRendererData.java
trunk/sandbox/ui/queue/src/test/java/org/richfaces/ScriptTest.java
Modified:
trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml
trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml
trunk/sandbox/ui/queue/pom.xml
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/scripts/QueueScriptResourceRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-4854
Added: trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/OversizeBean.java
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/OversizeBean.java (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/OversizeBean.java 2008-11-10 17:06:53 UTC (rev 11070)
@@ -0,0 +1,62 @@
+/**
+ * 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.richfaces;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+public class OversizeBean {
+ public String[] getQueueNames() {
+ return new String[] {
+ "dropNext", "dropNew", "fireNext", "fireNew"
+ };
+ }
+
+ private Map<String, String> queueData = new HashMap<String, String>();
+
+ public Map<String, String> getQueueData() {
+ return queueData;
+ }
+
+ public void reset() {
+ this.queueData = new HashMap<String, String>();
+ }
+
+ public void action() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Map<String, String> requestParameterMap = externalContext.getRequestParameterMap();
+
+ String queueName = (String) requestParameterMap.get("queueName");
+ String sequence = (String) requestParameterMap.get("sequence");
+
+ String queueString = queueData.get(queueName);
+ if (queueString == null) {
+ queueData.put(queueName, sequence);
+ } else {
+ queueData.put(queueName, queueString + ", " + sequence);
+ }
+ }
+}
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -8,6 +8,12 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>oversizeBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.OversizeBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp 2008-11-10 17:06:53 UTC (rev 11070)
@@ -1,11 +1,3 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-
-<html>
-
-<head></head>
-
- <body>
- <jsp:forward page="/pages/index.jsf" />
- </body>
-
-</html>
\ No newline at end of file
+<%
+ response.sendRedirect("pages/index.jsf");
+%>
\ No newline at end of file
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -22,6 +22,8 @@
</head>
<body>
<f:view>
+ <ui:include src="/templates/navigation.xhtml" />
+
<a4j:status startText="...running..." startStyle="color: green" for="region" />
<ui:decorate template="/templates/index.xhtml">
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -22,6 +22,8 @@
</head>
<body>
<f:view>
+ <ui:include src="/templates/navigation.xhtml" />
+
<a4j:status startText="...running..." startStyle="color: green" for="region" />
<ui:decorate template="/templates/index.xhtml">
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/sized-queue.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/sized-queue.xhtml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/sized-queue.xhtml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -0,0 +1,93 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
+ <head>
+ <title></title>
+ <script type="text/javascript">
+ function findLog() {
+ return document.getElementById('logConsole');
+ }
+
+ function hideLog() {
+ findLog().style.display = 'none';
+ }
+
+ function showLog() {
+ findLog().style.display = '';
+ }
+ </script>
+ </head>
+ <body>
+ <f:view>
+ <ui:include src="/templates/navigation.xhtml" />
+
+ <a4j:status startText="...running..." stopText="stopped" startStyle="color: green" />
+
+ <c:set var="size" value="1" />
+ <c:set var="requestDelay" value="1500" />
+
+ <c:forEach items="#{oversizeBean.queueNames}" var="queueName">
+ <q:queue requestDelay="#{requestDelay}" size="#{size}" name="#{queueName}"
+ sizeExceededBehavior="#{queueName}"/>
+ </c:forEach>
+
+ <script type="text/javascript">
+ function initSequences() {
+ window.sequences = {
+ dropNext: 0,
+ dropNew: 0,
+ fireNext: 0,
+ fireNew: 0
+ };
+ }
+
+ initSequences();
+ </script>
+
+ <h:panelGroup id="queueStatus">
+ <table style="width: 50%;"><tbody>
+ <tr style="width: 25%">
+ <a4j:repeat value="#{oversizeBean.queueNames}" var="queueName">
+ <td>
+ #{queueName}
+ </td>
+ </a4j:repeat>
+ </tr>
+ <tr>
+ <a4j:repeat value="#{oversizeBean.queueNames}" var="queueName">
+ <td>
+ #{oversizeBean.queueData[queueName]} 
+ </td>
+ </a4j:repeat>
+ </tr>
+ </tbody></table>
+ </h:panelGroup>
+
+ <h:form>
+ <c:forEach items="#{oversizeBean.queueNames}" var="queueName">
+ <button onclick="#{queueName}Fire1();#{queueName}Fire2(); return false;">
+ #{queueName}
+ </button>
+ <c:forEach begin="1" end="2" var="index">
+ <a4j:jsFunction action="#{oversizeBean.action}"
+ name="#{queueName}Fire#{index}"
+ reRender="queueStatus" eventsQueue="#{queueName}">
+ <a4j:actionparam name="sequence" value="sequences.#{queueName}++" noEscape="true" />
+ <a4j:actionparam name="queueName" value="#{queueName}"/>
+ </a4j:jsFunction>
+ </c:forEach>
+   
+ </c:forEach>
+
+ <br />
+
+ <a4j:commandButton value="reset" reRender="queueStatus" action="#{oversizeBean.reset}" oncomplete="initSequences()"/>
+ </h:form>
+
+ </f:view>
+ </body>
+</html>
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -22,6 +22,8 @@
</head>
<body>
<f:view>
+ <ui:include src="/templates/navigation.xhtml" />
+
<a4j:status startText="...running..." startStyle="color: green" for="region" />
<ui:decorate template="/templates/index.xhtml">
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -6,6 +6,7 @@
xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
<ui:composition>
+
<h2><ui:insert name="title" /></h2>
<ui:insert name="viewQueue" />
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/templates/navigation.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/templates/navigation.xhtml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/templates/navigation.xhtml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -0,0 +1,19 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
+
+ <ui:composition>
+ <h:outputLink value="index.jsf">No global queues page</h:outputLink>
+ <h:outputText value=" " />
+ <h:outputLink value="form-queue.jsf">Form global queue</h:outputLink>
+ <h:outputText value=" " />
+ <h:outputLink value="view-queue.jsf">View global queue</h:outputLink>
+ <h:outputText value=" " />
+ <h:outputLink value="sized-queue.jsf">Size exceed behaviors</h:outputLink>
+
+ <br />
+ </ui:composition>
+</html>
Modified: trunk/sandbox/ui/queue/pom.xml
===================================================================
--- trunk/sandbox/ui/queue/pom.xml 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/ui/queue/pom.xml 2008-11-10 17:06:53 UTC (rev 11070)
@@ -46,5 +46,10 @@
<artifactId>richfaces-impl</artifactId>
<version>3.3.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java 2008-11-10 17:06:53 UTC (rev 11070)
@@ -36,15 +36,15 @@
private static final String REGISTRY_ATTRIBUTE_NAME = QueueRegistry.class.getName();
- public static void registerQueue(FacesContext context, String clientName, Object data) {
+ public static void registerQueue(FacesContext context, String clientName, QueueRendererData data) {
ExternalContext externalContext = context.getExternalContext();
Map<String, Object> requestMap = externalContext.getRequestMap();
- Map<String, Object> registryMap = (Map<String, Object>)
+ Map<String, QueueRendererData> registryMap = (Map<String, QueueRendererData>)
requestMap.get(REGISTRY_ATTRIBUTE_NAME);
if (registryMap == null) {
- registryMap = new LinkedHashMap<String, Object>();
+ registryMap = new LinkedHashMap<String, QueueRendererData>();
requestMap.put(REGISTRY_ATTRIBUTE_NAME, registryMap);
}
@@ -55,10 +55,10 @@
}
}
- public static Map<String, Object> getRegisteredQueues(FacesContext context) {
+ public static Map<String, QueueRendererData> getRegisteredQueues(FacesContext context) {
ExternalContext externalContext = context.getExternalContext();
Map<String, Object> requestMap = externalContext.getRequestMap();
- return (Map<String, Object>) requestMap.get(REGISTRY_ATTRIBUTE_NAME);
+ return (Map<String, QueueRendererData>) requestMap.get(REGISTRY_ATTRIBUTE_NAME);
}
}
Modified: trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRenderer.java 2008-11-10 17:06:53 UTC (rev 11070)
@@ -22,7 +22,6 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
-import java.util.HashMap;
import java.util.Map;
import javax.faces.component.UIComponent;
@@ -41,27 +40,31 @@
*/
public class QueueRenderer extends HeaderResourcesRendererBase {
- private static final String[] PLAIN_ATTRIBUTES = new String[] {
+ private static final String[] QUEUE_ATTRIBUTES = new String[] {
"enabled",
"size",
- "sizeExceededBehavior",
+ "sizeExceededBehavior"
+ };
+
+ private static final String[] QUEUE_FUNCTION_ATTRIBUTES = new String[] {
+ "onSizeExceeded",
+ "onError",
+ "onExpired"
+ };
+
+ private static final String[] REQUEST_ATTRIBUTES = new String[] {
"requestDelay",
"timeout",
"ignoreDupResponses",
- "limitToList",
+ "limitToList"
};
- private static final String[] FUNCTION_ATTRIBUTES = new String[] {
+ private static final String[] REQUEST_FUNCTION_ATTRIBUTES = new String[] {
"onsubmit",
"oncomplete",
"onbeforedomupdate",
- "onSizeExceeded",
- "onError",
- "onExpired"
};
-
-
private volatile InternetResource[] scripts;
@Override
@@ -100,26 +103,41 @@
return true;
}
- private Object createRendererData(FacesContext context, UIQueue queue) {
+ private QueueRendererData createRendererData(FacesContext context, UIQueue queue) {
Map<String, Object> attributes = queue.getAttributes();
- Map<String,Object> data = new HashMap<String, Object>();
+ QueueRendererData data = new QueueRendererData();
- for (String attributeName : PLAIN_ATTRIBUTES) {
+ for (String attributeName : QUEUE_ATTRIBUTES) {
Object value = attributes.get(attributeName);
if (isNotEmpty(value)) {
- data.put(attributeName, value);
+ data.addQueueAttribute(attributeName, value);
}
}
- for (String attributeName : FUNCTION_ATTRIBUTES) {
+ for (String attributeName : REQUEST_ATTRIBUTES) {
Object value = attributes.get(attributeName);
if (isNotEmpty(value)) {
+ data.addRequestAttribute(attributeName, value);
+ }
+ }
+
+ for (String attributeName : QUEUE_FUNCTION_ATTRIBUTES) {
+ Object value = attributes.get(attributeName);
+ if (isNotEmpty(value)) {
//TODO nick - apply proper functions signature
- data.put(attributeName, new JSFunctionDefinition("event").addToBody(value));
+ data.addQueueAttribute(attributeName, new JSFunctionDefinition("event").addToBody(value));
}
}
+ for (String attributeName : REQUEST_FUNCTION_ATTRIBUTES) {
+ Object value = attributes.get(attributeName);
+ if (isNotEmpty(value)) {
+ //TODO nick - apply proper functions signature
+ data.addRequestAttribute(attributeName, new JSFunctionDefinition("event").addToBody(value));
+ }
+ }
+
return data;
}
Added: trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRendererData.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRendererData.java (rev 0)
+++ trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRendererData.java 2008-11-10 17:06:53 UTC (rev 11070)
@@ -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.richfaces.renderkit.html;
+
+import java.util.HashMap;
+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 HashMap<String, Object>();
+ }
+
+ queueAttributes.put(key, value);
+ }
+
+ public void addRequestAttribute(String key, Object value) {
+ if (requestAttributes == null) {
+ requestAttributes = new HashMap<String, Object>();
+ }
+
+ requestAttributes.put(key, value);
+ }
+
+ public Map<String, Object> getQueueAttributes() {
+ return queueAttributes;
+ }
+
+ public Map<String, Object> getRequestAttributes() {
+ return requestAttributes;
+ }
+}
Modified: trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-10 17:04:25 UTC (rev 11069)
+++ trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/scripts/QueueScriptResourceRenderer.java 2008-11-10 17:06:53 UTC (rev 11070)
@@ -35,6 +35,8 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.BaseResourceRenderer;
import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.renderkit.html.QueueRegistry;
+import org.richfaces.renderkit.html.QueueRendererData;
/**
* @author Nick Belaevski
@@ -53,7 +55,7 @@
if (requestMap.get(resourceKey) == null) {
requestMap.put(resourceKey, Boolean.TRUE);
- Map<String, Object> queues = org.richfaces.renderkit.html.QueueRegistry.getRegisteredQueues(context);
+ Map<String, QueueRendererData> queues = QueueRegistry.getRegisteredQueues(context);
if (queues != null && !queues.isEmpty()) {
super.encode(resource, context, queues, attributes);
@@ -81,12 +83,19 @@
FacesContext context, Object data) throws IOException {
ResponseWriter writer = context.getResponseWriter();
- Map<String, Object> queues = (Map<String, Object>) data;
+ Map<String, QueueRendererData> queues = (Map<String, QueueRendererData>) data;
- for (Entry<String, Object> entry : queues.entrySet()) {
+ for (Entry<String, QueueRendererData> entry : queues.entrySet()) {
+ String queueName = entry.getKey();
+ QueueRendererData rendererData = entry.getValue();
writer.writeText("A4J.AJAX.EventQueue.addQueue(", null);
- writer.writeText(new JSObject("A4J.AJAX.EventQueue", entry.getKey(), entry.getValue()).toScript(), null);
+ writer.writeText(
+ new JSObject("A4J.AJAX.EventQueue",
+ queueName,
+ rendererData.getQueueAttributes(),
+ rendererData.getRequestAttributes()
+ ).toScript(), null);
writer.writeText(");", null);
}
Added: trunk/sandbox/ui/queue/src/test/java/org/richfaces/ScriptTest.java
===================================================================
--- trunk/sandbox/ui/queue/src/test/java/org/richfaces/ScriptTest.java (rev 0)
+++ trunk/sandbox/ui/queue/src/test/java/org/richfaces/ScriptTest.java 2008-11-10 17:06:53 UTC (rev 11070)
@@ -0,0 +1,89 @@
+/**
+ * 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.richfaces;
+
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+
+import org.ajax4jsf.component.UIAjaxFunction;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.UIQueue;
+
+import com.gargoylesoftware.htmlunit.ScriptResult;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
+
+/**
+ * @author mikalaj
+ *
+ */
+public class ScriptTest extends AbstractAjax4JsfTestCase {
+
+ public ScriptTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected WebClient createWebClient() {
+ WebClient webClient = super.createWebClient();
+ webClient.setJavaScriptEngine(new JavaScriptEngine(webClient));
+
+ return webClient;
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ List<UIComponent> viewRootChildren = facesContext.getViewRoot().getChildren();
+
+ viewRootChildren.add(application.createComponent(UIQueue.COMPONENT_TYPE));
+
+ UIComponent form = application.createComponent(UIForm.COMPONENT_TYPE);
+ viewRootChildren.add(form);
+
+ UIAjaxFunction function = (UIAjaxFunction) application.createComponent(UIAjaxFunction.COMPONENT_TYPE);
+ function.setName("ajaxSubmit");
+ form.getChildren().add(function);
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testScript() throws Exception {
+ HtmlPage page = this.renderView();
+ assertNotNull(page);
+
+ ScriptResult scriptResult = page.executeJavaScript("setTimeout(function(){A4J.AJAX.EventQueue.getOrCreateQueue('" +
+ UIQueue.GLOBAL_QUEUE_NAME + "')}, 2000000)");
+ System.out.println(scriptResult.getJavaScriptResult());
+
+
+ }
+}
16 years, 10 months
JBoss Rich Faces SVN: r11069 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2008-11-10 12:04:25 -0500 (Mon, 10 Nov 2008)
New Revision: 11069
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
Log:
https://jira.jboss.org/jira/browse/RF-4854
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-10 16:39:32 UTC (rev 11068)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-10 17:04:25 UTC (rev 11069)
@@ -4,9 +4,10 @@
A4J.AJAX._eventQueues = {};
//queue constructor
-A4J.AJAX.EventQueue = function(name, options) {
+A4J.AJAX.EventQueue = function(name, queueOptions, requestOptions) {
this.name = name;
- this.options = options;
+ this.queueOptions = queueOptions || {};
+ this.requestOptions = requestOptions || {};
this.queue = new Array();
};
@@ -45,6 +46,9 @@
if (!queue) {
name = queueName || requestId;
+ if (namespace) {
+ name = namespace + ":" + name;
+ }
LOG.debug("Creating new transient queue '" + name + "' with default settings");
queue = new A4J.AJAX.EventQueue(name);
@@ -59,19 +63,25 @@
A4J.AJAX.EventQueue.prototype = function() {
- var EventQueueData = function(queue) {
+ var EventQueueData = function(queue, query, options) {
this.queue = queue;
- this.eventsCount = 0;
+ this.query = query;
+ this.options = options || {};
+
+ this.eventsCount = 1;
};
EventQueueData.prototype.setEventData = function(query, options) {
this.query = query;
this.options = options;
+ };
+ EventQueueData.prototype.increaseEventCounter = function() {
this.eventsCount++;
};
- EventQueueData.prototype.executeDelay = function(delay) {
+ EventQueueData.prototype.executeDelay = function() {
+ var delay = this.options.requestDelay;
LOG.debug("Queue will wait " + (delay || 0) + "ms before submit");
if (delay) {
@@ -114,9 +124,9 @@
opts[name] = options[name];
}
- for (var name in this.options) {
+ for (var name in this.requestOptions) {
if (!opts[name]) {
- opts[name] = this.options[name];
+ opts[name] = this.requestOptions[name];
}
}
@@ -126,21 +136,25 @@
return {
//TODO separate service functions
- submit: function() {
- if (this.inactive) {
- throw "Queue inactive";
+ getQueueSize: function() {
+ return this.queueOptions.size;
+ },
+
+ getSizeExceededBehavior: function() {
+ var policy = this.queueOptions.sizeExceededBehavior;
+ if (!policy) {
+ policy = 'dropNext';
}
+
+ return policy;
+ },
+ submit: function() {
if (!this.request) {
var queueData = this.queue.shift();
if (queueData) {
LOG.debug("Queue '" + this.name + "' will submit request NOW");
- if (this.queue.length == 0) {
- LOG.debug("The last queue request is being submitted, resetting requestId");
- this._requestId = undefined;
- }
-
this.request = queueData.submit();
this.request.queue = this;
} else {
@@ -151,37 +165,76 @@
}
},
- push: function(query, opts) {
- if (this.inactive) {
- throw "Queue inactive";
- }
+ push: function() {
+ var dropNew = function() {
+ this._requestId = undefined;
+ };
- var options = extendOptions.call(this, opts);
+ var fireNew = function(queueData) {
+ this._requestId = undefined;
+ queueData.submit();
+ };
- //TODO add processing for ignoreDupResponse
-
- var queueData;
-
- var requestId = options.requestId;
- var delay = options.requestDelay;
-
- if (!this._requestId || requestId != this._requestId) {
- queueData = new EventQueueData(this);
-
+ var addToQueue = function(queueData, requestId) {
this.queue.push(queueData);
this._requestId = requestId;
+ queueData.executeDelay();
LOG.debug("New event added to queue '" + this.name + "'. Queue requestId changed to " + requestId);
- } else {
- queueData = this.queue[this.queue.length - 1];
- queueData.abortDelay();
+ };
- LOG.debug("Similar request already in queue '" + this.name + "'");
+ var removeFirst = function() {
+ var nextQueueData = this.queue.shift();
+ if (nextQueueData) {
+ nextQueueData.abortDelay();
+ }
+
+ return nextQueueData;
+ };
+
+ return function(query, opts) {
+ var options = extendOptions.call(this, opts);
+
+ //TODO add processing for ignoreDupResponse
+
+ var queueData;
+
+ var requestId = options.requestId;
+
+ if (this.queue.length == 0 || requestId != this._requestId) {
+ queueData = new EventQueueData(this, query, options);
+
+ if (this.getQueueSize() == this.queue.length) {
+ var oversizeBehavior = this.getSizeExceededBehavior();
+ if ('dropNext' == oversizeBehavior) {
+ removeFirst.call(this);
+ addToQueue.call(this, queueData, requestId);
+ } else if ('fireNext' == oversizeBehavior) {
+ var firstQueueData = removeFirst.call(this);
+ if (firstQueueData) {
+ firstQueueData.submit();
+ }
+ addToQueue.call(this, queueData, requestId);
+ } else if ('dropNew' == oversizeBehavior) {
+ dropNew.call(this);
+ } else if ('fireNew' == oversizeBehavior) {
+ fireNew.call(this, queueData);
+ }
+ } else {
+ addToQueue.call(this, queueData, requestId);
+ }
+ } else {
+ queueData = this.queue[this.queue.length - 1];
+ queueData.setEventData(query, options);
+ queueData.increaseEventCounter();
+
+ queueData.abortDelay();
+ queueData.executeDelay();
+
+ LOG.debug("Similar request already in queue '" + this.name + "'");
+ }
}
-
- queueData.setEventData(query, options);
- queueData.executeDelay(delay);
- },
+ }(),
pop: function() {
this.request = undefined;
@@ -190,8 +243,6 @@
LOG.debug("After request: queue '" + this.name + "' is empty now");
if (this._transient) {
- this.inactive = true;
-
LOG.debug("Deleting transient queue '" + this.name + "' from queues registry");
A4J.AJAX.EventQueue.removeQueue(this.name);
}
16 years, 10 months
JBoss Rich Faces SVN: r11068 - trunk/docs/userguide/en/src/main/docbook/modules.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2008-11-10 11:39:32 -0500 (Mon, 10 Nov 2008)
New Revision: 11068
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
RF-4596:Standard Skinning & Portlets note
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-11-10 16:21:38 UTC (rev 11067)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-11-10 16:39:32 UTC (rev 11068)
@@ -3034,6 +3034,21 @@
</tbody>
</tgroup>
</table>
+ <title>Note:</title>
+ <para> Standard skinning level can fail if configuration of <code>ajaxPortlet</code>
+ is as following:
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<portlet>
+ <portlet-name>ajaxPortlet</portlet-name>
+ <header-content>
+ <script src="/faces/rfRes/org/ajax4jsf/framework.pack.js" type="text/javascript" />
+ <script src="/faces/rfRes/org/richfaces/ui.pack.js" type="text/javascript" />
+ <link rel="stylesheet" type="text/css" href="/faces/rfRes/org/richfaces/skin.xcss" />
+ </header-content>
+</portlet>
+...]]></programlisting>
+</note>
</section>
16 years, 10 months
JBoss Rich Faces SVN: r11067 - trunk/docs/userguide/en/src/main/docbook/modules.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-11-10 11:21:38 -0500 (Mon, 10 Nov 2008)
New Revision: 11067
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
Corrected some mistakes
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-11-10 14:54:10 UTC (rev 11066)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2008-11-10 16:21:38 UTC (rev 11067)
@@ -1917,16 +1917,16 @@
elements' name and attribute type (where applicable). Also this feature
provides a set of CSS styles so that skinning can be applied assigning rich-*
classes to particular elements or to container of elements that nests controls. </para>
- <para> Standard controls skinning feature provides 2 levels of skinning - standard and
- extended, while skinning is based on detecting browser user agent. If user agent is
+ <para> Standard controls skinning feature provides 2 levels of skinning - <property>Standard</property> and
+ <property>Extended</property> while skinning is based on detecting browser user agent. If user agent is
not detected, Advanced level is used. </para>
<itemizedlist>
<listitem>
<para>
<emphasis>
- <property>Standard</property>
- </emphasis> provides customization only basic style properties. </para>
- <para> To the following browsers Basic level of skinning is applied: </para>
+ <property>Standard</property> level
+ </emphasis> provides customization for only basic style properties. </para>
+ <para> To the following browsers <property>Standard</property> level of skinning is applied: </para>
<itemizedlist>
<listitem>
<para>Internet Explorer 6</para>
@@ -1947,11 +1947,11 @@
<listitem>
<para>
<emphasis>
- <property>Extended</property>
+ <property>Extended</property> level
</emphasis> extends basic level introducing broader number of style
properties and is applied to browsers with rich visual styling capability of
controls </para>
- <para> The following browsers support Advanced level of skinning: </para>
+ <para> The following browsers support <property>Extended</property> level of skinning: </para>
<itemizedlist>
<listitem>
<para>Mozilla Firefox</para>
@@ -2013,20 +2013,20 @@
</para>
</listitem>
</itemizedlist>
- <para>Skinning can be initialized in two ways:</para>
+ <para>Skinning for standard HTML controls can be initialized in two ways:</para>
<itemizedlist>
<listitem>
<para> adding <code>org.richfaces.CONTROL_SKINNING</code> parmeter to web.xml.
Values: "enable" and "disable". This way
- implies that skinning style classes are applied to elements by element name
- and type attribute (where applicable). No additional steps required from an
- application developer. Please find below the table that contains the list of
- element to which skinning a applicable. </para>
+ implies that skinning style properties are applied to elements by element name
+ and attribute type (where applicable). No additional steps required.
+ Please find below the table that contains the list of
+ elements to which skinning a applicable. </para>
</listitem>
<listitem>
<para> adding <code> org.richfaces.CONTROL_SKINNING_CLASSES </code> parameter to
web.xml file. Possible values "enable" and
- "disable". Implementation of this method implies the
+ "disable". Implementation of this method implies that the
provision of several style classes for different types of elements. The
style classes have predefined names. Application developer should manually
assign classes to controls that needs skinning or assign class to an element
16 years, 10 months
JBoss Rich Faces SVN: r11066 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-10 09:54:10 -0500 (Mon, 10 Nov 2008)
New Revision: 11066
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/orderingList/orderingListTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java
Log:
RF-4841
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/orderingList/orderingListTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java 2008-11-10 10:47:59 UTC (rev 11065)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java 2008-11-10 14:54:10 UTC (rev 11066)
@@ -70,6 +70,24 @@
private String showButtonLabelsId;
+ /**
+ * Check control facets
+ */
+ @Test
+ public void testControlFacets(Template template) {
+ renderPage(template, initMethod);
+ initFields();
+ String orderingListId = getParentId() + "testControlFacets";
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":topControlFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":topControlDisabledFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":bottomControlFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":bottomControlDisabledFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":upControlFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":upControlDisabledFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":downControlFacet"));
+ Assert.assertTrue(selenium.isElementPresent(orderingListId + ":downControlDisabledFacet"));
+ }
+
/**
* JS API is present and works
*/
16 years, 10 months
JBoss Rich Faces SVN: r11065 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-11-10 05:47:59 -0500 (Mon, 10 Nov 2008)
New Revision: 11065
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testProcessingInvalidValue.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
Log:
tests for inplaceinput
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testProcessingInvalidValue.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testProcessingInvalidValue.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testProcessingInvalidValue.xhtml 2008-11-10 10:47:59 UTC (rev 11065)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ template="../../template/caseTemplate.xhtml">
+ <ui:define name="caseName">testValidator</ui:define>
+ <ui:define name="caseBody">
+ <h:form id="_form">
+ <h:panelGroup id="group_tpiv">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <rich:inplaceInput id="ii_tpiv" value="999">
+ <f:convertNumber integerOnly="true"/>
+ </rich:inplaceInput>
+ <a4j:commandButton id="bn_tpiv" reRender="group_tpiv" value="Submit"/>
+ </td>
+ <td><span id="text_tpiv"><h:message for="ii_tpiv"/></span></td>
+ </tr>
+ </table>
+ </h:panelGroup>
+ </h:form>
+ </ui:define>
+</ui:composition>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-10 10:07:50 UTC (rev 11064)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-10 10:47:59 UTC (rev 11065)
@@ -77,6 +77,10 @@
private static final String VALUE_CHANGE_LISTENER_ID_PREFIX = "_tvcl";
+ private static final String PROCESSING_INVALID_VALUE_PAGE = "testProcessingInvalidValue.xhtml";
+
+ private static final String PROCESSING_INVALID_VALUE_ID_PREFIX = "_tpiv";
+
private String testUrl;
private String formId;
@@ -454,6 +458,28 @@
assertEvents(iid, events);
}
+ /**
+ * Component displays submitted value after
+ * submission of invalid value
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testProcessingInvalidValue(Template template) {
+ setTestUrl(PROCESSING_INVALID_VALUE_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + PROCESSING_INVALID_VALUE_ID_PREFIX;
+ String newVlaue = "ddd";
+ setValueById(iid + "value", newVlaue);
+ clickById(buttonId + PROCESSING_INVALID_VALUE_ID_PREFIX);
+ waitForAjaxCompletion();
+ String value = getTextById(iid);
+ check(newVlaue.equals(value),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+ }
+
private void typeAndCheck(String iid, String word, String expectedWord) {
typeWord(iid, word);
checkMessage(iid, expectedWord,
16 years, 10 months
JBoss Rich Faces SVN: r11064 - trunk/sandbox/ui/editor/src/main/antlr.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-10 05:07:50 -0500 (Mon, 10 Nov 2008)
New Revision: 11064
Modified:
trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g
Log:
Modified: trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g
===================================================================
--- trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g 2008-11-10 10:02:28 UTC (rev 11063)
+++ trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g 2008-11-10 10:07:50 UTC (rev 11064)
@@ -224,7 +224,7 @@
for(Token token : htmlElementStack) {
if(token.getText().equals("h1") || token.getText().equals("h2") || token.getText().equals("h3")
|| token.getText().equals("h4") || token.getText().equals("li")) {
- require = true;
+ required = true;
}
}
}
16 years, 10 months
JBoss Rich Faces SVN: r11063 - trunk/sandbox/ui/editor/src/main/antlr.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-10 05:02:28 -0500 (Mon, 10 Nov 2008)
New Revision: 11063
Modified:
trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g
Log:
Modified: trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g
===================================================================
--- trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g 2008-11-08 15:19:18 UTC (rev 11062)
+++ trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g 2008-11-10 10:02:28 UTC (rev 11063)
@@ -165,6 +165,32 @@
return seamHeader.toString();
}
+ public void healingHeaderMarkup(java.util.Stack <Token> htmlElementStack) throws TokenStreamException, SemanticException{
+ int EOF = 1;
+ int ALPHANUMERICWORD = 4;
+ int i = 0;
+ Token token;
+
+ boolean containText = false;
+
+ do {
+ i++;
+ token = LT(i);
+
+ if (token.getType() == ALPHANUMERICWORD) {
+ if(!isHeader(token)) {
+ containText = true;
+ }
+ break;
+ }
+
+ } while ( token.getType() != EOF);
+
+ if (!containText) {
+ append("<span></span>");
+ }
+ }
+
public boolean isList(Token token){
String name = token.getText();
return ("ul".equals(name) || "ol".equals(name));
@@ -193,7 +219,7 @@
}
public boolean isPlainHMTLRequired(Token name, java.util.Stack <Token> htmlElementStack) throws SemanticException {
- boolean require = false;
+ boolean required = false;
if(!htmlElementStack.isEmpty()) {
for(Token token : htmlElementStack) {
if(token.getText().equals("h1") || token.getText().equals("h2") || token.getText().equals("h3")
@@ -202,38 +228,11 @@
}
}
}
-
-
- return require;
-
+
+ return required;
}
+
- public void healingHeaderMarkup(java.util.Stack <Token> htmlElementStack) throws TokenStreamException, SemanticException{
- int EOF = 1;
- int ALPHANUMERICWORD = 4;
- int i = 0;
- Token token;
-
- boolean containText = false;
-
- do {
- i++;
- token = LT(i);
-
- if (token.getType() == ALPHANUMERICWORD) {
- if(!isHeader(token)) {
- containText = true;
- }
- break;
- }
-
- } while ( token.getType() != EOF);
-
- if (!containText) {
- append("<span></span>");
- }
- }
-
public String createSimpleSeamText(Token token) throws SemanticException{
String name = token.getText().toLowerCase();
@@ -323,7 +322,7 @@
| gt:ESCAPED_GT {append(escapeSeamText(gt, htmlElementStack));}
| amp:ESCAPED_AMP {append(escapeSeamText(amp, htmlElementStack));}
| qout:ESCAPED_QOUT {append(escapeSeamText(qout, htmlElementStack));}
- | nbsp:NBSP {append(nbsp.getText());}
+ | nbsp:ESCAPED_NBSP {append(nbsp.getText());}
;
eof: EOF;
@@ -800,7 +799,8 @@
ESCAPED_QOUT : """
;
-NBSP : " "
+
+ESCAPED_NBSP : " "
;
16 years, 10 months
JBoss Rich Faces SVN: r11062 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/inplaceInput and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-11-08 10:19:18 -0500 (Sat, 08 Nov 2008)
New Revision: 11062
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
Log:
tests for inplaceinput
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java 2008-11-07 23:46:52 UTC (rev 11061)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/InplaceInputTestBean.java 2008-11-08 15:19:18 UTC (rev 11062)
@@ -3,16 +3,24 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.validator.ValidatorException;
public class InplaceInputTestBean {
public final static class Messages {
+
public final static String ACTION_CALLED = "action called";
+
+ public final static String VALUECHANGELISTENER_CALLED = "listener called";
+
+ public final static String II_VALUE = "test";
}
private String text ="";
+ private String newText = "";
+
/**
* Gets value of text field.
* @return value of text field
@@ -33,9 +41,27 @@
setText(InplaceInputTestBean.Messages.ACTION_CALLED);
}
+ public void valueChangeListener(ValueChangeEvent ve) {
+ setNewText(Messages.VALUECHANGELISTENER_CALLED);
+ }
+
public void validator(FacesContext arg0, UIComponent arg1, Object arg2) {
if (!"test".equals(arg2)) {
throw new ValidatorException(new FacesMessage("Value isn't correct!"));
}
}
+
+ /**
+ * @return the newText
+ */
+ public String getNewText() {
+ return newText;
+ }
+
+ /**
+ * @param newText the newText to set
+ */
+ public void setNewText(String newText) {
+ this.newText = newText;
+ }
}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testImmediateAttribute.xhtml 2008-11-08 15:19:18 UTC (rev 11062)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ template="../../template/caseTemplate.xhtml">
+ <ui:define name="caseName">testImmediateAttribute</ui:define>
+ <ui:define name="caseBody">
+ <h:panelGroup id="group_tia">
+ <h:form id="_form">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <h:inputText value="" required="true" ></h:inputText>
+ <rich:inplaceInput id="ii_tia" value="#{inplaceInputBean.text}" validator="#{inplaceInputBean.validator}" immediate="true">
+ </rich:inplaceInput>
+ <a4j:commandButton id="bn_tia" reRender="group_tia" value="Submit"/>
+ </td>
+ <td><span id="text_tia">#{inplaceInputBean.text}<h:messages /></span></td>
+ </tr>
+ </table>
+ </h:form>
+ </h:panelGroup>
+ </ui:define>
+</ui:composition>
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testValueChangeListener.xhtml 2008-11-08 15:19:18 UTC (rev 11062)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ template="../../template/caseTemplate.xhtml">
+ <ui:define name="caseName">testValueChangeListener</ui:define>
+ <ui:define name="caseBody">
+ <h:panelGroup id="group_tvcl">
+ <h:form id="_form">
+ <table cellpadding="5" >
+ <tr>
+ <td></td>
+ <td>
+ <rich:inplaceInput id="ii_tvcl" value="#{inplaceInputBean.text}" valueChangeListener="#{inplaceInputBean.valueChangeListener}">
+ </rich:inplaceInput>
+ <a4j:commandButton id="bn_tvcl" reRender="group_tvcl" value="Submit"/>
+ </td>
+ <td><span id="text_tvcl">#{inplaceInputBean.text}#{inplaceInputBean.newText}</span></td>
+ </tr>
+ </table>
+ </h:form>
+ </h:panelGroup>
+ </ui:define>
+</ui:composition>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-07 23:46:52 UTC (rev 11061)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-11-08 15:19:18 UTC (rev 11062)
@@ -5,6 +5,7 @@
import java.util.List;
import java.util.Map;
+import org.ajax4jsf.bean.InplaceInputTestBean;
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
@@ -68,6 +69,14 @@
private static final String STANDART_ATTRIBUTES_ID_PREFIX = "_tsa";
+ private static final String IMMEDIATE_ATTRIBUTE_PAGE = "testImmediateAttribute.xhtml";
+
+ private static final String IMMEDIATE_ATTRIBUTE_ID_PREFIX = "_tia";
+
+ private static final String VALUE_CHANGE_LISTENER_PAGE = "testValueChangeListener.xhtml";
+
+ private static final String VALUE_CHANGE_LISTENER_ID_PREFIX = "_tvcl";
+
private String testUrl;
private String formId;
@@ -78,248 +87,248 @@
private String messageId;
-// @Test
-// public void testInplaceInputComponentLayout(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-// writeStatus("Check component layout");
-//
-// String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
-// String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
-//
-// Assert.assertTrue(isPresentById(inplaceInputS));
-// int count = selenium.getXpathCount("//*[@id='" + inplaceInputS + "' and (name()='span' or name()='SPAN')]").intValue();
-// Assert.assertTrue(count == 1, "InplaceInput[" + inplaceInputS + "] has layout=inline(default) and should be rendered as 'span' element");
-//
-// Assert.assertTrue(isPresentById(inplaceInputD));
-// count = selenium.getXpathCount("//*[@id='" + inplaceInputD + "' and (name()='DIV' or name()='div')]").intValue();
-// Assert.assertTrue(count == 1, "InplaceInput [" + inplaceInputD + "] has layout=block and should be rendered as 'div' element");
-//
-// }
-//
-// @Test
-// public void testInplaceInputClientAPI(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-// writeStatus("Check component client API");
-// }
-//
-// @Test
-// public void testInplaceInputEvents(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-//
-// writeStatus("Check component event triggering");
-//
-// String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
-// String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
-// String inplaceInputDOk = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_OK;
-// String inplaceInputDCancel = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_CANCEL;
-//
-// writeStatus("Click first component being tested");
-//
-// clickById(inplaceInputS);
-// AssertTextEquals(inplaceInputS + "_edit", EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
-//
-// writeStatus("Stop editing first component being tested");
-//
-// String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
-// selenium.fireEvent(inplaceInputSInput, "blur");
-//
-// AssertTextEquals(inplaceInputS + "_view", EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
-//
-// writeStatus("Double-click second component being tested");
-//
-// selenium.doubleClick(inplaceInputD);
-// AssertTextEquals(inplaceInputD + "_edit", EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
-// type(inplaceInputSInput, "Hello");
-//
-// writeStatus("Stop editing second component being tested");
-//
-// selenium.mouseDown(inplaceInputDOk);
-//
-// AssertTextEquals(inplaceInputD + "_view", EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
-// }
-//
-// @Test
-// public void testInplaceInputKeyAttributes(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-//
-// String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
-// String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
-//
-// String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
-// String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
-//
-// writeStatus("Check component's key attributes");
-//
-// writeStatus("test 'editEvent' attribute");
-//
-// writeStatus("The first component must change your state by single clicking only");
-// clickById(inplaceInputS);
-// AssertVisible(inplaceInputSInput);
-//
-// writeStatus("The second component must change your state by double clicking only");
-// selenium.doubleClick(inplaceInputD);
-// AssertVisible(inplaceInputDInput);
-// }
-//
-// @Test
-// public void testInplaceInputComponentCore(Template template) {
-// setTestUrl(INPLACE_INPUT_PAGE);
-// renderPage(template);
-//
-// String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
-// String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
-// String inplaceInputDOk = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_OK;
-// String inplaceInputDCancel = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_CANCEL;
-//
-// writeStatus("Check component's core functionality");
-//
-// writeStatus("Double-click the second component and type an initial text");
-// selenium.doubleClick(inplaceInputD);
-// type(inplaceInputDInput, "Sun");
-//
-// writeStatus("Stop editing with ok. The input has to be saved");
-// selenium.mouseDown(inplaceInputDOk);
-// String sun = invokeFromComponent(inplaceInputD, "getValue", null);
-// Assert.assertEquals(sun, "Sun", "An inputted text has not been saved with ok");
-// //AssertTextEquals(inplaceInputD, "Sun", "An inputted text has not been saved with ok");
-//
-// writeStatus("Double-click the second component again and type a new text");
-// selenium.doubleClick(inplaceInputD);
-// type(inplaceInputDInput, "Moon");
-//
-// writeStatus("Stop editing with cancel. The input has not to be saved");
-// selenium.mouseDown(inplaceInputDCancel);
-//
-// sun = invokeFromComponent(inplaceInputD, "getValue", null);
-// Assert.assertEquals(sun, "Sun", "An inputted text has not to be saved with cancel");
-// //AssertTextEquals(inplaceInputD, "Sun", "An inputted text has not to be saved with cancel");
-//
-// }
+ @Test
+ public void testInplaceInputComponentLayout(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+ writeStatus("Check component layout");
+
+ String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
+ String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
+
+ Assert.assertTrue(isPresentById(inplaceInputS));
+ int count = selenium.getXpathCount("*[@id='" + inplaceInputS + "' and (name()='span' or name()='SPAN')]").intValue();
+ Assert.assertTrue(count == 1, "InplaceInput[" + inplaceInputS + "] has layout=inline(default) and should be rendered as 'span' element");
+
+ Assert.assertTrue(isPresentById(inplaceInputD));
+ count = selenium.getXpathCount("*[@id='" + inplaceInputD + "' and (name()='DIV' or name()='div')]").intValue();
+ Assert.assertTrue(count == 1, "InplaceInput [" + inplaceInputD + "] has layout=block and should be rendered as 'div' element");
+
+ }
+
+ @Test
+ public void testInplaceInputClientAPI(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+ writeStatus("Check component client API");
+ }
+
+ @Test
+ public void testInplaceInputEvents(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+
+ writeStatus("Check component event triggering");
+
+ String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
+ String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
+ String inplaceInputDOk = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_OK;
+ String inplaceInputDCancel = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_CANCEL;
+
+ writeStatus("Click first component being tested");
+
+ clickById(inplaceInputS);
+ AssertTextEquals(inplaceInputS + "_edit", EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
+
+ writeStatus("Stop editing first component being tested");
+
+ String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
+ selenium.fireEvent(inplaceInputSInput, "blur");
+
+ AssertTextEquals(inplaceInputS + "_view", EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
+
+ writeStatus("Double-click second component being tested");
+
+ selenium.doubleClick(inplaceInputD);
+ AssertTextEquals(inplaceInputD + "_edit", EVENT_TEST_RESULT_PASSED_TEXT, "oneditactivated event is not fired");
+ type(inplaceInputSInput, "Hello");
+
+ writeStatus("Stop editing second component being tested");
+
+ selenium.mouseDown(inplaceInputDOk);
+
+ AssertTextEquals(inplaceInputD + "_view", EVENT_TEST_RESULT_PASSED_TEXT, "onviewactivated event is not fired");
+ }
+
+ @Test
+ public void testInplaceInputKeyAttributes(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+
+ String inplaceInputS = getParentId() + "_form:" + INPLACE_INPUT_SIMPLE;
+ String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
+
+ String inplaceInputSInput = inplaceInputS + INPLACE_INPUT_FIELD_POSTFIX;
+ String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
+
+ writeStatus("Check component's key attributes");
+
+ writeStatus("test 'editEvent' attribute");
+
+ writeStatus("The first component must change your state by single clicking only");
+ clickById(inplaceInputS);
+ AssertVisible(inplaceInputSInput);
+
+ writeStatus("The second component must change your state by double clicking only");
+ selenium.doubleClick(inplaceInputD);
+ AssertVisible(inplaceInputDInput);
+ }
+
+ @Test
+ public void testInplaceInputComponentCore(Template template) {
+ setTestUrl(INPLACE_INPUT_PAGE);
+ renderPage(template);
+
+ String inplaceInputD = getParentId() + "_form:" + INPLACE_INPUT_DECORATED;
+ String inplaceInputDInput = inplaceInputD + INPLACE_INPUT_FIELD_POSTFIX;
+ String inplaceInputDOk = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_OK;
+ String inplaceInputDCancel = getParentId() + "_form:" + INPLACE_INPUT_DECORATED_CANCEL;
+
+ writeStatus("Check component's core functionality");
+
+ writeStatus("Double-click the second component and type an initial text");
+ selenium.doubleClick(inplaceInputD);
+ type(inplaceInputDInput, "Sun");
+
+ writeStatus("Stop editing with ok. The input has to be saved");
+ selenium.mouseDown(inplaceInputDOk);
+ String sun = invokeFromComponent(inplaceInputD, "getValue", null);
+ Assert.assertEquals(sun, "Sun", "An inputted text has not been saved with ok");
+ AssertTextEquals(inplaceInputD, "Sun", "An inputted text has not been saved with ok");
+
+ writeStatus("Double-click the second component again and type a new text");
+ selenium.doubleClick(inplaceInputD);
+ type(inplaceInputDInput, "Moon");
+
+ writeStatus("Stop editing with cancel. The input has not to be saved");
+ selenium.mouseDown(inplaceInputDCancel);
+
+ sun = invokeFromComponent(inplaceInputD, "getValue", null);
+ Assert.assertEquals(sun, "Sun", "An inputted text has not to be saved with cancel");
+ AssertTextEquals(inplaceInputD, "Sun", "An inputted text has not to be saved with cancel");
+
+ }
-// /**
-// * 'required' and 'requiredMessage' attributes work
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testRequiredAttributes(Template template) {
-// setTestUrl(REQUIRED_ATTRIBUTES_PAGE);
-// init(template);
-//
-// selenium.click("id=" + buttonId + REQUIRED_ATTRIBUTES_ID_PREFIX);
-// waitForPageToLoad();
-// checkMessage(messageId + REQUIRED_ATTRIBUTES_ID_PREFIX, "text:requiredMsg", CommonUtils.getSuccessfulTestMessage(inplaceInputId + REQUIRED_ATTRIBUTES_ID_PREFIX), CommonUtils.getFailedTestMessage(inplaceInputId + REQUIRED_ATTRIBUTES_ID_PREFIX));
-// }
-//
-// /**
-// * Check 'editEvent' attribute
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testEditEventAttribute(Template template) {
-// setTestUrl(EDITEVENT_ATTRIBUTES_PAGE);
-// init(template);
-//
-// selenium.doubleClick(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX);
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX + "tempValue", expMap);
-// }
-//
-// /**
-// * Check 'controls' facet
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testControlsFacet(Template template) {
-// setTestUrl(CONTROLS_FACET_PAGE);
-// init(template);
-//
-// check((isPresentById(CONTROLS_FACET_BN_OK + CONTROLS_FACET_ID_PREFIX) || isPresentById(CONTROLS_FACET_BN_CANCEL + CONTROLS_FACET_ID_PREFIX)),
-// CommonUtils.getSuccessfulTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX),
-// CommonUtils.getFailedTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX));
-// }
-//
-// /**
-// * Input some spaces in inplaceInput; verify that defaultLabel is
-// * displayed after selecting; component does not disappear from the page
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testDefaultLabelAndSpaces(Template template) {
-// setTestUrl(DEFAULTLABEL_AND_SPACES_PAGE);
-// init(template);
-//
-// String iid = inplaceInputId + DEFAULTLABEL_AND_SPACES_PAGE_ID_PREFIX;
-//
-// checkMessage(iid, "defaultLabel",
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-//
-// typeAndCheck(iid, " ", "defaultLabel");
-// typeAndCheck(iid, "test", "test");
-// }
-//
-// /**
-// * Verify component behaviour with showControls="false" attribute
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testShowControlsAttribute1(Template template) {
-// setTestUrl(SHOW_CONTROLS_ATTRIBUTE1_PAGE);
-// init(template);
-//
-// String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE1_PAGE_ID_PREFIX;
-//
-// clickById(iid);
-// check(!isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-//
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// selenium.fireEvent(iid + "tempValue", "blur");
-// expMap.remove("clip");
-// expMap.put("clip", "rect(0px 0px 0px 0px)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// }
-//
-// /**
-// * The same as previous but with showControls="true" attribute
-// *
-// * @param template - current template
-// */
-// @Test
-// public void testShowControlsAttribute2(Template template) {
-// setTestUrl(SHOW_CONTROLS_ATTRIBUTE2_PAGE);
-// init(template);
-//
-// String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE2_PAGE_ID_PREFIX;
-//
-// clickById(iid);
-// check(isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
-// CommonUtils.getSuccessfulTestMessage(iid),
-// CommonUtils.getFailedTestMessage(iid));
-//
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// selenium.fireEvent(iid + "tempValue", "blur");
-// expMap.remove("clip");
-// expMap.put("clip", "rect(auto auto auto auto)");
-// assertStyleAttributes(iid+ "tempValue", expMap);
-// }
+ /**
+ * 'required' and 'requiredMessage' attributes work
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testRequiredAttributes(Template template) {
+ setTestUrl(REQUIRED_ATTRIBUTES_PAGE);
+ init(template);
+
+ selenium.click("id=" + buttonId + REQUIRED_ATTRIBUTES_ID_PREFIX);
+ waitForPageToLoad();
+ checkMessage(messageId + REQUIRED_ATTRIBUTES_ID_PREFIX, "text:requiredMsg", CommonUtils.getSuccessfulTestMessage(inplaceInputId + REQUIRED_ATTRIBUTES_ID_PREFIX), CommonUtils.getFailedTestMessage(inplaceInputId + REQUIRED_ATTRIBUTES_ID_PREFIX));
+ }
/**
+ * Check 'editEvent' attribute
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testEditEventAttribute(Template template) {
+ setTestUrl(EDITEVENT_ATTRIBUTES_PAGE);
+ init(template);
+
+ selenium.doubleClick(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX);
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX + "tempValue", expMap);
+ }
+
+ /**
+ * Check 'controls' facet
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testControlsFacet(Template template) {
+ setTestUrl(CONTROLS_FACET_PAGE);
+ init(template);
+
+ check((isPresentById(CONTROLS_FACET_BN_OK + CONTROLS_FACET_ID_PREFIX) || isPresentById(CONTROLS_FACET_BN_CANCEL + CONTROLS_FACET_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX),
+ CommonUtils.getFailedTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX));
+ }
+
+ /**
+ * Input some spaces in inplaceInput; verify that defaultLabel is
+ * displayed after selecting; component does not disappear from the page
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testDefaultLabelAndSpaces(Template template) {
+ setTestUrl(DEFAULTLABEL_AND_SPACES_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + DEFAULTLABEL_AND_SPACES_PAGE_ID_PREFIX;
+
+ checkMessage(iid, "defaultLabel",
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+
+ typeAndCheck(iid, " ", "defaultLabel");
+ typeAndCheck(iid, "test", "test");
+ }
+
+ /**
+ * Verify component behaviour with showControls="false" attribute
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testShowControlsAttribute1(Template template) {
+ setTestUrl(SHOW_CONTROLS_ATTRIBUTE1_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE1_PAGE_ID_PREFIX;
+
+ clickById(iid);
+ check(!isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ selenium.fireEvent(iid + "tempValue", "blur");
+ expMap.remove("clip");
+ expMap.put("clip", "rect(0px 0px 0px 0px)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ }
+
+ /**
+ * The same as previous but with showControls="true" attribute
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testShowControlsAttribute2(Template template) {
+ setTestUrl(SHOW_CONTROLS_ATTRIBUTE2_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + SHOW_CONTROLS_ATTRIBUTE2_PAGE_ID_PREFIX;
+
+ clickById(iid);
+ check(isVisibleById(iid + SHOW_CONTROLS_ATTRIBUTE_BAR),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ selenium.fireEvent(iid + "tempValue", "blur");
+ expMap.remove("clip");
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(iid+ "tempValue", expMap);
+ }
+
+ /**
* Validator defined by component attribute and nested tags work
*
* @param template - current template
@@ -373,6 +382,48 @@
}
/**
+ * Immediate = true component works respectively
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testImmediateAttribute(Template template) {
+ setTestUrl(IMMEDIATE_ATTRIBUTE_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + IMMEDIATE_ATTRIBUTE_ID_PREFIX;
+
+ setValueById(iid + "value", "test1");
+ clickById(buttonId + IMMEDIATE_ATTRIBUTE_ID_PREFIX);
+ waitForAjaxCompletion();
+ check("Value isn't correct!".equals(getTextById(messageId + IMMEDIATE_ATTRIBUTE_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+ }
+
+ /**
+ * valueChangeListener should fire on submit
+ * and model binding should be updated on value changed
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testValueChangeListener(Template template) {
+ setTestUrl(VALUE_CHANGE_LISTENER_PAGE);
+ init(template);
+
+ String iid = inplaceInputId + VALUE_CHANGE_LISTENER_ID_PREFIX;
+
+ setValueById(iid + "value", "test1");
+ clickById(buttonId + VALUE_CHANGE_LISTENER_ID_PREFIX);
+ waitForAjaxCompletion();
+ check(("test1" + InplaceInputTestBean.Messages.VALUECHANGELISTENER_CALLED).equals(getTextById(messageId + VALUE_CHANGE_LISTENER_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(iid),
+ CommonUtils.getFailedTestMessage(iid));
+ }
+
+
+ /**
* style and classes, standard HTML attributes are output to client
*
* @param template - current template
16 years, 10 months
JBoss Rich Faces SVN: r11061 - in trunk/sandbox/samples/queue-sample: src/main/java/org/richfaces and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-07 18:46:52 -0500 (Fri, 07 Nov 2008)
New Revision: 11061
Added:
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml
trunk/sandbox/samples/queue-sample/src/main/webapp/templates/
trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml
Removed:
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp
Modified:
trunk/sandbox/samples/queue-sample/pom.xml
trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml
Log:
Queue-sample updated:
- switched to Facelets
- added 3 queue variants
Modified: trunk/sandbox/samples/queue-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/pom.xml 2008-11-07 23:45:44 UTC (rev 11060)
+++ trunk/sandbox/samples/queue-sample/pom.xml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -33,5 +33,10 @@
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java 2008-11-07 23:45:44 UTC (rev 11060)
+++ trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java 2008-11-07 23:46:52 UTC (rev 11061)
@@ -25,17 +25,23 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.event.AjaxListener;
/**
* @author $Autor$
*
*/
-public class Bean {
+public class Bean implements AjaxListener {
private long processRequestDelay = 300;
+ private long clientRequestDelay = 300;
+
+ private boolean pollEnabled;
+
private static final String AJAX_REQUESTS_COUNT_ATTRIBUTE = "ajaxRequestsCount";
public void setProcessRequestDelay(long processRequestDelay) {
@@ -46,6 +52,32 @@
return processRequestDelay;
}
+ public long getClientRequestDelay() {
+ return clientRequestDelay;
+ }
+
+ public void setClientRequestDelay(long clientRequestDelay) {
+ this.clientRequestDelay = clientRequestDelay;
+ }
+
+ public boolean isPollEnabled() {
+ return pollEnabled;
+ }
+
+ public void setPollEnabled(boolean pollEnabled) {
+ this.pollEnabled = pollEnabled;
+ }
+
+ public void processActionListener(ActionEvent event) {
+ System.out.println(event.getComponent().getId());
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ System.out.println(externalContext.getRequestParameterMap().get("AJAX:EVENTS_COUNT"));
+
+ System.out.println();
+ }
+
public void processAction() {
if (processRequestDelay != 0) {
try {
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-11-07 23:45:44 UTC (rev 11060)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -5,6 +5,10 @@
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>org.richfaces.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
</faces-config>
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml 2008-11-07 23:45:44 UTC (rev 11060)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -14,6 +14,10 @@
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
<!--
-->
<filter>
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/form-queue.xhtml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -0,0 +1,40 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
+ <head>
+ <title></title>
+ <script type="text/javascript">
+ function findLog() {
+ return document.getElementById('logConsole');
+ }
+
+ function hideLog() {
+ findLog().style.display = 'none';
+ }
+
+ function showLog() {
+ findLog().style.display = '';
+ }
+ </script>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." startStyle="color: green" for="region" />
+
+ <ui:decorate template="/templates/index.xhtml">
+ <ui:define name="viewQueue">
+ </ui:define>
+
+ <ui:define name="formQueue">
+ <q:queue requestDelay="1000" />
+ </ui:define>
+
+ <ui:define name="title">Global form queue</ui:define>
+ </ui:decorate>
+
+ </f:view>
+ </body>
+</html>
Deleted: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp 2008-11-07 23:45:44 UTC (rev 11060)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp 2008-11-07 23:46:52 UTC (rev 11061)
@@ -1,62 +0,0 @@
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/queue" prefix="q"%>
-<html>
- <head>
- <title></title>
- </head>
- <body>
- <f:view>
- <a4j:status startText="...running..." startStyle="color: green" />
-
- <q:queue name="threeQueue" requestDelay="1000" size="3" />
- <q:queue name="singleQueue" requestDelay="1000" size="1" />
- <q:queue name="unlimitedQueue" requestDelay="1000" size="-1" />
-
- <br />
- Queue settings: <br /><br />
- threeQueue: requestDelay = 1000, size = 3 <br />
- singleQueue: requestDelay = 1000, size = 1 <br />
- unlimitedQueue: requestDelay = 1000, size = -1 <br />
- <br />
-
- <h:form>
- <a4j:outputPanel ajaxRendered="true" layout="inline">
- <h:outputText value="#{empty ajaxRequestsCount ? 0 : ajaxRequestsCount}" />
- </a4j:outputPanel>
-
-  
-
- <a4j:commandLink value="Reset ajax counter" action="#{bean.resetAjaxCounter}" />
- <br /><br />
-
- <a4j:region ajaxListener="#{bean.processAjax}">
-
- <h:outputLabel for="processRequestDelay" value="Process request delay " />
- <h:inputText id="processRequestDelay" value="#{bean.processRequestDelay}">
- <f:convertNumber />
- </h:inputText>
-
- <br />
-
- <a4j:commandButton action="#{bean.processAction}" value="3 elements queue" reRender="outputText" eventsQueue="threeQueue"/>
- <a4j:commandButton action="#{bean.processAction}" value="3 elements queue/ignoreDupResponses" ignoreDupResponses="true" reRender="outputText" eventsQueue="threeQueue"/>
-
- <a4j:commandButton action="#{bean.processAction}" value="3 elements queue/requestDelay" requestDelay="600"
- reRender="outputText" eventsQueue="threeQueue"/>
-
- <a4j:commandButton action="#{bean.processAction}" value="3 elements queue/ignoreDupResponses/requestDelay" requestDelay="600"
- ignoreDupResponses="true" reRender="outputText" eventsQueue="threeQueue"/>
-
- <br />
-
- <a4j:commandButton action="#{bean.processAction}" value="single element queue" reRender="outputText" eventsQueue="singleQueue"/>
- <a4j:commandButton action="#{bean.processAction}" value="unlimited queue" reRender="outputText" eventsQueue="unlimitedQueue"/>
- <a4j:commandButton action="#{bean.processAction}" value="global queue" reRender="outputText" />
- </a4j:region>
- </h:form>
- <a4j:log popup="false" />
- </f:view>
- </body>
-</html>
Modified: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml 2008-11-07 23:45:44 UTC (rev 11060)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -1,12 +1,41 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
- xmlns:c="http://java.sun.com/jsp/jstl/core"
- >
- <f:view>
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
+ <head>
+ <title></title>
+ <script type="text/javascript">
+ function findLog() {
+ return document.getElementById('logConsole');
+ }
+
+ function hideLog() {
+ findLog().style.display = 'none';
+ }
+
+ function showLog() {
+ findLog().style.display = '';
+ }
+ </script>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." startStyle="color: green" for="region" />
- </f:view>
-</html>
\ No newline at end of file
+ <ui:decorate template="/templates/index.xhtml">
+ <ui:define name="viewQueue">
+ <q:queue name="queue" requestDelay="1000" oncomplete="window.status = 'queue handler'"/>
+ </ui:define>
+
+ <ui:define name="formQueue">
+ <q:queue name="formQueue" requestDelay="1000" />
+ </ui:define>
+
+ <ui:define name="title">No global queues</ui:define>
+ </ui:decorate>
+
+ </f:view>
+ </body>
+</html>
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/view-queue.xhtml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -0,0 +1,41 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
+ <head>
+ <title></title>
+ <script type="text/javascript">
+ function findLog() {
+ return document.getElementById('logConsole');
+ }
+
+ function hideLog() {
+ findLog().style.display = 'none';
+ }
+
+ function showLog() {
+ findLog().style.display = '';
+ }
+ </script>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." startStyle="color: green" for="region" />
+
+ <ui:decorate template="/templates/index.xhtml">
+ <ui:define name="viewQueue">
+ <q:queue requestDelay="1000" oncomplete="window.status = 'queue handler'"/>
+ </ui:define>
+
+ <ui:define name="formQueue">
+ </ui:define>
+
+ <ui:define name="title">Global view queue</ui:define>
+
+ </ui:decorate>
+
+ </f:view>
+ </body>
+</html>
Copied: trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml (from rev 11057, trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp)
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml 2008-11-07 23:46:52 UTC (rev 11061)
@@ -0,0 +1,94 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:q="http://labs.jboss.com/jbossrichfaces/ui/ui/queue">
+
+ <ui:composition>
+ <h2><ui:insert name="title" /></h2>
+
+ <ui:insert name="viewQueue" />
+
+ <h:form id="form">
+ <ui:insert name="formQueue" />
+
+ <a4j:outputPanel ajaxRendered="true" layout="inline">
+ <h:outputText value="#{empty ajaxRequestsCount ? 0 : ajaxRequestsCount}" />
+ </a4j:outputPanel>
+
+  
+
+ <a4j:commandLink value="Reset ajax counter" action="#{bean.resetAjaxCounter}" onclick="hideLog()" oncomplete="LOG.clear();showLog();"/>
+ <br /><br />
+
+ <fieldset>
+
+ <h:outputLabel for="clientRequestDelay" value="Client request delay " />
+ <h:inputText id="clientRequestDelay" value="#{bean.clientRequestDelay}">
+ <f:convertNumber />
+ </h:inputText>
+
+ <br />
+
+ <h:outputLabel for="processRequestDelay" value="Process request delay " />
+ <h:inputText id="processRequestDelay" value="#{bean.processRequestDelay}">
+ <f:convertNumber />
+ </h:inputText>
+
+ <br />
+
+ <h:outputLabel value="Poll enabled" for="pollEnabled" />
+ <h:selectBooleanCheckbox value="#{bean.pollEnabled}" id="pollEnabled" />
+ <br />
+
+ <h:commandButton value="Apply values" />
+ <br />
+
+ </fieldset>
+
+ <a4j:region id="region">
+ <a4j:ajaxListener binding="#{bean}" />
+
+ <a4j:commandButton id="commandButtonNoQueue"
+ actionListener="#{bean.processActionListener}"
+ action="#{bean.processAction}"
+ value="no queue"
+ reRender="outputText" />
+
+ <a4j:commandButton id="commandButtonTransientQueue"
+ requestDelay="#{bean.clientRequestDelay}"
+ actionListener="#{bean.processActionListener}"
+ action="#{bean.processAction}"
+ value="transient queue"
+ reRender="outputText" />
+
+ <a4j:commandButton id="commandButton"
+ requestDelay="#{bean.clientRequestDelay}"
+ actionListener="#{bean.processActionListener}"
+ action="#{bean.processAction}"
+ value="queue"
+ reRender="outputText"
+ eventsQueue="queue"/>
+
+ <a4j:commandButton id="commandButtonFormQueue"
+ requestDelay="#{bean.clientRequestDelay}"
+ actionListener="#{bean.processActionListener}"
+ action="#{bean.processAction}"
+ value="formQueue"
+ reRender="outputText"
+ eventsQueue="formQueue"/>
+
+ <a4j:poll id="poll"
+ interval="5000"
+ enabled="#{bean.pollEnabled}"
+ eventsQueue="queue"
+ actionListener="#{bean.processActionListener}"
+ action="#{bean.processAction}"
+ reRender="outputText" />
+
+ </a4j:region>
+ </h:form>
+ <a4j:log popup="false" id="log" />
+ </ui:composition>
+</html>
Property changes on: trunk/sandbox/samples/queue-sample/src/main/webapp/templates/index.xhtml
___________________________________________________________________
Name: svn:mergeinfo
+
16 years, 10 months