myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r643383 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
Date Tue, 01 Apr 2008 12:51:56 GMT
Author: imario
Date: Tue Apr  1 05:51:07 2008
New Revision: 643383

URL: http://svn.apache.org/viewvc?rev=643383&view=rev
Log:
fixed init on non-ppr requests

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java?rev=643383&r1=643382&r2=643383&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRSupport.java
Tue Apr  1 05:51:07 2008
@@ -321,12 +321,29 @@
             throw new FacesException("PPRPanelGroup must be embedded in a form.");
         }
         final String formName = fi.getFormName();
+        Map requestMap = facesContext.getExternalContext().getRequestMap();
 
         String pprCtrlReference = "dojo.byId('" + formName + "').myFacesPPRCtrl";
 
         //Each form containing PPRPanelGroups has its own PPRCtrl
-        if (!pprGroup.getInitializationSent()) {
+
+        // the following complicated stuff should deal with the following use-cases:
+        // 1) normal create ppr on non-ppr-response
+        // 2) create ppr on ppr-response
+        // 3) add triggers to ppr on ppr-response (e.g to commands within uidata)
+        //
+        // get state of the ppr component ...
+        boolean pprInited = pprGroup.getInitializationSent();
+        if (!PPRSupport.isPartialRequest(facesContext))
+        {
+            // ... but override with current request state if we are not within an
+            // ppr request.
+            pprInited = Boolean.TRUE.equals(requestMap.get(PPR_INITIALIZED + "." + formName));
+        }
+
+        if (!pprInited) {
             pprGroup.setInitializationSent(true);
+            requestMap.put(PPR_INITIALIZED + "." + formName, Boolean.TRUE);
 
             script.append(pprCtrlReference + "=" + MY_FACES_PPR_INIT_CODE + "('" + formName
+ "'," + pprGroup.getShowDebugMessages().booleanValue() + "," + pprGroup.getStateUpdate().booleanValue()
+ ");\n");
 



Mime
View raw message