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 2007/03/02 00:15:43 UTC

svn commit: r513535 - /myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/

Author: werpu
Date: Thu Mar  1 14:06:56 2007
New Revision: 513535

URL: http://svn.apache.org/viewvc?view=rev&rev=513535
Log:
shifting the view controller per request initialisation phase into pre Execution (preProcess)

Modified:
    myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/AbstractViewControllerExecutor.java
    myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/InterfaceViewControllerExecutor.java
    myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ReflectiveViewControllerExecutor.java
    myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewController.java
    myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewControllerPhaseListener.java

Modified: myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/AbstractViewControllerExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/AbstractViewControllerExecutor.java?view=diff&rev=513535&r1=513534&r2=513535
==============================================================================
--- myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/AbstractViewControllerExecutor.java (original)
+++ myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/AbstractViewControllerExecutor.java Thu Mar  1 14:06:56 2007
@@ -36,7 +36,7 @@
 	{
 	}
     
-    public void invokePostApplyRequestValues(Object bean)
+    public void invokePreProcess(Object bean)
     {
         
     }

Modified: myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/InterfaceViewControllerExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/InterfaceViewControllerExecutor.java?view=diff&rev=513535&r1=513534&r2=513535
==============================================================================
--- myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/InterfaceViewControllerExecutor.java (original)
+++ myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/InterfaceViewControllerExecutor.java Thu Mar  1 14:06:56 2007
@@ -44,4 +44,14 @@
 			((ViewController) bean).preRenderView();
 		}
 	}
+
+    public void invokePreProcess(Object bean)
+    {
+        if (bean instanceof ViewController)
+        {
+            ((ViewController) bean).preProcess();
+        }
+    }
+    
+    
 }

Modified: myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ReflectiveViewControllerExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ReflectiveViewControllerExecutor.java?view=diff&rev=513535&r1=513534&r2=513535
==============================================================================
--- myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ReflectiveViewControllerExecutor.java (original)
+++ myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ReflectiveViewControllerExecutor.java Thu Mar  1 14:06:56 2007
@@ -46,11 +46,6 @@
 		invokeOnViewController(bean, "preRenderView");
 	}
 
-	public void invokePostApplyRequestValues(Object bean)
-	{
-		invokeOnViewController(bean, "postApplyRequest");
-	}
-	
 	protected void invokeOnViewController(Object bean, String methodName)
 	{
 		try
@@ -72,4 +67,28 @@
 			throw new FacesException(e);
 		}
 	}
+
+    
+    public void invokePreProcess(Object bean) {
+        try
+        {
+            Method method = bean.getClass().getMethod("preProcess", null); // NON-NLS
+            method.invoke(bean, null);
+        }
+        catch (NoSuchMethodException e)
+        {
+            // no problem
+            // just ignore it
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new FacesException(e);
+        }
+        catch (InvocationTargetException e)
+        {
+            throw new FacesException(e);
+        }
+    }
+    
+    
 }

Modified: myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewController.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewController.java?view=diff&rev=513535&r1=513534&r2=513535
==============================================================================
--- myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewController.java (original)
+++ myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewController.java Thu Mar  1 14:06:56 2007
@@ -31,7 +31,7 @@
 {
 	public void initView();
 
-    public void invokePostApplyRequestValues();
+    public void preProcess();
     
 	public void preRenderView();
 }

Modified: myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewControllerPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewControllerPhaseListener.java?view=diff&rev=513535&r1=513534&r2=513535
==============================================================================
--- myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewControllerPhaseListener.java (original)
+++ myfaces/fusion/trunk/core/src/main/java/org/apache/myfaces/fusion/viewController/ViewControllerPhaseListener.java Thu Mar  1 14:06:56 2007
@@ -46,9 +46,9 @@
 			postRestoreView(event.getFacesContext());
 		}
 
-        if (PhaseId.APPLY_REQUEST_VALUES.equals(event.getPhaseId()))
+        if (PhaseId.UPDATE_MODEL_VALUES.equals(event.getPhaseId()))
         {
-            postApplyRequestValues(event.getFacesContext());
+            postUpdateModelValues(event.getFacesContext());
         }
     }
     
@@ -109,7 +109,7 @@
 		}
 	}
     
-    protected void postApplyRequestValues(FacesContext facesContext) {
+    protected void postUpdateModelValues(FacesContext facesContext) {
         ViewControllerManager manager = _ViewControllerUtils.getViewControllerManager(facesContext);
         if (manager == null)
         {
@@ -125,7 +125,7 @@
         Object viewController = manager.getViewController(facesContext, viewId);
         if (viewController != null)
         {
-            manager.getViewControllerExecutor().invokePostApplyRequestValues(viewController);
+            manager.getViewControllerExecutor().invokePreProcess(viewController);
         }
         
     }