Author: nbelaevski
Date: 2010-05-26 11:52:25 -0400 (Wed, 26 May 2010)
New Revision: 17268
Added:
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PhaseTracker.java
Modified:
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/CommandBean.java
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/DynamicExecuteBean.java
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PushBean.java
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RepeatBean.java
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SkinBean.java
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SupportBean.java
root/examples/core-demo/trunk/src/main/resources/log4j.xml
root/examples/core-demo/trunk/src/main/webapp/WEB-INF/faces-config.xml
root/examples/core-demo/trunk/src/main/webapp/ajax.xhtml
Log:
Beans in core-demo made Serializable
Added bypassUpdates demos for a4j:ajax
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/CommandBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/CommandBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/CommandBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -1,5 +1,6 @@
package org.richfaces.demo;
+import java.io.Serializable;
import java.util.Date;
import javax.faces.bean.ManagedBean;
@@ -8,7 +9,10 @@
@ManagedBean(name = "commandBean")
@SessionScoped
-public class CommandBean {
+public class CommandBean implements Serializable {
+
+ private static final long serialVersionUID = 3485896940723796437L;
+
private String name;
public void setName(String name) {
Modified:
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/DynamicExecuteBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/DynamicExecuteBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/DynamicExecuteBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -23,6 +23,8 @@
package org.richfaces.demo;
+import java.io.Serializable;
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
@@ -33,7 +35,10 @@
*/
@ManagedBean(name = "dynamicExecuteBean")
@SessionScoped
-public class DynamicExecuteBean {
+public class DynamicExecuteBean implements Serializable {
+
+ private static final long serialVersionUID = -486936947341873167L;
+
private static final SelectItem[] POSSIBLE_EXECUTE_OPTIONS = new SelectItem[] {
new SelectItem(null, "default"), new SelectItem("@none"), new
SelectItem("@this"), new SelectItem("@form"),
new SelectItem("formId"), new SelectItem("anotherFormId"),
new SelectItem("@all")
Added: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PhaseTracker.java
===================================================================
--- root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PhaseTracker.java
(rev 0)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PhaseTracker.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.demo;
+
+import java.text.MessageFormat;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PhaseTracker implements PhaseListener {
+
+ private static final long serialVersionUID = 6358081870120864332L;
+
+ private Logger logger = LoggerFactory.getLogger(PhaseTracker.class);
+
+ private ThreadLocal<Long> phaseTimer = new ThreadLocal<Long>();
+
+ public void afterPhase(PhaseEvent event) {
+ Long phaseStartTime = phaseTimer.get();
+
+ long measuredTime = 0;
+ if (phaseStartTime != null) {
+ measuredTime = System.currentTimeMillis() - phaseStartTime.longValue();
+ }
+
+ logger.debug(MessageFormat.format("Phase {0} completed by {1}ms",
event.getPhaseId(), measuredTime));
+ phaseTimer.set(null);
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ logger.debug(MessageFormat.format("Phase {0} started",
event.getPhaseId()));
+ phaseTimer.set(System.currentTimeMillis());
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.ANY_PHASE;
+ }
+
+}
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PushBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PushBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/PushBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -23,6 +23,7 @@
package org.richfaces.demo;
+import java.io.Serializable;
import java.util.EventListener;
import java.util.EventObject;
@@ -37,10 +38,14 @@
*/
@ManagedBean(name = "pushBean")
@SessionScoped
-public class PushBean {
+public class PushBean implements Serializable {
+
+ private static final long serialVersionUID = 4810889475400649809L;
+
private int counter = 0;
- private volatile PushEventListener listener;
+ private volatile transient PushEventListener listener;
+
public void setListener(EventListener listener) {
this.listener = (PushEventListener) listener;
}
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -21,6 +21,8 @@
*/
package org.richfaces.demo;
+import java.io.Serializable;
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.AjaxBehaviorEvent;
@@ -33,8 +35,10 @@
*/
@ManagedBean
@SessionScoped
-public class RegionBean {
+public class RegionBean implements Serializable {
+ private static final long serialVersionUID = -6371272297263012554L;
+
private static final SelectItem[] AVAILABLE_EXECUTE_OPTIONS = new SelectItem[] {
new SelectItem(null, "default"), new SelectItem("@region"),
new SelectItem("@all"), new SelectItem("@this")
};
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RepeatBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RepeatBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RepeatBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -21,6 +21,7 @@
*/
package org.richfaces.demo;
+import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -34,10 +35,14 @@
*/
@ManagedBean
@SessionScoped
-public class RepeatBean {
+public class RepeatBean implements Serializable {
- public static final class MatrixCell {
+ private static final long serialVersionUID = -4468004449310935853L;
+
+ public static final class MatrixCell implements Serializable {
+ private static final long serialVersionUID = -5911659561854593681L;
+
private int value = 0;
public int getValue() {
@@ -61,8 +66,10 @@
}
}
- public static final class MatrixRow {
+ public static final class MatrixRow implements Serializable {
+ private static final long serialVersionUID = -5051037819565283283L;
+
private List<MatrixCell> cells = new ArrayList<MatrixCell>();
public List<MatrixCell> getCells() {
@@ -74,8 +81,10 @@
}
}
- public static final class Data {
+ public static final class Data implements Serializable {
+ private static final long serialVersionUID = -1461777632529492912L;
+
private String text;
/**
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SkinBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SkinBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SkinBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -1,13 +1,17 @@
package org.richfaces.demo;
+import java.io.Serializable;
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
@ManagedBean(name = "skinBean")
@SessionScoped
-public class SkinBean {
+public class SkinBean implements Serializable {
+ private static final long serialVersionUID = 2744605279708632184L;
+
private SelectItem[] skinSetItems = {
new SelectItem("blueSky"),
new SelectItem("classic"),
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SupportBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SupportBean.java 2010-05-26
15:30:26 UTC (rev 17267)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/SupportBean.java 2010-05-26
15:52:25 UTC (rev 17268)
@@ -1,12 +1,17 @@
package org.richfaces.demo;
+import java.io.Serializable;
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.AjaxBehaviorEvent;
@SessionScoped
@ManagedBean(name = "supportBean")
-public class SupportBean {
+public class SupportBean implements Serializable {
+
+ private static final long serialVersionUID = -110973149750159911L;
+
private String text1;
private String text2;
Modified: root/examples/core-demo/trunk/src/main/resources/log4j.xml
===================================================================
--- root/examples/core-demo/trunk/src/main/resources/log4j.xml 2010-05-26 15:30:26 UTC
(rev 17267)
+++ root/examples/core-demo/trunk/src/main/resources/log4j.xml 2010-05-26 15:52:25 UTC
(rev 17268)
@@ -9,6 +9,9 @@
</layout>
</appender>
<logger name="org.richfaces">
+ <level value="info" />
+ </logger>
+ <logger name="org.richfaces.demo.PhaseTracker">
<level value="debug" />
</logger>
<root>
Modified: root/examples/core-demo/trunk/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- root/examples/core-demo/trunk/src/main/webapp/WEB-INF/faces-config.xml 2010-05-26
15:30:26 UTC (rev 17267)
+++ root/examples/core-demo/trunk/src/main/webapp/WEB-INF/faces-config.xml 2010-05-26
15:52:25 UTC (rev 17268)
@@ -16,5 +16,8 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <lifecycle>
+ <phase-listener>org.richfaces.demo.PhaseTracker</phase-listener>
+ </lifecycle>
</faces-config>
\ No newline at end of file
Modified: root/examples/core-demo/trunk/src/main/webapp/ajax.xhtml
===================================================================
--- root/examples/core-demo/trunk/src/main/webapp/ajax.xhtml 2010-05-26 15:30:26 UTC (rev
17267)
+++ root/examples/core-demo/trunk/src/main/webapp/ajax.xhtml 2010-05-26 15:52:25 UTC (rev
17268)
@@ -20,13 +20,13 @@
<h:panelGrid columns="2">
<h:outputText value="a:ajax attached fires ajax submit on 'keyup'
event"/>
<h:inputText value="#{supportBean.text1}">
- <a:ajax event="keyup" render="text1"
statusId="ilStatus" listener="#{supportBean.behaviorListener}"/>
+ <a:ajax event="keyup" render="text1"
status="ilStatus" listener="#{supportBean.behaviorListener}"/>
</h:inputText>
</h:panelGrid>
<h:panelGrid columns="1">
<h:outputText value="a:ajax for 'keyup' event wrapping several
elements" />
- <a:ajax event="keyup" execute="@this" render="text1"
statusId="ilStatus" listener="#{supportBean.behaviorListener}">
+ <a:ajax event="keyup" execute="@this" render="text1"
status="ilStatus" listener="#{supportBean.behaviorListener}">
<h:inputText value="#{supportBean.text1}" />
<h:inputText value="#{supportBean.text1}" />
<h:inputText value="#{supportBean.text1}" />
@@ -50,7 +50,7 @@
<h:panelGrid columns="2">
<h:outputText value="a:ajax attached fires ajax submit on default
event"/>
<h:inputText value="#{supportBean.text2}">
- <a:ajax render="text2" statusId="ilStatus"
limitRender="true"/>
+ <a:ajax render="text2" status="ilStatus"
limitRender="true"/>
</h:inputText>
</h:panelGrid>
@@ -69,5 +69,33 @@
</h:form>
+
+ <h:form>
+ <h:panelGrid columns="3">
+ bypassUpdates undefined
+ <h:inputText>
+ <a:ajax event="keyup" />
+ </h:inputText>
+ <h:commandLink value="Link">
+ <a:ajax />
+ </h:commandLink>
+
+ bypassUpdates="true"
+ <h:inputText>
+ <a:ajax bypassUpdates="true" event="keyup" />
+ </h:inputText>
+ <h:commandLink value="Link">
+ <a:ajax bypassUpdates="true" />
+ </h:commandLink>
+
+ bypassUpdates="#{true}"
+ <h:inputText>
+ <a:ajax bypassUpdates="#{true}" event="keyup" />
+ </h:inputText>
+ <h:commandLink value="Link">
+ <a:ajax bypassUpdates="#{true}" />
+ </h:commandLink>
+ </h:panelGrid>
+ </h:form>
</h:body>
</html>
\ No newline at end of file