Author: ilya_shaikovsky
Date: 2009-07-29 03:52:07 -0400 (Wed, 29 Jul 2009)
New Revision: 15032
Added:
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/choices.xhtml
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/examples/choices.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-7619
Added:
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/choices.xhtml
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/choices.xhtml
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/choices.xhtml 2009-07-29
07:52:07 UTC (rev 15032)
@@ -0,0 +1,38 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+ <p>
+ This sample works almost in the same way as usage
+ simple one. But there we are also using <b>DataTable
+ ajaxKeys</b> in order to update only modified cells
+ on push event.
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Table cells updates</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/push/examples/choices.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/dataTable/examples/choices.xhtml"/>
+ </ui:include>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/WEB-INF/src/org/richfaces/demo/datatable/Choice.java"/>
+ <ui:param name="openlabel" value="View Choice.java Source"
/>
+ <ui:param name="sourcetype" value="java" />
+ </ui:include>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/WEB-INF/src/org/richfaces/demo/datatable/ChoicesBean.java"/>
+ <ui:param name="openlabel" value="View ChoicesBean.java
Source" />
+ <ui:param name="sourcetype" value="java" />
+ </ui:include>
+ </div>
+ </fieldset>
+ </ui:define>
+
+ </ui:composition>
+</html>
Added:
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/examples/choices.xhtml
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/examples/choices.xhtml
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/push/examples/choices.xhtml 2009-07-29
07:52:07 UTC (rev 15032)
@@ -0,0 +1,55 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <style>
+.top {
+ vertical-align: top;
+}
+</style>
+ <h:form>
+ <rich:dataTable value="#{choicesBean.choices}" var="choice"
+ rowKeyVar="row" ajaxKeys="#{choicesBean.keysSet}">
+ <f:facet name="header">
+ <h:outputText value="Voting for favourite fruit" />
+ </f:facet>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="" />
+ </f:facet>
+ <h:outputText value="#{row}" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Choice name" />
+ </f:facet>
+ <h:outputText value="#{choice.label}" id="choiceLabel" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Current Votes" />
+ </f:facet>
+ <h:outputText value="#{choice.votesCount}" id="choiceVotes"
/>
+ </rich:column>
+ </rich:dataTable>
+ <a4j:commandButton value="Start" action="#{choicesBean.start}"
+ id="start" disabled="#{choicesBean.enabled}"
ajaxSingle="true"
+ reRender="push, stop, start" limitToList="true" />
+
+ <a4j:commandButton value="Stop" action="#{choicesBean.stop}"
id="stop"
+ disabled="#{!choicesBean.enabled}" ajaxSingle="true"
+ reRender="push,start, stop" limitToList="true" />
+ <a4j:outputPanel layout="block" id="tempResults">
+ <h:outputText
+ value="Latest update votes was: #{choicesBean.updateInfo} at
#{choicesBean.timeStamp}"
+ rendered="#{choicesBean.enabled}" />
+ </a4j:outputPanel>
+
+ <a4j:push enabled="#{choicesBean.enabled}" interval="3000"
+ timeout="3000" eventProducer="#{choicesBean.addListener}"
id="push"
+ limitToList="true" action="#{choicesBean.processUpdates}"
+ reRender="choiceVotes, push, tempResults" />
+ </h:form>
+</ui:composition>
\ No newline at end of file