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 2010/11/04 20:18:45 UTC

svn commit: r1031166 - /myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java

Author: lu4242
Date: Thu Nov  4 19:18:45 2010
New Revision: 1031166

URL: http://svn.apache.org/viewvc?rev=1031166&view=rev
Log:
MYFACESTEST-39 MockApplication20 should traverse view SystemEventListeners

Modified:
    myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java

Modified: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java?rev=1031166&r1=1031165&r2=1031166&view=diff
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java (original)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java Thu Nov  4 19:18:45 2010
@@ -24,6 +24,7 @@ import org.apache.myfaces.test.mock.reso
 import javax.faces.FacesException;
 import javax.faces.application.ProjectStage;
 import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIViewRoot;
 import javax.faces.component.behavior.Behavior;
 import javax.faces.context.FacesContext;
 import javax.faces.event.AbortProcessingException;
@@ -289,6 +290,12 @@ public class MockApplication20 extends M
     {
         checkNull(systemEventClass, "systemEventClass");
         checkNull(source, "source");
+        
+        //Call events only if event processing is enabled.
+        if (!facesContext.isProcessingEvents())
+        {
+            return;
+        }
 
         try
         {
@@ -304,6 +311,14 @@ public class MockApplication20 extends M
                         .getListenersForEventClass(systemEventClass),
                         systemEventClass, source, event);
             }
+            
+            UIViewRoot uiViewRoot = facesContext.getViewRoot();
+            if (uiViewRoot != null)
+            {
+                //Call listeners on view level
+                event = _traverseListenerList(uiViewRoot.getViewListenersForEventClass(systemEventClass), 
+                        systemEventClass, source, event);
+            }
 
             SystemListenerEntry systemListenerEntry = _systemEventListenerClassMap
                     .get(systemEventClass);