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

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Aug 1 19:28:02 EDT 2007


Author: nbelaevski
Date: 2007-08-01 19:28:02 -0400 (Wed, 01 Aug 2007)
New Revision: 1994

Modified:
   trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
Log:
- Taglib URIs updated
- Missing StackingTreeModel$Key hashCode(...) & equals(...) methods added

Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java	2007-08-01 23:27:57 UTC (rev 1993)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java	2007-08-01 23:28:02 UTC (rev 1994)
@@ -223,33 +223,41 @@
 			Range range, ListRowKey argumentKey, Object argument,
 			boolean last) throws IOException {
 
-		if (argumentKey != null) {
-			getRoot().setRowKey(argumentKey);
-			processElement(context, dataVisitor, argument, argumentKey, last);
-			getRoot().setRowKey(argumentKey);
-		} else {
-			getRoot().setRowKey(argumentKey);
-		}
+		TreeRange treeRange = (TreeRange) range;
+		
+		if (treeRange == null || treeRange.processNode(argumentKey)) {
+			if (argumentKey != null) {
+				getRoot().setRowKey(argumentKey);
+				processElement(context, dataVisitor, argument, argumentKey, last);
+				getRoot().setRowKey(argumentKey);
+			} else {
+				getRoot().setRowKey(argumentKey);
+			}
 
-		ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
-				new Visitor1(dataVisitor));
-		Iterator iterator = StackingTreeModel.this.getModels().entrySet().iterator();
-		while (iterator.hasNext()) {
-			Map.Entry entry = (Map.Entry) iterator.next();
-			StackingTreeModel model = (StackingTreeModel) entry.getValue();
+			ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
+					new Visitor1(dataVisitor));
+			
+			if (treeRange == null || treeRange.processChildren(argumentKey)) {
+				Iterator iterator = StackingTreeModel.this.getModels().entrySet().iterator();
+				while (iterator.hasNext()) {
+					Map.Entry entry = (Map.Entry) iterator.next();
+					StackingTreeModel model = (StackingTreeModel) entry.getValue();
 
-			Argument argument2 = new Argument();
-			argument2.listRowKey = argumentKey;
-			argument2.argument = argument;
-			// setup current model
-			argument2.model = model;
-			argument2.range = range;
-			model.getDataModel().walk(context, shiftingDataVisitor, null,
-					argument2);
+					Argument argument2 = new Argument();
+					argument2.listRowKey = argumentKey;
+					argument2.argument = argument;
+					// setup current model
+					argument2.model = model;
+					argument2.range = range;
+					model.getDataModel().walk(context, shiftingDataVisitor, null,
+							argument2);
 
+				}
+
+			}
+			
+			shiftingDataVisitor.end(context);
 		}
-
-		shiftingDataVisitor.end(context);
 	}
 
 	public Map getModels() {
@@ -435,6 +443,37 @@
 		public String toString() {
 			return this.modelId + ":" + this.modelKey;
 		}
+
+		public int hashCode() {
+			final int prime = 31;
+			int result = 1;
+			result = prime * result
+					+ ((modelId == null) ? 0 : modelId.hashCode());
+			result = prime * result
+					+ ((modelKey == null) ? 0 : modelKey.hashCode());
+			return result;
+		}
+
+		public boolean equals(Object obj) {
+			if (this == obj)
+				return true;
+			if (obj == null)
+				return false;
+			if (getClass() != obj.getClass())
+				return false;
+			final Key other = (Key) obj;
+			if (modelId == null) {
+				if (other.modelId != null)
+					return false;
+			} else if (!modelId.equals(other.modelId))
+				return false;
+			if (modelKey == null) {
+				if (other.modelKey != null)
+					return false;
+			} else if (!modelKey.equals(other.modelKey))
+				return false;
+			return true;
+		}
 	}
 
 	public void addTreeComponentModelListener(




More information about the richfaces-svn-commits mailing list