[richfaces-svn-commits] JBoss Rich Faces SVN: r12125 - trunk/framework/api/src/main/java/org/richfaces/model.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Jan 5 18:59:14 EST 2009


Author: nbelaevski
Date: 2009-01-05 18:59:14 -0500 (Mon, 05 Jan 2009)
New Revision: 12125

Modified:
   trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java
Log:
https://jira.jboss.org/jira/browse/RF-5526

Modified: trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java	2009-01-05 23:40:06 UTC (rev 12124)
+++ trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java	2009-01-05 23:59:14 UTC (rev 12125)
@@ -43,11 +43,9 @@
 	
 	private Log log = LogFactory.getLog(CacheableTreeDataModel.class);
 	
-	private final class Visitor implements DataVisitor, LastElementAware {
-		private final DataVisitor visitor;
+	private final class CacheFillingVisitor implements DataVisitor {
 
-		private Visitor(DataVisitor visitor) {
-			this.visitor = visitor;
+		private CacheFillingVisitor() {
 		}
 
 		public void process(FacesContext context, Object rowKey, Object argument)
@@ -55,25 +53,8 @@
 			TreeRowKey treeRowKey = (TreeRowKey) rowKey;
 			treeDataModel.setRowKey(treeRowKey);
 			setDefaultNodeData(locateTreeNode(treeRowKey, true), treeDataModel.getRowData());
-
-			if (visitor != null) {
-				visitor.process(context, rowKey, argument);
-			}
 		}
 
-		public void resetLastElement() {
-			if (visitor instanceof LastElementAware) {
-				((LastElementAware) visitor).resetLastElement();
-				
-			}
-		}
-
-		public void setLastElement() {
-			if (visitor instanceof LastElementAware) {
-				((LastElementAware) visitor).setLastElement();
-				
-			}
-		}
 	}
 
 	private final static DataVisitor NULL_VISITOR = new DataVisitor() {
@@ -110,7 +91,7 @@
 	public void walkModel(FacesContext context, DataVisitor visitor,
 			Range range, Object key, Object argument, boolean last)
 			throws IOException {
-		treeDataModel.walkModel(context, new Visitor(visitor), range, key,
+		treeDataModel.walkModel(context, visitor, range, key,
 				argument, last);
 	}
 
@@ -132,11 +113,11 @@
 		if (treeNode != null) {
 			if (cachedTreeNode == null || (nodeAdaptor.isLeaf(cachedTreeNode) && !nodeAdaptor.isLeaf(treeNode))) {
 				//fill cache
-				treeDataModel.walk(context, new Visitor(dataVisitor), range,
+				treeDataModel.walk(context, new CacheFillingVisitor(), range,
 						rowKey, argument, last);
-			} else {
-				super.walk(context, dataVisitor, range, rowKey, argument, last);
 			}
+
+			super.walk(context, dataVisitor, range, rowKey, argument, last);
 		}
 	}
 




More information about the richfaces-svn-commits mailing list