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
+