You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/05/08 14:30:36 UTC

svn commit: r772959 - /myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java

Author: werpu
Date: Fri May  8 12:30:36 2009
New Revision: 772959

URL: http://svn.apache.org/viewvc?rev=772959&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2117
fixed a small errata the code now triggers properly only
on the execute ids as defined by the spec

Modified:
    myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java?rev=772959&r1=772958&r2=772959&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java Fri May  8 12:30:36 2009
@@ -236,6 +236,12 @@
     }
     
     @Override
+    /**
+     * process the partial response
+     * allowed phase ids according to the spec
+     *
+     *
+     */
     public void processPartial(PhaseId phaseId)
     {
         assertNotReleased(METHOD_PROCESSPARTIAL);
@@ -246,14 +252,32 @@
                 || phaseId == PhaseId.PROCESS_VALIDATIONS
                 || phaseId == PhaseId.UPDATE_MODEL_VALUES)
         {
-            Set<VisitHint> hints = new HashSet<VisitHint>();
-            hints.add(VisitHint.EXECUTE_LIFECYCLE);
-            hints.add(VisitHint.SKIP_UNRENDERED);
-            VisitContext visitCtx = VisitContext.createVisitContext(_facesContext, getRenderIds(), hints);
-            viewRoot.visitTree(visitCtx, new PhaseAwareVisitCallback(_facesContext, phaseId));
+            processPartialExecute(viewRoot,phaseId);
+        } else if(phaseId == PhaseId.RENDER_RESPONSE) {
+            processPartialRendering(viewRoot, phaseId);
         }
+
+
     }
-    
+
+    private void processPartialExecute(UIComponent viewRoot, PhaseId phaseId) {
+        Collection<String> executeIds = getExecuteIds();
+        if(executeIds == null || executeIds.isEmpty()) {
+            return;
+        }
+        Set<VisitHint> hints = new HashSet<VisitHint>();
+        hints.add(VisitHint.EXECUTE_LIFECYCLE);
+        hints.add(VisitHint.SKIP_UNRENDERED);
+        VisitContext visitCtx = VisitContext.createVisitContext(_facesContext, executeIds , hints);
+        viewRoot.visitTree(visitCtx, new PhaseAwareVisitCallback(_facesContext, phaseId));
+    }
+
+    private void processPartialRendering(UIComponent viewRoot, PhaseId phaseId) {
+        //TODO process partial rendering
+        //https://issues.apache.org/jira/browse/MYFACES-2118
+    }
+
+
     /**
      * has to be thrown in many of the methods if the method is called after the instance has been released!
      */
@@ -282,6 +306,7 @@
         _released = true;        
     }
 
+
     private class PhaseAwareVisitCallback implements VisitCallback {
         private PhaseId _phaseId;
         private FacesContext _facesContext;