Author: konstantin.mishin
Date: 2008-06-11 11:16:22 -0400 (Wed, 11 Jun 2008)
New Revision: 8999
Added:
trunk/framework/api/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java
trunk/framework/impl/src/main/java/org/richfaces/event/ComponentViewPhaseListener.java
Removed:
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentViewPhaseListener.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/framework/impl/src/main/resources/META-INF/faces-config.xml
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
Log:
RF-2815
Added:
trunk/framework/api/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java
===================================================================
---
trunk/framework/api/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java
(rev 0)
+++
trunk/framework/api/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java 2008-06-11
15:16:22 UTC (rev 8999)
@@ -0,0 +1,9 @@
+package org.richfaces.component;
+
+import javax.faces.event.PhaseEvent;
+
+public interface ComponentPhaseEventHandler {
+
+ void beforePhase(PhaseEvent event);
+
+}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-06-11
13:35:39 UTC (rev 8998)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-06-11
15:16:22 UTC (rev 8999)
@@ -48,6 +48,7 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -60,6 +61,7 @@
import org.ajax4jsf.renderkit.AjaxChildrenRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.richfaces.component.ComponentPhaseEventHandler;
/**
* Base class for iterable components, like dataTable, Tomahawk dataList,
@@ -69,7 +71,7 @@
* @author shura
*
*/
-public abstract class UIDataAdaptor extends UIData implements AjaxDataEncoder {
+public abstract class UIDataAdaptor extends UIData implements AjaxDataEncoder,
ComponentPhaseEventHandler {
/**
*
@@ -1212,7 +1214,6 @@
}
public void encodeBegin(FacesContext context) throws IOException {
- resetDataModel();
if (null != childState && !keepSaved(context)) {
childState.remove(getBaseClientId(context));
}
@@ -1648,4 +1649,8 @@
setExtendedDataModel(null);
super.setValue(value);
}
+
+ public void beforePhase(PhaseEvent event) {
+ resetDataModel();
+ }
}
Deleted:
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java 2008-06-11
13:35:39 UTC (rev 8998)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentPhaseEventHandler.java 2008-06-11
15:16:22 UTC (rev 8999)
@@ -1,9 +0,0 @@
-package org.richfaces.component;
-
-import javax.faces.event.PhaseEvent;
-
-public interface ComponentPhaseEventHandler {
-
- void doBeforePhase(PhaseEvent event);
-
-}
Deleted:
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentViewPhaseListener.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentViewPhaseListener.java 2008-06-11
13:35:39 UTC (rev 8998)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/ComponentViewPhaseListener.java 2008-06-11
15:16:22 UTC (rev 8999)
@@ -1,48 +0,0 @@
-package org.richfaces.component;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseEvent;
-import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
-
-
-public class ComponentViewPhaseListener implements PhaseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -2437433246178955788L;
-
- public void afterPhase(PhaseEvent event) {
- }
-
- private void doBeforePhase(PhaseEvent event, UIComponent component) {
- if (component.isRendered()) {
- if (component instanceof ComponentPhaseEventHandler) {
- ((ComponentPhaseEventHandler) component).doBeforePhase(event);
- }
- Iterator<UIComponent> children = component.getFacetsAndChildren();
- while (children.hasNext()) {
- doBeforePhase(event, children.next());
- }
- }
-
- }
-
- public void beforePhase(PhaseEvent event) {
- FacesContext facesContext = event.getFacesContext();
- UIViewRoot viewRoot = facesContext.getViewRoot();
- if (viewRoot != null) {
- doBeforePhase(event, viewRoot);
- }
- }
-
- public PhaseId getPhaseId() {
- return PhaseId.RENDER_RESPONSE;
- }
-
-}
Added:
trunk/framework/impl/src/main/java/org/richfaces/event/ComponentViewPhaseListener.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/event/ComponentViewPhaseListener.java
(rev 0)
+++
trunk/framework/impl/src/main/java/org/richfaces/event/ComponentViewPhaseListener.java 2008-06-11
15:16:22 UTC (rev 8999)
@@ -0,0 +1,50 @@
+package org.richfaces.event;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.richfaces.component.ComponentPhaseEventHandler;
+
+
+public class ComponentViewPhaseListener implements PhaseListener {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2437433246178955788L;
+
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ private void doBeforePhase(PhaseEvent event, UIComponent component) {
+ if (component.isRendered()) {
+ if (component instanceof ComponentPhaseEventHandler) {
+ ((ComponentPhaseEventHandler) component).beforePhase(event);
+ }
+ Iterator<UIComponent> children = component.getFacetsAndChildren();
+ while (children.hasNext()) {
+ doBeforePhase(event, children.next());
+ }
+ }
+
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (viewRoot != null) {
+ doBeforePhase(event, viewRoot);
+ }
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.RENDER_RESPONSE;
+ }
+
+}
Modified: trunk/framework/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/faces-config.xml 2008-06-11 13:35:39
UTC (rev 8998)
+++ trunk/framework/impl/src/main/resources/META-INF/faces-config.xml 2008-06-11 15:16:22
UTC (rev 8999)
@@ -18,7 +18,7 @@
<lifecycle>
<phase-listener>org.ajax4jsf.event.AjaxPhaseListener</phase-listener>
<phase-listener>org.ajax4jsf.event.InitPhaseListener</phase-listener>
-
<phase-listener>org.richfaces.component.ComponentViewPhaseListener</phase-listener>
+
<phase-listener>org.richfaces.event.ComponentViewPhaseListener</phase-listener>
</lifecycle>
<managed-bean>
<managed-bean-name>a4j</managed-bean-name>
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-06-11
13:35:39 UTC (rev 8998)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-06-11
15:16:22 UTC (rev 8999)
@@ -48,7 +48,7 @@
* JSF component class
*
*/
-public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable2,
Filterable, ComponentPhaseEventHandler {
+public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable2,
Filterable{
Collection<Object> sortPriority = new ArrayList<Object>();
@@ -83,11 +83,7 @@
public static final String COMPONENT_TYPE = "org.richfaces.DataTable";
public static final String COMPONENT_FAMILY = "org.richfaces.DataTable";
-
- public void doBeforePhase(javax.faces.event.PhaseEvent event) {
- super.resetDataModel();
- }
-
+
@Override
protected ExtendedDataModel createDataModel() {
List<FilterField> filterFields = new LinkedList<FilterField>();