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/09/23 17:48:20 UTC

svn commit: r818145 - in /myfaces/core/trunk: api/src/main/java/javax/faces/component/UIComponent.java impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java

Author: werpu
Date: Wed Sep 23 15:48:18 2009
New Revision: 818145

URL: http://svn.apache.org/viewvc?rev=818145&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2361

adding the PostRestoreStateEvent triggers






Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java?rev=818145&r1=818144&r2=818145&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java Wed Sep 23 15:48:18 2009
@@ -579,6 +579,7 @@
         // The default implementation performs the following action. If the argument event is an instance of
         // AfterRestoreStateEvent,
         if (event instanceof PostRestoreStateEvent) {
+
             // call this.getValueExpression(java.lang.String) passing the literal string "binding"
             ValueExpression expression = getValueExpression("binding");
 
@@ -586,7 +587,16 @@
             if (expression != null) {
                 expression.setValue(getFacesContext().getELContext(), this);
             }
+
+            //we issue a PostRestoreStateEvent
+            //we issue it here because the spec clearly states what UIComponent is allowed to do
+            //the main issue is that the spec does not say anything about a global dispatch on this level
+            //but a quick blackbox test against the ri revealed that the event clearly is dispatched
+            //at restore level for every component so we either issue it here or in UIViewRoot and/or the facelet
+            // and jsp restore state triggers, a central point is preferrble so we do it here
+            getFacesContext().getApplication().publishEvent(getFacesContext(), PostRestoreStateEvent.class, UIComponent.class, this);
         }
+
     }
 
     public abstract void processValidators(FacesContext context);

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=818145&r1=818144&r2=818145&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 Wed Sep 23 15:48:18 2009
@@ -229,8 +229,14 @@
         }
         
         // Restore binding, because UIViewRoot.processRestoreState() is never called
-        view.visitTree(VisitContext.createVisitContext(context), new RestoreStateCallback());
-        
+        boolean oldContextEventState = context.isProcessingEvents();
+        //the event processing has to be enabled because of the restore view event triggers
+        context.setProcessingEvents(true);
+        try {
+            view.visitTree(VisitContext.createVisitContext(context), new RestoreStateCallback());
+        } finally {
+            context.setProcessingEvents(oldContextEventState);
+        }
         return view;
     }