Author: ilya_shaikovsky
Date: 2010-05-25 05:57:23 -0400 (Tue, 25 May 2010)
New Revision: 17227
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/poll/
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/poll/PollBean.java
root/examples/richfaces-showcase/trunk/src/main/webapp/CSS/common.css
root/examples/richfaces-showcase/trunk/src/main/webapp/images/note_bg.gif
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/poll/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/poll/poll.xhtml
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/InventoryVendorList.java
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/simpleTable.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
Log:
https://jira.jboss.org/browse/RF-8292
https://jira.jboss.org/browse/RF-8298
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/poll/PollBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/poll/PollBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/poll/PollBean.java 2010-05-25
09:57:23 UTC (rev 17227)
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.richfaces.demo.poll;
+
+import java.util.Date;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+@ManagedBean
+@ViewScoped
+public class PollBean {
+
+ private Date pollStartTime;
+ private boolean pollEnabled;
+
+ public PollBean() {
+ pollEnabled = true;
+ }
+
+ public Date getDate() {
+ Date date = new Date();
+ if (null == pollStartTime) {
+ pollStartTime = new Date();
+ return date;
+ }
+ if ((date.getTime() - pollStartTime.getTime()) >= 60000) {
+ setPollEnabled(false);
+ }
+ return date;
+ }
+
+ public boolean getPollEnabled() {
+ return pollEnabled;
+ }
+
+ public void setPollEnabled(boolean pollEnabled) {
+ if (pollEnabled) {
+ setPollStartTime(null);
+ }
+ this.pollEnabled = pollEnabled;
+ }
+
+ public Date getPollStartTime() {
+ return pollStartTime;
+ }
+
+ public void setPollStartTime(Date pollStartTime) {
+ this.pollStartTime = pollStartTime;
+ }
+
+}
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/InventoryVendorList.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/InventoryVendorList.java 2010-05-25
08:45:36 UTC (rev 17226)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/InventoryVendorList.java 2010-05-25
09:57:23 UTC (rev 17227)
@@ -7,6 +7,10 @@
private String vendor;
private List<InventoryVendorItem> vendorItems;
+ public InventoryVendorList() {
+ vendorItems = new ArrayList<InventoryVendorItem>();
+ }
+
public long getCount() {
if (vendorItems != null) {
return vendorItems.size();
@@ -15,10 +19,6 @@
}
}
- public InventoryVendorList() {
- vendorItems = new ArrayList<InventoryVendorItem>();
- }
-
public String getVendor() {
return vendor;
}
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/CSS/common.css
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/CSS/common.css
(rev 0)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/CSS/common.css 2010-05-25
09:57:23 UTC (rev 17227)
@@ -0,0 +1,5 @@
+.note{
+ padding : 15px 15px 15px 85px;
+ margin : 20px; border : 1px solid #ACBECE;
+ background: url(${facesContext.externalContext.requestContextPath}/images/note_bg.gif)
top left no-repeat #F0F3F7
+}
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/images/note_bg.gif
===================================================================
(Binary files differ)
Property changes on:
root/examples/richfaces-showcase/trunk/src/main/webapp/images/note_bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/simpleTable.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/simpleTable.xhtml 2010-05-25
08:45:36 UTC (rev 17226)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/simpleTable.xhtml 2010-05-25
09:57:23 UTC (rev 17227)
@@ -17,11 +17,11 @@
<h:form>
<tbl:dataTable value="#{carsBean.inventoryVendorLists}"
var="list">
<f:facet name="header">
- <tbl:colGroup>
+ <tbl:columnGroup>
<tbl:column colspan="6">
<h:outputText value="Cars marketplace" />
</tbl:column>
- <tbl:column>
+ <tbl:column breakBefore="true">
<h:outputText value="Model" />
</tbl:column>
<tbl:column>
@@ -39,7 +39,7 @@
<tbl:column>
<h:outputText value="Days Live" />
</tbl:column>
- </tbl:colGroup>
+ </tbl:columnGroup>
</f:facet>
<tbl:column colspan="6">
<h:outputText value="#{list.vendor}" />
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml 2010-05-25
08:45:36 UTC (rev 17226)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml 2010-05-25
09:57:23 UTC (rev 17227)
@@ -19,7 +19,7 @@
<ul>
<a4j:repeat value="#{carsBean.allVendors}" var="vendor">
<li><h:outputLink
- value="javascript:document.getElementById('form:table').richfaces.component.filter('vendor',
'#{vendor}')">#{vendor}</h:outputLink>
+ value="javascript:document.getElementById('form:table').component.filter('vendor',
'#{vendor}')">#{vendor}</h:outputLink>
</li>
</a4j:repeat>
</ul>
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/poll/poll.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/poll/poll.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/poll/poll.xhtml 2010-05-25
09:57:23 UTC (rev 17227)
@@ -0,0 +1,50 @@
+<!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: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:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+ <p>a4j:poll is one of the way how you can organize the periodical
+ polling of server data and updating the page. a4j:poll is a standard
+ RichFaces Ajax component. Thus, you can use the same approach as for
+ a4j:commandButton for example. I.e. you can use action attribute to
+ invoke the action method and reRender attribute to update area(s) on
+ the client when Ajax Response returns back. RichFaces uses the standard
+ form based request, so the form around the a4j:poll component is
+ required.</p>
+ <p>The following example shows how the date and time is updated on
+ the page based on the data taken from the server. To turn off polling,
+ press "Stop Polling" button.</p>
+ <h:form>
+
+ </h:form>
+ <h:form>
+ <h:panelGrid columns="2" width="80%" id="grid">
+ <h:panelGrid columns="1">
+
+ <h:outputText value="Polling Inactive"
+ rendered="#{not pollBean.pollEnabled}"></h:outputText>
+
+ <h:outputText value="Polling Active"
+ rendered="#{pollBean.pollEnabled}"></h:outputText>
+
+ <a4j:commandButton style="width:120px" id="control"
+ value="#{pollBean.pollEnabled?'Stop':'Start'} Polling"
+ reRender="poll, grid">
+
+ </a4j:commandButton>
+
+ </h:panelGrid>
+
+ <h:outputText id="serverDate" style="font-size:16px"
+ value="Server Date: #{pollBean.date}" />
+ </h:panelGrid>
+ </h:form>
+ <rich:panel bodyClass="note">
+ <b>NOTE:</b>polling is automatically disabled in this demo after one minute
of working.
+ </rich:panel>
+</ui:composition>
+</html>
\ No newline at end of file