Author: konstantin.mishin
Date: 2008-06-06 12:40:17 -0400 (Fri, 06 Jun 2008)
New Revision: 8934
Added:
trunk/ui/dataTable/src/main/java/org/richfaces/component/DataTableViewPhaseListener.java
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
Log:
RF-2815
Added:
trunk/ui/dataTable/src/main/java/org/richfaces/component/DataTableViewPhaseListener.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/component/DataTableViewPhaseListener.java
(rev 0)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/component/DataTableViewPhaseListener.java 2008-06-06
16:40:17 UTC (rev 8934)
@@ -0,0 +1,45 @@
+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 DataTableViewPhaseListener implements PhaseListener {
+
+ private static final long serialVersionUID = 4321239328240647676L;
+
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ private void resetDataModel(UIComponent component) {
+ if (component.isRendered()) {
+ if (component instanceof UIDataTable) {
+ ((UIDataTable) component).resetDataModel();
+ }
+ Iterator<UIComponent> children = component.getFacetsAndChildren();
+ while (children.hasNext()) {
+ resetDataModel(children.next());
+ }
+ }
+
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (viewRoot != null) {
+ resetDataModel(viewRoot);
+ }
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.RENDER_RESPONSE;
+ }
+
+}
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-06
16:23:40 UTC (rev 8933)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-06-06
16:40:17 UTC (rev 8934)
@@ -83,8 +83,13 @@
public static final String COMPONENT_TYPE = "org.richfaces.DataTable";
public static final String COMPONENT_FAMILY = "org.richfaces.DataTable";
-
+
@Override
+ protected void resetDataModel() {
+ super.resetDataModel();
+ }
+
+ @Override
protected ExtendedDataModel createDataModel() {
List<FilterField> filterFields = new LinkedList<FilterField>();
Map<String, SortField2> sortFieldsMap = new LinkedHashMap<String,
SortField2>();
Show replies by date