Author: ilya_shaikovsky
Date: 2008-03-28 09:44:51 -0400 (Fri, 28 Mar 2008)
New Revision: 7363
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/poll/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/poll/PollBean.java
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/form/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/examples/clock.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-2820
http://jira.jboss.com/jira/browse/RF-2822
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java 2008-03-28
13:17:44 UTC (rev 7362)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java 2008-03-28
13:44:51 UTC (rev 7363)
@@ -10,13 +10,9 @@
private String address;
private String city;
private String zip;
- private Date date;
- private Date pollStartTime;
- private boolean pollEnabled;
public UserBean() {
super();
- pollEnabled=true;
}
public String getName() {
@@ -60,29 +56,6 @@
this.job = job;
}
- 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 void setDate(Date date) {
- this.date = date;
- }
-
- public boolean getPollEnabled() {
- return pollEnabled;
- }
-
- public void setPollEnabled(boolean pollEnabled) {
- if (pollEnabled) setPollStartTime(null);
- this.pollEnabled = pollEnabled;
- }
-
public String getAddress() {
return address;
}
@@ -107,12 +80,4 @@
this.zip = zip;
}
- public Date getPollStartTime() {
- return pollStartTime;
- }
-
- public void setPollStartTime(Date pollStartTime) {
- this.pollStartTime = pollStartTime;
- }
-
}
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/poll/PollBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/poll/PollBean.java
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/poll/PollBean.java 2008-03-28
13:44:51 UTC (rev 7363)
@@ -0,0 +1,48 @@
+/**
+ *
+ */
+package org.richfaces.demo.poll;
+
+import java.util.Date;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+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: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-03-28
13:17:44 UTC (rev 7362)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-03-28
13:44:51 UTC (rev 7363)
@@ -39,7 +39,7 @@
<managed-bean>
<managed-bean-name>userBean</managed-bean-name>
<managed-bean-class>org.richfaces.demo.ajaxsupport.UserBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
+ <managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>screenWidth</property-name>
<property-class>java.lang.Integer</property-class>
@@ -303,6 +303,11 @@
<managed-bean-class>org.richfaces.demo.filteringFeature.FilteringBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>pollBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.demo.poll.PollBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/form/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/form/usage.xhtml 2008-03-28
13:17:44 UTC (rev 7362)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/form/usage.xhtml 2008-03-28
13:44:51 UTC (rev 7363)
@@ -20,9 +20,6 @@
padding:0;
}
- input[type="button"], input[type="submit"] {
- background-color:#{a4jSkin.trimColor};
- }
</style>
<p>a4j:form functionality is similar to the standard h:form component except two
additional features:
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/examples/clock.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/examples/clock.xhtml 2008-03-28
13:17:44 UTC (rev 7362)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/examples/clock.xhtml 2008-03-28
13:44:51 UTC (rev 7363)
@@ -1,30 +1,39 @@
<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">
-
- <rich:separator height="1"/>
+
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">
+
+ <rich:separator height="1" />
<a4j:region>
<h:form>
- <a4j:poll id="poll" interval="500"
enabled="#{userBean.pollEnabled}" reRender="poll,grid"/>
+ <a4j:poll id="poll" interval="500"
enabled="#{pollBean.pollEnabled}"
+ reRender="poll,grid" />
</h:form>
</a4j:region>
<h:form>
<h:panelGrid columns="2" width="80%" id="grid">
- <h:panelGrid columns="1">
- <h:outputText value="Polling Inactive" rendered="#{not
userBean.pollEnabled}"></h:outputText>
- <h:outputText value="Polling Active"
rendered="#{userBean.pollEnabled}"></h:outputText>
+ <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="#{userBean.pollEnabled?'Stop':'Start'}
Polling"
- reRender="poll, grid">
- <a4j:actionparam name="polling"
value="#{!userBean.pollEnabled}"
- assignTo="#{userBean.pollEnabled}"/>
- </a4j:commandButton>
+ value="#{pollBean.pollEnabled?'Stop':'Start'} Polling"
+ reRender="poll, grid">
+ <a4j:actionparam name="polling"
value="#{!pollBean.pollEnabled}"
+ assignTo="#{pollBean.pollEnabled}" />
+ </a4j:commandButton>
+
</h:panelGrid>
- <h:outputText id="serverDate" style="font-size:16px"
value="Server Date: #{userBean.date}"/>
- </h:panelGrid>
+
+ <h:outputText id="serverDate" style="font-size:16px"
+ value="Server Date: #{pollBean.date}" />
+ </h:panelGrid>
</h:form>
- <rich:separator height="1" style="padding-top:10px"/>
+ <rich:separator height="1" style="padding-top:10px" />
</ui:composition>
\ No newline at end of file