[richfaces-svn-commits] JBoss Rich Faces SVN: r15233 - root/framework/trunk/impl/src/main/java/org/richfaces/context.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Aug 20 10:56:29 EDT 2009


Author: nbelaevski
Date: 2009-08-20 10:56:29 -0400 (Thu, 20 Aug 2009)
New Revision: 15233

Modified:
   root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
Log:
PartialViewContext refactoring for better behaviors support
Added check for "ajaxRendered" attribute

Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java	2009-08-20 12:08:37 UTC (rev 15232)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java	2009-08-20 14:56:29 UTC (rev 15233)
@@ -132,26 +132,18 @@
 			return result;
 		}
 		
-		protected Object getAttributeObject(UIComponent target) {
-			Object result = null;
-			if (behaviorEvent != null) {
-				AjaxBehavior ajaxBehavior = findBehavior(target);
-				if (ajaxBehavior != null) {
-					result = getBehaviorAttributeValue(ajaxBehavior);
-				}
-			} else {
-				result = getAttributeValue(target);
-			}
-			
-			return result;
-		}
-		
 		protected abstract Object getBehaviorAttributeValue(AjaxBehavior behavior);
 
 		protected abstract Object getAttributeValue(UIComponent component);
 		
-		public VisitResult visit(VisitContext context, UIComponent target) {
-			Object attributeObject = getAttributeObject(target);
+		protected void doVisit(FacesContext context, UIComponent target, AjaxBehavior behavior) {
+			Object attributeObject = null;
+			if (behavior != null) {
+				attributeObject = getBehaviorAttributeValue(behavior);
+			} else {
+				attributeObject = getAttributeValue(target);
+			}
+			
 			Collection<String> attributeIds = AjaxRendererUtils.asSet(attributeObject);
 			if (attributeIds != null && !attributeIds.isEmpty()) {
 				if (attributeIds.contains(AjaxRendererUtils.ALL)) {
@@ -174,11 +166,20 @@
 						addDefaultComponents(attributeIds);
 						
 						componentIds.addAll(RendererUtils.getInstance().findComponentsFor(
-							context.getFacesContext(), target, attributeIds));
+							context, target, attributeIds));
 					}
 				}
 			}
-
+		}
+		
+		public final VisitResult visit(VisitContext visitContext, UIComponent target) {
+			AjaxBehavior ajaxBehavior = null;
+			if (behaviorEvent != null) {
+				ajaxBehavior = findBehavior(target);
+			}
+			
+			doVisit(visitContext.getFacesContext(), target, ajaxBehavior);
+			
 			return VisitResult.COMPLETE;
 		}
 		
@@ -230,14 +231,13 @@
 			return limitToList;
 		}
 
-		public VisitResult visit(VisitContext context, UIComponent target) {
-			VisitResult visitResult = super.visit(context, target);
-			
+		@Override
+		protected void doVisit(FacesContext context, UIComponent target,
+				AjaxBehavior behavior) {
+			super.doVisit(context, target, behavior);
 			limitToList = AjaxRendererUtils.isAjaxLimitToList(target);
-
-			return visitResult;
 		}
-
+		
 		@Override
 		public Object getAttributeValue(UIComponent component) {
 			return component.getAttributes().get("render");
@@ -254,8 +254,10 @@
 		List<String> ids = new ArrayList<String>();
 		Collection<AjaxOutput> ajaxOutputComponentsSet = PartialViewContextAjaxOutputTracker.getAjaxOutputComponentsSet(facesContext);
 		for (AjaxOutput ajaxOutput : ajaxOutputComponentsSet) {
-			UIComponent ajaxOutputComponent = (UIComponent) ajaxOutput;
-			ids.add(ajaxOutputComponent.getClientId(facesContext));
+			if (ajaxOutput.isAjaxRendered()) {
+				UIComponent ajaxOutputComponent = (UIComponent) ajaxOutput;
+				ids.add(ajaxOutputComponent.getClientId(facesContext));
+			}
 		}
 		
 		return ids;



More information about the richfaces-svn-commits mailing list