[seam-commits] Seam SVN: r15614 - in branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam: mock and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Oct 14 03:25:06 EDT 2013


Author: manaRH
Date: 2013-10-14 03:25:06 -0400 (Mon, 14 Oct 2013)
New Revision: 15614

Added:
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockPartialViewContext.java
Modified:
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamNavigationHandler.java
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockFacesContext.java
Log:
JBSEAM-5127 added JSF2 navigation handling in case of partialRequest

Modified: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamNavigationHandler.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamNavigationHandler.java	2013-10-11 15:13:06 UTC (rev 15613)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamNavigationHandler.java	2013-10-14 07:25:06 UTC (rev 15614)
@@ -7,6 +7,7 @@
 import javax.faces.application.NavigationCase;
 import javax.faces.application.NavigationHandler;
 import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
 
 import org.jboss.seam.core.Init;
 import org.jboss.seam.faces.FacesManager;
@@ -36,6 +37,8 @@
    {
       if ( !context.getResponseComplete() ) //workaround for a bug in MyFaces
       {
+    	  String oldView = (context.getViewRoot() != null ? context.getViewRoot().getViewId() : "");
+    	  
          if ( isOutcomeViewId(outcome) )
          {
             FacesManager.instance().interpolateAndRedirect(outcome);
@@ -48,6 +51,14 @@
          {
             baseNavigationHandler.handleNavigation(context, fromAction, outcome);
          }
+         else {
+        	 if (!oldView.equals(context.getViewRoot().getViewId())) {
+     			PartialViewContext pctx = context.getPartialViewContext();
+     			if (!pctx.isRenderAll()) {
+     				pctx.setRenderAll(true);
+     			}
+     		}
+         }
       }
    }
 

Modified: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockFacesContext.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockFacesContext.java	2013-10-11 15:13:06 UTC (rev 15613)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockFacesContext.java	2013-10-14 07:25:06 UTC (rev 15614)
@@ -246,4 +246,8 @@
       return false;
    }
 
+   @Override
+   public MockPartialViewContext getPartialViewContext() {
+	   return new MockPartialViewContext();
+   }
 }

Added: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockPartialViewContext.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockPartialViewContext.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/MockPartialViewContext.java	2013-10-14 07:25:06 UTC (rev 15614)
@@ -0,0 +1,92 @@
+package org.jboss.seam.mock;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.faces.context.PartialResponseWriter;
+import javax.faces.context.PartialViewContext;
+import javax.faces.event.PhaseId;
+
+public class MockPartialViewContext extends PartialViewContext
+{
+
+   Boolean partialRequest;
+   Boolean renderAll;
+   Boolean ajaxRequest;
+   
+   public MockPartialViewContext()
+   {
+      partialRequest = true;
+      ajaxRequest = true;
+      renderAll = false;
+   }
+   
+   @Override
+   public Collection<String> getExecuteIds()
+   {
+      return Collections.emptyList();
+   }
+
+   @Override
+   public PartialResponseWriter getPartialResponseWriter()
+   {
+      return null;
+   }
+
+   @Override
+   public Collection<String> getRenderIds()
+   {
+      return Collections.emptyList();
+   }
+
+   @Override
+   public boolean isAjaxRequest()
+   {      
+      return this.ajaxRequest;
+   }
+
+   @Override
+   public boolean isExecuteAll()
+   {
+      return false;
+   }
+
+   @Override
+   public boolean isPartialRequest()
+   {
+      return this.partialRequest;
+   }
+
+   @Override
+   public boolean isRenderAll()
+   {
+      return this.renderAll;
+   }
+
+   @Override
+   public void processPartial(PhaseId arg0)
+   {
+
+   }
+
+   @Override
+   public void release()
+   {
+      this.renderAll = null;
+      this.partialRequest = null;
+      this.ajaxRequest = null;
+   }
+
+   @Override
+   public void setPartialRequest(boolean arg0)
+   {
+      this.partialRequest = arg0;
+   }
+
+   @Override
+   public void setRenderAll(boolean arg0)
+   {
+      this.renderAll = arg0;
+   }
+
+}



More information about the seam-commits mailing list