You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/11/30 20:20:18 UTC

svn commit: r885547 - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets: DefaultFaceletsStateManagementStrategy.java FaceletViewDeclarationLanguage.java compiler/UIInstructionHandler.java tag/jsf/ComponentTagHandlerDelegate.java

Author: lu4242
Date: Mon Nov 30 19:20:18 2009
New Revision: 885547

URL: http://svn.apache.org/viewvc?rev=885547&view=rev
Log:
MYFACES-2428 Id generation for facelets cause problems with htmlunit 2.4 or lower

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java?rev=885547&r1=885546&r2=885547&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java Mon Nov 30 19:20:18 2009
@@ -459,6 +459,7 @@
                 String currentClientId = component.getClientId();
                 
                 List<UIComponent> children  = component.getChildren();
+                int pos = 0;
                 for (int i = 0; i < children.size(); i++)
                 {
                     UIComponent child = children.get(i);
@@ -472,7 +473,7 @@
                                     new Object[]{
                                         currentClientId,
                                         null,
-                                        i,
+                                        pos,
                                         internalBuildTreeStructureToSave(child),
                                         child.processSaveState(context)});
                         }
@@ -480,6 +481,7 @@
                         {
                             saveStateOnMap( context, states, child);
                         }
+                        pos++;
                     }
                 }
             }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java?rev=885547&r1=885546&r2=885547&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java Mon Nov 30 19:20:18 2009
@@ -274,14 +274,22 @@
         // The view is only built on restoreView or renderView, but if
         // we are not using partial state saving, we need to mark the current
         // view as filled, otherwise it will be filled again on renderView.
-        // return context.getAttributes().containsKey(view.toString());
-        return view.getAttributes().containsKey(FILLED_VIEW);
+        return context.getAttributes().containsKey(view);
+        // -= Leonardo Uribe =- save this key on view cause render fail, because the view
+        // is built before render view to "restore" the transient components that has
+        // facelet markup (facelets UIInstructions ...) This effect is only notice when
+        // partial state saving is not used. 
+        //return view.getAttributes().containsKey(FILLED_VIEW);
     }
     
     private void setFilledView(FacesContext context, UIViewRoot view)
     {
-        //context.getAttributes().put(view.toString(), Boolean.TRUE);
-        view.getAttributes().put(FILLED_VIEW, Boolean.TRUE);
+        context.getAttributes().put(view, Boolean.TRUE);
+        // -= Leonardo Uribe =- save this key on view cause render fail, because the view
+        // is built before render view to "restore" the transient components that has
+        // facelet markup (facelets UIInstructions ...) This effect is only notice when
+        // partial state saving is not used. 
+        // view.getAttributes().put(FILLED_VIEW, Boolean.TRUE);
         // Remove this var from faces context because this one prevent AjaxHandler
         // register the standard script library on Post-Redirect-Get pattern or
         // in the next view

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java?rev=885547&r1=885546&r2=885547&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java Mon Nov 30 19:20:18 2009
@@ -128,7 +128,7 @@
                     // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
                     // and call createUniqueId(). Also, note that UIViewRoot.createUniqueId() javadoc
                     // says we could send as seed the facelet generated id.
-                    String uid = uniqueIdVendor.createUniqueId(ctx.getFacesContext(), id);
+                    String uid = uniqueIdVendor.createUniqueId(ctx.getFacesContext(), null);
                     c.setId(uid);
                 }                
                 c.getAttributes().put(ComponentSupport.MARK_CREATED, id);

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java?rev=885547&r1=885546&r2=885547&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java Mon Nov 30 19:20:18 2009
@@ -177,7 +177,7 @@
                 {
                     // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
                     // and call createUniqueId()
-                    String uid = uniqueIdVendor.createUniqueId(facesContext, id);
+                    String uid = uniqueIdVendor.createUniqueId(facesContext, null);
                     c.setId(uid);
                 }
             }