[seam-commits] Seam SVN: r12153 - in modules/faces/trunk: src/main/java/org/jboss/seam/faces and 8 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Mar 9 18:01:20 EST 2010


Author: lincolnthree
Date: 2010-03-09 18:01:19 -0500 (Tue, 09 Mar 2010)
New Revision: 12153

Added:
   modules/faces/trunk/seam-faces.iml
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
Removed:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesMessages.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/resources/
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/el/
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/international/
Modified:
   modules/faces/trunk/
   modules/faces/trunk/pom.xml
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/FacesManagedCookie.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamApplication.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesProcessor.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/EnforceViewRestrictionsProcessor.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ManagedSeamPhaseListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java
   modules/faces/trunk/src/main/resources/META-INF/seam-faces.taglib.xml
Log:
* Hacked to compile. Can begin restoring old and building new functionality.
* Added UIViewAction


Property changes on: modules/faces/trunk
___________________________________________________________________
Name: svn:ignore
   - .classpath
.project
.settings
attic
nb-configuration.xml
target
temp-testng-customsuite.xml
test-output

   + .classpath
.project
.settings
attic
nb-configuration.xml
target
temp-testng-customsuite.xml
test-output
.pom.xml.swp


Modified: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/pom.xml	2010-03-09 23:01:19 UTC (rev 12153)
@@ -32,55 +32,13 @@
 
    <dependencies>
 
-      <dependency>
-         <groupId>javax.el</groupId>
-         <artifactId>el-api</artifactId>
-         <scope>provided</scope>
-      </dependency>
+        <dependency>
+            <groupId>javax</groupId>
+            <artifactId>javaee-web-api</artifactId>
+            <version>6.0</version>
+            <scope>provided</scope>
+        </dependency>
 
-      <dependency>
-         <groupId>javax.faces</groupId>
-         <artifactId>jsf-api</artifactId>
-         <scope>provided</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>javax.servlet</groupId>
-         <artifactId>servlet-api</artifactId>
-         <scope>provided</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>javax.transaction</groupId>
-         <artifactId>jta</artifactId>
-         <scope>provided</scope>
-      </dependency>
-
-      <!-- doesn't inherit from seam-international because scope is provided -->
-      <dependency>
-         <groupId>javax.validation</groupId>
-         <artifactId>validation-api</artifactId>
-         <scope>provided</scope>
-      </dependency>
-
-<!--      <dependency>-->
-<!--         <groupId>org.jboss.seam</groupId>-->
-<!--         <artifactId>seam-international</artifactId>-->
-<!--      </dependency>-->
-
-      <!-- QUESTION do we want this dependency? -->
-      <dependency>
-         <groupId>org.jboss.seam</groupId>
-         <artifactId>seam-security</artifactId>
-         <optional>true</optional>
-      </dependency>
-
-      <dependency>
-         <groupId>javax.enterprise</groupId>
-         <artifactId>cdi-api</artifactId>
-         <scope>provided</scope>
-      </dependency>         
-
    </dependencies>
    
    

Added: modules/faces/trunk/seam-faces.iml
===================================================================
--- modules/faces/trunk/seam-faces.iml	                        (rev 0)
+++ modules/faces/trunk/seam-faces.iml	2010-03-09 23:01:19 UTC (rev 12153)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" scope="PROVIDED" name="Maven: javax:javaee-web-api:6.0" level="project" />
+  </component>
+</module>
+

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/FacesManagedCookie.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/FacesManagedCookie.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/FacesManagedCookie.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -4,58 +4,57 @@
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
 
-import org.jboss.seam.web.ManagedCookie;
 
 /**
  * Selector implementation for JSF environments
  * 
  * @author Shane Bryzak
  */
-public class FacesManagedCookie extends ManagedCookie
+public class FacesManagedCookie //extends ManagedCookie
 {
    private static final long serialVersionUID = 7212365784926629129L;
 
-   @Override
-   public void clearCookieValue()
-   {
-      Cookie cookie = getCookie();
-      if ( cookie!=null )
-      {
-         HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();         
-         cookie.setValue(null);
-         cookie.setPath(getCookiePath());
-         cookie.setMaxAge(0);
-         response.addCookie(cookie);
-      }      
-   }
-
-   @Override
-   public Cookie getCookie()
-   {
-      FacesContext ctx = FacesContext.getCurrentInstance();
-      if (ctx != null)
-      {
-          return (Cookie) ctx.getExternalContext().getRequestCookieMap()
-            .get( getCookieName() );
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   @Override
-   public void setCookieValueIfEnabled(String value)
-   {
-      FacesContext ctx = FacesContext.getCurrentInstance();
-      
-      if ( isCookieEnabled() && ctx != null)
-      {
-         HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
-         Cookie cookie = new Cookie( getCookieName(), value );
-         cookie.setMaxAge( getCookieMaxAge() );
-         cookie.setPath(getCookiePath());
-         response.addCookie(cookie);
-      }
-   }
+//   @Override
+//   public void clearCookieValue()
+//   {
+//      Cookie cookie = getCookie();
+//      if ( cookie!=null )
+//      {
+//         HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
+//         cookie.setValue(null);
+//         cookie.setPath(getCookiePath());
+//         cookie.setMaxAge(0);
+//         response.addCookie(cookie);
+//      }
+//   }
+//
+//   @Override
+//   public Cookie getCookie()
+//   {
+//      FacesContext ctx = FacesContext.getCurrentInstance();
+//      if (ctx != null)
+//      {
+//          return (Cookie) ctx.getExternalContext().getRequestCookieMap()
+//            .get( getCookieName() );
+//      }
+//      else
+//      {
+//         return null;
+//      }
+//   }
+//
+//   @Override
+//   public void setCookieValueIfEnabled(String value)
+//   {
+//      FacesContext ctx = FacesContext.getCurrentInstance();
+//
+//      if ( isCookieEnabled() && ctx != null)
+//      {
+//         HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
+//         Cookie cookie = new Cookie( getCookieName(), value );
+//         cookie.setMaxAge( getCookieMaxAge() );
+//         cookie.setPath(getCookiePath());
+//         response.addCookie(cookie);
+//      }
+//   }
 }

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamApplication.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamApplication.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamApplication.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -26,7 +26,6 @@
 import javax.el.ExpressionFactory;
 import javax.faces.application.Application;
 import javax.faces.application.ApplicationWrapper;
-import org.jboss.seam.el.SeamExpressionFactory;
 
 /**
  * Proxies the JSF Application object, and adds all kinds
@@ -48,10 +47,10 @@
 		return delegate;
 	}
 
-	@Override
-	public ExpressionFactory getExpressionFactory() {
-      // TODO need to push SeamFacesELResolver into SeamEL composite resolver
-		return SeamExpressionFactory.INSTANCE;
-	}
+//	@Override
+//	public ExpressionFactory getExpressionFactory() {
+//      // TODO need to push SeamFacesELResolver into SeamEL composite resolver
+//		return SeamExpressionFactory.INSTANCE;
+//	}
 
 }

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -7,8 +7,6 @@
 import javax.faces.application.ViewHandlerWrapper;
 import javax.faces.context.FacesContext;
 
-import org.jboss.seam.beans.BeanManagerHelper;
-import org.jboss.seam.bridge.ManagerBridge;
 import org.jboss.seam.faces.lifecycle.ConvertStatusMessagesProcessor;
 
 /**
@@ -47,8 +45,8 @@
       if (context.getExternalContext().getSession(false) != null)
       {
          // QUESTION hmmm, we have to convert to faces messages now to leverage JSF's flash feature...I suppose that is okay
-         BeanManagerHelper.getInstanceByType(ManagerBridge.getProvider().getCurrentManager(), 
-                 ConvertStatusMessagesProcessor.class).execute();
+//         BeanManagerHelper.getInstanceByType(ManagerBridge.getProvider().getCurrentManager(), 
+//                 ConvertStatusMessagesProcessor.class).execute();
          // should I move this next step into TransferStatusMessagesListener?
          if (context.getMessages().hasNext())
          {

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -0,0 +1,296 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.jboss.seam.faces.component;
+ 
+import java.io.Serializable;
+ 
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+ 
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.ELException;
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+ 
+import java.util.Arrays;
+import java.lang.reflect.Method;
+ 
+/**
+ * <p>Wrap a MethodExpression instance and expose it as a MethodBinding</p>
+ *
+ */
+class MethodBindingMethodExpressionAdapter extends MethodBinding implements StateHolder,
+        Serializable {
+ 
+   private static final long serialVersionUID = 7334926223014401689L;
+   private MethodExpression methodExpression = null;
+   private boolean tranzient;
+ 
+   public MethodBindingMethodExpressionAdapter() {
+   } // for StateHolder
+ 
+   MethodBindingMethodExpressionAdapter(MethodExpression methodExpression) {
+      this.methodExpression = methodExpression;
+   }
+ 
+   @Override
+   public Object invoke(FacesContext context, Object params[])
+           throws javax.faces.el.EvaluationException, javax.faces.el.MethodNotFoundException {
+      assert (null != methodExpression);
+      if (context == null) {
+         throw new NullPointerException("FacesConext -> null");
+      }
+ 
+      Object result = null;
+      try {
+         result = methodExpression.invoke(context.getELContext(),
+                 params);
+      } catch (javax.el.MethodNotFoundException e) {
+         throw new javax.faces.el.MethodNotFoundException(e);
+      } catch (javax.el.PropertyNotFoundException e) {
+         throw new EvaluationException(e);
+      } catch (ELException e) {
+         Throwable cause = e.getCause();
+         if (cause == null) {
+            cause = e;
+         }
+         throw new EvaluationException(cause);
+      } catch (NullPointerException e) {
+         throw new javax.faces.el.MethodNotFoundException(e);
+      }
+      return result;
+   }
+ 
+   @Override
+   public Class getType(FacesContext context) throws javax.faces.el.MethodNotFoundException {
+      assert (null != methodExpression);
+      if (context == null) {
+         throw new NullPointerException("FacesConext -> null");
+      }
+      Class result = null;
+      if (context == null) {
+         throw new NullPointerException();
+      }
+ 
+      try {
+         MethodInfo mi =
+                 methodExpression.getMethodInfo(context.getELContext());
+         result = mi.getReturnType();
+      } catch (javax.el.PropertyNotFoundException e) {
+         throw new javax.faces.el.MethodNotFoundException(e);
+      } catch (javax.el.MethodNotFoundException e) {
+         throw new javax.faces.el.MethodNotFoundException(e);
+      } catch (ELException e) {
+         throw new javax.faces.el.MethodNotFoundException(e);
+      }
+      return result;
+   }
+ 
+   @Override
+   public String getExpressionString() {
+      assert (null != methodExpression);
+      return methodExpression.getExpressionString();
+   }
+ 
+   @Override
+   public boolean equals(Object other) {
+      if (this == other) {
+         return true;
+      }
+      if (other instanceof MethodBindingMethodExpressionAdapter) {
+         return methodExpression.equals(((MethodBindingMethodExpressionAdapter) other).getWrapped());
+      } else if (other instanceof MethodBinding) {
+         MethodBinding binding = (MethodBinding) other;
+ 
+         // We'll need to do a little leg work to determine
+         // if the MethodBinding is equivalent to the
+         // wrapped MethodExpression
+         String expr = binding.getExpressionString();
+         int idx = expr.indexOf('.');
+         String target = expr.substring(0, idx).substring(2);
+         String t = expr.substring(idx + 1);
+         String method = t.substring(0, (t.length() - 1));
+ 
+         FacesContext context = FacesContext.getCurrentInstance();
+         ELContext elContext = context.getELContext();
+         MethodInfo controlInfo = methodExpression.getMethodInfo(elContext);
+ 
+         // ensure the method names are the same
+         if (!controlInfo.getName().equals(method)) {
+            return false;
+         }
+ 
+         // Using the target, create an expression and evaluate
+         // it.
+         ExpressionFactory factory = context.getApplication().getExpressionFactory();
+         ValueExpression ve = factory.createValueExpression(elContext,
+                 "#{" + target + '}',
+                 Object.class);
+         if (ve == null) {
+            return false;
+         }
+ 
+         Object result = ve.getValue(elContext);
+ 
+         if (result == null) {
+            return false;
+         }
+ 
+         // Get all of the methods with the matching name and try
+         // to find a match based on controlInfo's return and parameter
+         // types
+         Class type = binding.getType(context);
+         Method[] methods = result.getClass().getMethods();
+         for (Method meth : methods) {
+            if (meth.getName().equals(method)
+                    && type.equals(controlInfo.getReturnType())
+                    && Arrays.equals(meth.getParameterTypes(),
+                    controlInfo.getParamTypes())) {
+               return true;
+            }
+         }
+      }
+ 
+      return false;
+ 
+   }
+ 
+   @Override
+   public int hashCode() {
+      assert (null != methodExpression);
+ 
+      return methodExpression.hashCode();
+   }
+ 
+   public boolean isTransient() {
+      return this.tranzient;
+   }
+ 
+   public void setTransient(boolean tranzient) {
+      this.tranzient = tranzient;
+   }
+ 
+   public Object saveState(FacesContext context) {
+      if (context == null) {
+         throw new NullPointerException();
+      }
+      Object result = null;
+      if (!tranzient) {
+         if (methodExpression instanceof StateHolder) {
+            Object[] stateStruct = new Object[2];
+ 
+            // save the actual state of our wrapped methodExpression
+            stateStruct[0] = ((StateHolder) methodExpression).saveState(context);
+            // save the class name of the methodExpression impl
+            stateStruct[1] = methodExpression.getClass().getName();
+ 
+            result = stateStruct;
+         } else {
+            result = methodExpression;
+         }
+      }
+ 
+      return result;
+ 
+   }
+ 
+   public void restoreState(FacesContext context, Object state) {
+      if (context == null) {
+         throw new NullPointerException();
+      }
+      // if we have state
+      if (null == state) {
+         return;
+      }
+ 
+      if (!(state instanceof MethodExpression)) {
+         Object[] stateStruct = (Object[]) state;
+         Object savedState = stateStruct[0];
+         String className = stateStruct[1].toString();
+         MethodExpression result = null;
+ 
+         Class toRestoreClass = null;
+         if (null != className) {
+            try {
+               toRestoreClass = loadClass(className, this);
+            } catch (ClassNotFoundException e) {
+               throw new IllegalStateException(e.getMessage());
+            }
+ 
+            if (null != toRestoreClass) {
+               try {
+                  result =
+                          (MethodExpression) toRestoreClass.newInstance();
+               } catch (InstantiationException e) {
+                  throw new IllegalStateException(e.getMessage());
+               } catch (IllegalAccessException a) {
+                  throw new IllegalStateException(a.getMessage());
+               }
+            }
+ 
+            if (null != result && null != savedState) {
+               // don't need to check transient, since that was
+               // done on the saving side.
+               ((StateHolder) result).restoreState(context, savedState);
+            }
+            methodExpression = result;
+         }
+      } else {
+         methodExpression = (MethodExpression) state;
+      }
+   }
+ 
+   public MethodExpression getWrapped() {
+      return methodExpression;
+   }
+ 
+   //
+   // Helper methods for StateHolder
+   //
+   private static Class loadClass(String name,
+           Object fallbackClass) throws ClassNotFoundException {
+      ClassLoader loader =
+              Thread.currentThread().getContextClassLoader();
+      if (loader == null) {
+         loader = fallbackClass.getClass().getClassLoader();
+      }
+      return Class.forName(name, true, loader);
+   }
+}
\ No newline at end of file

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -1,106 +1,559 @@
 package org.jboss.seam.faces.component;
 
 import javax.el.MethodExpression;
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.application.NavigationHandler;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
 import javax.faces.component.UIComponentBase;
-
+import javax.faces.component.UIViewParameter;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextWrapper;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.faces.view.ViewMetadata;
+import javax.faces.webapp.FacesServlet;
+ 
 /**
- * TODO add conditional (if attribute)
- * 
- * @author Dan Allen
- */
-public class UIViewAction extends UIComponentBase
-{
-
+* <p><strong>UIViewAction</strong> is an {@link ActionSource2} {@link
+* UIComponent} that specifies an application-specific command (or
+* action)--defined as an EL method expression--to be invoked during one of the
+* JSF lifecycle phases that proceeds view rendering. This component must be
+* declared as a child of the {@link ViewMetadata} facet of the {@link
+* UIViewRoot} so that it gets incorporated into the JSF lifecycle on both
+* non-faces (initial) requests and faces (postback) requests.</p>
+*
+* <p>The purpose of this component is to provide a light-weight
+* front-controller solution for executing code upon the loading of a JSF view
+* to support the integration of system services, content retrieval, view
+* management, and navigation. This functionality is especially useful for
+* non-faces (initial) requests.</p>
+*
+* <p>The {@link UIViewAction} component is closely tied to the {@link
+* UIViewParameter} component. The {@link UIViewParameter} component binds a
+* request parameter to a model property. Most of the time, this binding is used
+* to populate the model with data that supports the method being invoked by a
+* {@link UIViewAction} component, much like form inputs populate the model with
+* data to support the method being invoked by a {@link UICommand}
+* component.</p>
+*
+* <p>When the <literal>decode()</literal> method of the {@link UIViewAction} is
+* invoked, it will queue an {@link ActionEvent} to be broadcast to all
+* interested listeners when the <literal>broadcast()</literal> method is
+* invoked.</p>
+*
+* <p>If the value of the component's <literal>immediate</literal> attribute is
+* <literal>true</literal>, the action will be invoked during the Apply Request
+* Values JSF lifecycle phase. Otherwise, the action will be invoked during the
+* Invoke Application phase, the default behavior. The phase cannot be
+* set explicitly in the <literal>phase</literal> attribute, which takes
+* precedence over the <literal>immediate</literal> attribute.</p>
+*
+* <p>The invocation of the action is normally suppressed (meaning the {@link
+* ActionEvent} is not queued) on a faces request. It can be enabled by setting
+* the component's <literal>onPostback</literal> attribute to <literal>true</literal>.
+* Execution of the method can be subject to a required condition for all requests by
+* assigning an EL value expression of expected type boolean to the component's
+* <literal>if</literal> attribute, which must evaluate to
+* <literal>true</literal> for the action to be invoked.</p>
+*
+* <p>The {@link NavigationHandler} is consulted after the action is invoked to
+* carry out the navigation case that matches the action signature and outcome.
+* If a navigation case is matched, or the response is marked complete by the
+* action, subsequent {@link UIViewAction} components associated with the
+* current view are short-circuited. The lifecycle then advances
+* appropriately.</p>
+*
+* <p>It's important to note that the full component tree is not built before
+* the UIViewAction components are processed on an non-faces (initial) request.
+* Rather, the component tree only contains the {@link ViewMetadata}, an
+* important part of the optimization of this component and what sets it apart
+* from a {@link PreRenderViewEvent} listener.</p>
+*
+* @author Dan Allen
+* @author Andy Schwartz
+*
+* @see UIViewParameter
+*/
+ at FacesComponent(
+   // tagName = "viewAction",
+   // namespace = "http://java.sun.com/jsf/core",
+   // (see https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=594)
+   value = UIViewAction.COMPONENT_TYPE)
+public class UIViewAction extends UIComponentBase implements ActionSource2 {
+ 
    // ------------------------------------------------------ Manifest Constants
-
+ 
    /**
-    * <p>
-    * The standard component type for this component.
-    * </p>
-    */
-   public static final String COMPONENT_TYPE = "org.jboss.seam.faces.ViewAction";
-
+* <p>
+* The standard component type for this component.
+* </p>
+*/
+   public static final String COMPONENT_TYPE = "javax.faces.ViewAction";
+ 
    /**
-    * <p>
-    * The standard component type for this component.
-    * </p>
-    */
-   public static final String COMPONENT_FAMILY = "org.jboss.seam.faces.ViewAction";
-   
+* <p>
+* The standard component family for this component.
+* </p>
+*/
+   public static final String COMPONENT_FAMILY = "javax.faces.ViewAction";
+ 
    /**
-    * Properties that are tracked by state saving.
-    */
+* Properties that are tracked by state saving.
+*/
    enum PropertyKeys
    {
-      onPostback, execute, ifAttr("if");
-
+      onPostback, actionExpression, immediate, phase, ifAttr("if");
+ 
       private String name;
-
+ 
       PropertyKeys()
       {
       }
-
+ 
       PropertyKeys(String name)
       {
          this.name = name;
       }
-
+ 
       @Override
       public String toString()
       {
          return name != null ? name : super.toString();
       }
    }
-   
+ 
    // ------------------------------------------------------------ Constructors
-
+ 
    /**
-    * <p>
-    * Create a new {@link UIViewAction} instance with default property values.
-    * </p>
-    */
+* <p>
+* Create a new {@link UIViewAction} instance with default property values.
+* </p>
+*/
    public UIViewAction()
    {
       super();
       setRendererType(null);
    }
-
+ 
    // -------------------------------------------------------------- Properties
-
+ 
    @Override
    public String getFamily()
    {
       return COMPONENT_FAMILY;
    }
-
-   public MethodExpression getExecute()
+ 
+   /**
+* {@inheritDoc}
+*
+* @deprecated This has been replaced by {@link #getActionExpression}.
+*/
+   public MethodBinding getAction() {
+      MethodBinding result = null;
+      MethodExpression me;
+ 
+      if (null != (me = getActionExpression())) {
+         result = new MethodBindingMethodExpressionAdapter(me);
+      }
+      return result;
+   }
+ 
+   /**
+* {@inheritDoc}
+*
+* @deprecated This has been replaced by {@link #setActionExpression(javax.el.MethodExpression)}.
+* @throws UnsupportedOperationException if called
+*/
+   public void setAction(MethodBinding action) {
+      throw new UnsupportedOperationException("Not supported.");
+   }
+ 
+   /**
+* Action listeners are not supported by the {@link UIViewAction} component.
+*
+* @throws UnsupportedOperationException if called
+*/
+   public MethodBinding getActionListener() {
+      throw new UnsupportedOperationException("Not supported.");
+   }
+ 
+   /**
+* Action listeners are not supported by the {@link UIViewAction} component.
+*
+* @throws UnsupportedOperationException if called
+*/
+   public void setActionListener(MethodBinding actionListener) {
+      throw new UnsupportedOperationException("Not supported.");
+   }
+ 
+   /**
+* Returns the value which dictates the JSF lifecycle phase in which the
+* action is invoked. If the value of this attribute is
+* <literal>true</literal>, the action will be invoked in the Apply Request
+* Values phase. If the value of this attribute is <literal>true</literal>,
+* the default, the action will be invoked in the Invoke Application Phase.
+*/
+   public boolean isImmediate() {
+      return (Boolean) getStateHelper().eval(PropertyKeys.immediate, false);
+   }
+ 
+   /**
+* Sets the immediate flag, which controls the JSF lifecycle in which
+* the action is invoked.
+*/
+   public void setImmediate(boolean immediate) {
+      getStateHelper().put(PropertyKeys.immediate, immediate);
+   }
+ 
+   /**
+* <p>Returns the name of the phase in which the action is to be queued. Only
+* the following phases are supported (case does not matter):</p>
+* <ul>
+* <li>APPLY_REQUEST_VALUES</li>
+* <li>PROCESS_VALIDATIONS</li>
+* <li>UPDATE_MODEL_VALUES</li>
+* <li>INVOKE_APPLICATION</li>
+* </ul>
+* <p>If the phase is set, it takes precedence over the
+* immediate flag.</p>
+*/
+   public String getPhase() {
+      String phase = (String) getStateHelper().eval(PropertyKeys.phase);
+      if (phase != null) {
+         phase = phase.toUpperCase();
+      }
+      return phase;
+   }
+ 
+   /**
+* Set the name of the phase in which the action is to be queued.
+*/
+   public void setPhase(String phase) {
+      getStateHelper().put(PropertyKeys.phase, phase);
+   }
+ 
+   public PhaseId getPhaseId() {
+      String phase = getPhase();
+      if (phase == null) {
+         return null;
+      }
+      if ("APPLY_REQUEST_VALUES".equals(phase)) {
+         return PhaseId.APPLY_REQUEST_VALUES;
+      } else if ("PROCESS_VALIDATIONS".equals(phase)) {
+         return PhaseId.PROCESS_VALIDATIONS;
+      } else if ("UPDATE_MODEL_VALUES".equals(phase)) {
+         return PhaseId.UPDATE_MODEL_VALUES;
+      } else if ("INVOKE_APPLICATION".equals(phase)) {
+         return PhaseId.INVOKE_APPLICATION;
+      } else if ("ANY_PHASE".equals(phase) || "RESTORE_VIEW".equals(phase) || "RENDER_REPONSE".equals(phase)) {
+         throw new FacesException("View actions cannot be executed in specified phase: [" + phase + "]");
+      } else {
+         throw new FacesException("Not a valid phase [" + phase + "]");
+      }
+   }
+ 
+   /**
+* Action listeners are not supported by the {@link UIViewAction} component.
+*
+* @throws UnsupportedOperationException if called
+*/
+   public void addActionListener(ActionListener listener) {
+      throw new UnsupportedOperationException("Not supported.");
+   }
+ 
+   /**
+* Action listeners are not supported by the {@link UIViewAction} component.
+*/
+   public ActionListener[] getActionListeners() {
+      return new ActionListener[0];
+   }
+ 
+   /**
+* Action listeners are not supported by the {@link UIViewAction} component.
+*
+* @throws UnsupportedOperationException if called
+*/
+   public void removeActionListener(ActionListener listener) {
+      throw new UnsupportedOperationException("Not supported.");
+   }
+ 
+   /**
+* Returns the action, represented as an EL method expression, to invoke.
+*/
+   public MethodExpression getActionExpression()
    {
-      return (MethodExpression) getStateHelper().get(PropertyKeys.execute);
+      return (MethodExpression) getStateHelper().get(PropertyKeys.actionExpression);
    }
-   
-   public void setExecute(MethodExpression execute)
+ 
+   /**
+* Sets the action, represented as an EL method expression, to invoke.
+*/
+   public void setActionExpression(MethodExpression actionExpression)
    {
-      getStateHelper().put(PropertyKeys.execute, execute);
+      getStateHelper().put(PropertyKeys.actionExpression, actionExpression);
    }
-
+ 
+   /**
+* Returns a boolean value that controls whether the action is invoked during
+* faces (postback) request.
+*/
    public boolean isOnPostback()
    {
       return (Boolean) getStateHelper().eval(PropertyKeys.onPostback, false);
    }
-
+ 
+   /**
+* Set the bookean flag that controls whether the action is invoked during
+* a faces (postback) request.
+*/
    public void setOnPostback(boolean onPostback)
    {
       getStateHelper().put(PropertyKeys.onPostback, onPostback);
    }
-   
+ 
+   /**
+* Returns a condition, represented as an EL value expression, that must
+* evaluate to true for the action to be invoked.
+*/
    public boolean isIf()
    {
       return (Boolean) getStateHelper().eval(PropertyKeys.ifAttr, true);
    }
-
+ 
+   /**
+* Sets the condition, represented as an EL value expression, that must
+* evaluate to true for the action to be invoked.
+*/
    public void setIf(boolean condition)
    {
       getStateHelper().put(PropertyKeys.ifAttr, condition);
    }
-
+ 
+   // ----------------------------------------------------- UIComponent Methods
+ 
+   /**
+* <p>In addition to to the default {@link UIComponent#broadcast} processing,
+* pass the {@link ActionEvent} being broadcast to the default {@link
+* ActionListener} registered on the {@link
+* javax.faces.application.Application}.</p>
+*
+* @param event {@link FacesEvent} to be broadcast
+*
+* @throws AbortProcessingException Signal the JavaServer Faces
+* implementation that no further processing on the current event
+* should be performed
+* @throws IllegalArgumentException if the implementation class
+* of this {@link FacesEvent} is not supported by this component
+* @throws NullPointerException if <code>event</code> is
+* <code>null</code>
+*/
+   @Override
+   public void broadcast(FacesEvent event) throws AbortProcessingException {
+ 
+      super.broadcast(event);
+ 
+      FacesContext context = getFacesContext();
+      // only proceed if the response has not been marked complete and navigation to another view has not occurred
+      if (event instanceof ActionEvent && !context.getResponseComplete() &&
+            context.getViewRoot() == getViewRootOf(event)) {
+         ActionListener listener = context.getApplication().getActionListener();
+         if (listener != null) {
+            UIViewRoot viewRootBefore = context.getViewRoot();
+            InstrumentedFacesContext instrumentedContext = new InstrumentedFacesContext(context);
+            // defer the call to renderResponse() that happens in ActionListener#processAction(ActionEvent)
+            instrumentedContext.disableRenderResponseControl().set();
+            listener.processAction((ActionEvent) event);
+            instrumentedContext.restore();
+            // if the response is marked complete, the story is over
+            if (!context.getResponseComplete()) {
+               UIViewRoot viewRootAfter = context.getViewRoot();
+               // if the view id changed as a result of navigation, then execute the JSF lifecycle for the new view id
+               if (viewRootBefore != viewRootAfter) {
+                  /*
+// execute the JSF lifecycle by dispatching a forward request
+// this approach is problematic because it throws a wrench in the event broadcasting
+try {
+context.getExternalContext().dispatch(context.getApplication()
+.getViewHandler().getActionURL(context, viewRootAfter.getViewId())
+.substring(context.getExternalContext().getRequestContextPath().length()));
+// kill this lifecycle execution
+context.responseComplete();
+} catch (IOException e) {
+throw new FacesException("Dispatch to viewId failed: " + viewRootAfter.getViewId(), e);
 }
+*/
+ 
+                  // manually execute the JSF lifecycle on the new view id
+                  // certain tweaks have to be made to the FacesContext to allow us to reset the lifecycle
+                  Lifecycle lifecycle = getLifecycle(context);
+                  instrumentedContext = new InstrumentedFacesContext(context);
+                  instrumentedContext.pushViewIntoRequestMap().clearViewRoot().clearPostback().set();
+                  lifecycle.execute(instrumentedContext);
+                  instrumentedContext.restore();
+               }
+               else {
+                  // apply the deferred call (relevant when immediate is true)
+                  context.renderResponse();
+               }
+            }
+         }
+      }
+   }
+ 
+   /**
+* First, determine if the action should be invoked by evaluating this
+* components pre-conditions. If this is a faces (postback) request and the
+* evaluated value of the postback attribute is false, take no action. If the
+* evaluated value of the if attribute is false, take no action. If both
+* conditions pass, proceed with creating an {@link ActionEvent}.
+*
+* Set the phaseId in which the queued {@link ActionEvent} should be
+* broadcast by assigning the appropriate value to the phaseId property of
+* the {@link ActionEvent} according to the evaluated value of the immediate
+* attribute. If the value is <literal>true</literal>, set the phaseId to
+* {@link PhaseId#APPLY_REQUEST_VALUES}. Otherwise, set the phaseId to to
+* {@link PhaseId#INVOKE_APPLICATION}.
+*
+* Finally, queue the event by calling <literal>queueEvent()</literal> and
+* passing the {@link ActionEvent} just created.
+*/
+   @Override
+   public void decode(FacesContext context) {
+      if (context == null) {
+         throw new NullPointerException();
+      }
+ 
+      if ((context.isPostback() && !isOnPostback()) || !isIf()) {
+         return;
+      }
+ 
+      ActionEvent e = new ActionEvent(this);
+      PhaseId phaseId = getPhaseId();
+      if (phaseId != null) {
+         e.setPhaseId(phaseId);
+      }
+      else if (isImmediate()) {
+         e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+      }
+      else {
+         e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+      }
+ 
+      queueEvent(e);
+   }
+ 
+   private UIViewRoot getViewRootOf(FacesEvent e) {
+      UIComponent c = e.getComponent();
+      do {
+         if (c instanceof UIViewRoot) {
+            return (UIViewRoot) c;
+         }
+         c = c.getParent();
+      } while (c != null);
+      return null;
+   }
+ 
+   private Lifecycle getLifecycle(FacesContext context) {
+      LifecycleFactory lifecycleFactory = (LifecycleFactory)
+         FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+      String lifecycleId = context.getExternalContext()
+         .getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
+      if (lifecycleId == null) {
+         lifecycleId = LifecycleFactory.DEFAULT_LIFECYCLE;
+      }
+      return lifecycleFactory.getLifecycle(lifecycleId);
+   }
+ 
+   /**
+* A FacesContext delegator that gives us the necessary controls over the FacesContext
+* to allow the execution of the lifecycle to accomodate the UIViewAction sequence.
+*/
+   private class InstrumentedFacesContext extends FacesContextWrapper {
+      private FacesContext wrapped;
+      private boolean viewRootCleared = false;
+      private boolean renderedResponseControlDisabled = false;
+      private Boolean postback = null;
+      public InstrumentedFacesContext(FacesContext wrapped) {
+         this.wrapped = wrapped;
+      }
+ 
+      @Override
+      public FacesContext getWrapped() {
+         return wrapped;
+      }
+ 
+      @Override
+      public UIViewRoot getViewRoot() {
+         if (viewRootCleared) {
+            return null;
+         }
+ 
+         return wrapped.getViewRoot();
+      }
+ 
+      @Override
+      public void setViewRoot(UIViewRoot viewRoot) {
+         viewRootCleared = false;
+         wrapped.setViewRoot(viewRoot);
+      }
+ 
+      @Override
+      public boolean isPostback() {
+         return postback == null ? wrapped.isPostback() : postback;
+      }
+ 
+      @Override
+      public void renderResponse() {
+         if (!renderedResponseControlDisabled) {
+            wrapped.renderResponse();
+         }
+      }
+ 
+      /**
+* Make it look like we have dispatched a request using the include method.
+*/
+      public InstrumentedFacesContext pushViewIntoRequestMap() {
+         getExternalContext().getRequestMap()
+            .put("javax.servlet.include.servlet_path", wrapped.getViewRoot().getViewId());
+         return this;
+      }
+ 
+      public InstrumentedFacesContext clearPostback() {
+         postback = false;
+         return this;
+      }
+ 
+ 
+      public InstrumentedFacesContext clearViewRoot() {
+         viewRootCleared = true;
+         return this;
+      }
+ 
+      public InstrumentedFacesContext disableRenderResponseControl() {
+         renderedResponseControlDisabled = true;
+         return this;
+      }
+ 
+      public void set() {
+         setCurrentInstance(this);
+      }
+ 
+      public void restore() {
+         setCurrentInstance(wrapped);
+      }
+ 
+   }
+ 
+}
\ No newline at end of file

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -14,7 +14,7 @@
  * <p>QUESTION is it correct to use a @RequestScoped producer? If it is @Dependent, then a developer could unknowingly bind it to a wider-scoped bean</p>
  * 
  * @author Gavin King
- * @author Dan Allen
+ * @author Dan Allen       
  */
 public class FacesContextProducer
 {

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -1,38 +0,0 @@
-//$Id: FacesExpressions.java 9684 2008-12-01 21:41:20Z dan.j.allen $
-package org.jboss.seam.faces.el;
-
-import javax.el.ELContext;
-import javax.inject.Inject;
-import javax.faces.context.FacesContext;
-
-import org.jboss.seam.beans.RuntimeSelected;
-import org.jboss.seam.beans.RuntimeSelectedBean;
-import org.jboss.seam.el.Expressions;
-
-/**
- * Factory for method and value bindings in a JSF environment.
- * 
- * @author Gavin King
- * @author Dan Allen
- */
-public
- at RuntimeSelected
-class FacesExpressions extends Expressions implements RuntimeSelectedBean
-{
-   @Inject FacesContext facesContext;
-   
-   public boolean isActive()
-   {
-      return facesContext != null && facesContext.getCurrentPhaseId() != null;
-   }
-
-   /**
-    * @return the JSF ELContext
-    */
-   @Override
-   public ELContext getELContext()
-   {
-      return facesContext.getELContext();
-   }
-
-}
\ No newline at end of file

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -34,8 +34,6 @@
 import javax.faces.context.FacesContext;
 import javax.faces.model.DataModel;
 
-import org.jboss.seam.bridge.ManagerBridge;
-import org.jboss.seam.el.AbstractELResolver;
 import org.jboss.seam.faces.lifecycle.ImportNamespacesProcessor;
 
 /**
@@ -65,9 +63,8 @@
  * @author Gavin King
  * @author Dan Allen
  */
-public class SeamFacesELResolver extends AbstractELResolver
+public class SeamFacesELResolver
 {
-   @Override
    public Object getValue(ELContext context, Object base, Object property)
    {
       if (base == null)
@@ -83,7 +80,6 @@
       return null;
    }
 
-   @Override
    public boolean isReadOnly(ELContext context, Object base, Object property)
    {
       return (base instanceof DataModel);
@@ -104,19 +100,19 @@
          return null;
       }
       
-      String name = (String) property;
-      BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
-      for (String namespace : (Collection<String>) viewMap.get(ImportNamespacesProcessor.NAMESPACES_CACHE_KEY))
-      {
-         Set<Bean<?>> beans = manager.getBeans(namespace + "." + name);
-         // TODO complain if it is more than one
-         if (beans.size() == 1)
-         {
-            context.setPropertyResolved(true);
-            Bean<?> bean = beans.iterator().next();
-            return manager.getReference(bean, Object.class, manager.createCreationalContext(bean));
-         }
-      }
+//      String name = (String) property;
+//      BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
+//      for (String namespace : (Collection<String>) viewMap.get(ImportNamespacesProcessor.NAMESPACES_CACHE_KEY))
+//      {
+//         Set<Bean<?>> beans = manager.getBeans(namespace + "." + name);
+//         // TODO complain if it is more than one
+//         if (beans.size() == 1)
+//         {
+//            context.setPropertyResolved(true);
+//            Bean<?> bean = beans.iterator().next();
+//            return manager.getReference(bean, Object.class, manager.createCreationalContext(bean));
+//         }
+//      }
       
       return null;
    }

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -5,9 +5,6 @@
 import javax.inject.Inject;
 import javax.faces.context.FacesContext;
 
-import org.jboss.seam.beans.RuntimeSelected;
-import org.jboss.seam.beans.RuntimeSelectedBean;
-import org.jboss.seam.international.LocaleResolver;
 
 /**
  * A specialized version of the LocaleProducer that returns
@@ -17,9 +14,7 @@
  * 
  * @author Dan Allen
  */
-public
- at RuntimeSelected
-class FacesLocaleResolver extends LocaleResolver implements RuntimeSelectedBean
+public class FacesLocaleResolver // extends LocaleResolver
 {
    @Inject FacesContext facesContext;
    
@@ -28,7 +23,6 @@
       return facesContext != null && facesContext.getCurrentPhaseId() != null;
    }
    
-   @Override
    public Locale getLocale()
    {
       if (facesContext.getViewRoot() != null)

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesMessages.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesMessages.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesMessages.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -1,237 +0,0 @@
-package org.jboss.seam.faces.international;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.inject.Inject;
-
-import org.jboss.seam.faces.Faces;
-import org.jboss.seam.international.StatusMessage;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.international.StatusMessagesDelegate;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
-
-/**
- * <p>
- * A bean which wraps the generic StatusMessages component to provide support
- * for JSF. The StatusMessage objects are translated to JSF FacesMessage objects
- * and registered with the FacesContext by this class prior to view rendering or
- * a servlet redirect.
- * </p>
- * 
- * <p>
- * To access the JSF FacesMessage objects once they have been registered with
- * the FacesContext, you should use the methods getMessageList() and
- * getMessagesList(String), which were added to FacesContext in JSF 2.0.
- * </p>
- * 
- * <p>
- * For instance, to retrieve the list of global messages, you can use the
- * following value expression in your page:
- * </p>
- * 
- * <pre>
- * #{facesContext.getMessageList(null)}
- * </pre>
- * 
- * <p>
- * To retrieve the list of messages for a "client id", you can use this
- * expression:
- * </p>
- * 
- * <pre>
- * #{facesContext.getMessageList('username')}
- * </pre>
- * 
- * <p>
- * These examples rely, of course, on the JBoss EL.
- * </p>
- * 
- * @author Gavin King
- * @author Pete Muir
- * @author Dan Allen
- */
-public
- at Faces
-class FacesMessages extends StatusMessagesDelegate
-{
-   @Logger Log log;
-   
-   private StatusMessages statusMessages;
-
-   public @Inject FacesMessages(StatusMessages statusMessages)
-   {
-      this.statusMessages = statusMessages;
-   }
-
-   @Override
-   public StatusMessages getStatusMessages()
-   {
-      return this.statusMessages;
-   }
-
-   /**
-    * A convenience method to convert a FacesMessage into a StatusMessage and
-    * register it as a global message. It may be that the application receives a
-    * FacesMessage object from some part of the system and needs to join it with
-    * the current set of StatusMessage objects.
-    * 
-    * @param message A populated JSF FacesMessage object
-    */
-   public void add(FacesMessage message)
-   {
-      add(toSeverity(message.getSeverity()), null, null, message.getSummary(), message.getDetail());
-   }
-
-   /**
-    * A convenience method to convert a FacesMessage into a StatusMessage and
-    * register it with a control. It may be that the application receives a
-    * FacesMessage object from some part of the system and needs to join it with
-    * the current set of StatusMessage objects.
-    * 
-    * @param id The client id of the target component
-    * @param message A populated JSF FacesMessage object
-    */
-   public void addToControl(String id, FacesMessage message)
-   {
-      addToControl(id, toSeverity(message.getSeverity()), null, null, message.getSummary(), message.getDetail());
-   }
-   
-   /**
-    * Called by a JSF SystemEventListener listening for the PreRenderViewEvent
-    * to transpose Seam status messages to real JSF messages and register them
-    * with the FacesContext.
-    */
-   @Override
-   public void onBeforeRender()
-   {
-      super.onBeforeRender();
-      FacesContext facesContext = FacesContext.getCurrentInstance();
-      for (StatusMessage statusMessage : getGlobalMessages())
-      {
-         facesContext.addMessage(null, toFacesMessage(statusMessage));
-      }
-      for (Map.Entry<String, List<StatusMessage>> messagesForKey : getKeyedMessages().entrySet())
-      {
-         String clientId = getClientId(messagesForKey.getKey(), facesContext);
-         if (clientId == null)
-         {
-            log.warn("Could not locate control '" + messagesForKey.getKey() + "' when registering JSF message. A global message will be created as a fallback.");
-         }
-         for (StatusMessage statusMessage : messagesForKey.getValue())
-         {
-            facesContext.addMessage(clientId, toFacesMessage(statusMessage));
-         }
-      }
-      clear();
-   }
-
-   /**
-    * Convert a StatusMessage to a FacesMessage
-    */
-   private FacesMessage toFacesMessage(StatusMessage statusMessage)
-   {
-      if (statusMessage.getSummary() != null && statusMessage.getSummary().length() > 0)
-      {
-         return new FacesMessage(toFacesSeverity(statusMessage.getSeverity()), statusMessage.getSummary(), statusMessage.getDetail());
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   /**
-    * Convert a FacesMessage.Severity to a StatusMessage.Severity
-    */
-   private static StatusMessage.Severity toSeverity(FacesMessage.Severity severity)
-   {
-      if (FacesMessage.SEVERITY_ERROR.equals(severity))
-      {
-         return StatusMessage.Severity.ERROR;
-      }
-      else if (FacesMessage.SEVERITY_FATAL.equals(severity))
-      {
-         return StatusMessage.Severity.FATAL;
-      }
-      else if (FacesMessage.SEVERITY_WARN.equals(severity))
-      {
-         return StatusMessage.Severity.WARN;
-      }
-      else
-      {
-         return StatusMessage.Severity.INFO;
-      }
-   }
-   
-   /**
-    * Convert a StatusMessage.Severity to a FacesMessage.Severity
-    */
-   private FacesMessage.Severity toFacesSeverity(StatusMessage.Severity severity)
-   {
-      switch (severity)
-      {
-         case ERROR:
-            return FacesMessage.SEVERITY_ERROR;
-         case FATAL:
-            return FacesMessage.SEVERITY_FATAL;
-         case WARN:
-            return FacesMessage.SEVERITY_WARN;
-         case INFO:
-         default:
-            return FacesMessage.SEVERITY_INFO;
-      }
-   }
-
-   /**
-    * Calculate the JSF client ID from the provided widget ID.
-    * TODO It would be great if this could do suffix maching.
-    */
-   private String getClientId(String targetId, FacesContext facesContext)
-   {
-      if (isAbsoluteClientIdPresent(targetId, facesContext))
-      {
-         return targetId;
-      }
-      else
-      {
-         return getClientId(facesContext.getViewRoot(), targetId, facesContext);
-      }
-   }
-
-   /**
-    * FIXME does not work if element is inside of form with prependId="false"
-    */
-   private boolean isAbsoluteClientIdPresent(String targetId, FacesContext facesContext)
-   {
-      return facesContext.getViewRoot().findComponent(targetId) != null;
-   }
-
-   private String getClientId(UIComponent component, String targetLocalId, FacesContext facesContext)
-   {
-      String currentLocalId = component.getId();
-      if (currentLocalId != null && currentLocalId.equals(targetLocalId))
-      {
-         return component.getClientId(facesContext);
-      }
-      else
-      {
-         Iterator<UIComponent> iter = component.getFacetsAndChildren();
-         while (iter.hasNext())
-         {
-            String clientId = getClientId(iter.next(), targetLocalId, facesContext);
-            if (clientId != null)
-            {
-               return clientId;
-            }
-         }
-         return null;
-      }
-   }
-   
-}

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesProcessor.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesProcessor.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesProcessor.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -1,9 +1,6 @@
 package org.jboss.seam.faces.lifecycle;
 
 import org.jboss.seam.faces.Faces;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
 
 /**
  * <p>
@@ -22,13 +19,13 @@
  */
 public class ConvertStatusMessagesProcessor implements FacesSystemEventProcessor
 {
-   @Logger Log log;
-   
-   @Faces StatusMessages statusMessages;
+//   @Logger Log log;
+//
+//   @Faces StatusMessages statusMessages;
 
    public boolean execute()
    {
-      statusMessages.onBeforeRender();
+//      statusMessages.onBeforeRender();
       return true;
    }
 }

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/EnforceViewRestrictionsProcessor.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/EnforceViewRestrictionsProcessor.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/EnforceViewRestrictionsProcessor.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -12,9 +12,6 @@
 import javax.faces.event.ExceptionQueuedEventContext;
 
 import org.jboss.seam.faces.component.UIRestrictView;
-import org.jboss.seam.security.Identity;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
 
 /**
  * <p>
@@ -40,10 +37,10 @@
  */
 public class EnforceViewRestrictionsProcessor extends AbstractViewMetadataProcesssor
 {
-   @Logger Log log;
+//   @Logger Log log;
 
    @Inject FacesContext facesContext;
-   @Inject Identity identity;
+//   @Inject Identity identity;
 
    @Override
    public boolean execute()
@@ -53,28 +50,28 @@
       // collect first so as not to introduce a hard dependency on Identity if
       // tag is not in use
       Collection<UIRestrictView> restrictions = collectionViewRestrictions(viewRoot);
-      if (restrictions.isEmpty() || !Identity.isSecurityEnabled())
-      {
-         return true;
-      }
+//      if (restrictions.isEmpty() || !Identity.isSecurityEnabled())
+//      {
+//         return true;
+//      }
 
-      if (log.isTraceEnabled())
-      {
-         log.trace("Processing view restrictions before render view");
-      }
+//      if (log.isTraceEnabled())
+//      {
+//         log.trace("Processing view restrictions before render view");
+//      }
 
       try
       {
          for (UIRestrictView restriction : restrictions)
          {
-            if (restriction.getRequire() != null)
-            {
-               identity.checkRestriction(restriction.getRequire());
-            }
-            else
-            {
-               identity.checkPermission(viewRoot.getViewId(), "render");
-            }
+//            if (restriction.getRequire() != null)
+//            {
+//               identity.checkRestriction(restriction.getRequire());
+//            }
+//            else
+//            {
+//               identity.checkPermission(viewRoot.getViewId(), "render");
+//            }
          }
       }
       // FIXME damn this is ugly, but JCDI is wrapping exceptions

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -12,8 +12,6 @@
 import javax.faces.context.FacesContext;
 
 import org.jboss.seam.faces.component.UIViewAction;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
 
 /**
  * <p>
@@ -45,7 +43,7 @@
 {
    public static final String VIEW_PARAMETER_VALIDATION_FAILED_OUTCOME = "org.jboss.seam.ViewParameterValidationFailed";
    
-   @Logger Log log;
+//   @Logger Log log;
    
    @Inject FacesContext facesContext;
 
@@ -54,10 +52,10 @@
    {
       UIViewRoot initialViewRoot = facesContext.getViewRoot();
 
-      if (log.isTraceEnabled())
-      {
-         log.trace("Processing view actions before render view");
-      }
+//      if (log.isTraceEnabled())
+//      {
+//         log.trace("Processing view actions before render view");
+//      }
       
       NavigationHandler navHandler = facesContext.getApplication().getNavigationHandler();
       boolean postback = facesContext.isPostback();
@@ -65,10 +63,10 @@
       // check if any view parameters failed validation and if so, fire the navigation handler
       if (!postback && facesContext.isValidationFailed())
       {
-         if (log.isTraceEnabled())
-         {
-            log.trace("Validation of view parameters failed. Calling navigation handler without executing view actions.");
-         }
+//         if (log.isTraceEnabled())
+//         {
+//            log.trace("Validation of view parameters failed. Calling navigation handler without executing view actions.");
+//         }
          // QUESTION is this a good idea to use a built-in logical outcome?
          navHandler.handleNavigation(facesContext, null, VIEW_PARAMETER_VALIDATION_FAILED_OUTCOME);
          return !facesContext.getResponseComplete() && initialViewRoot.getViewId().equals(facesContext.getViewRoot().getViewId());
@@ -81,14 +79,14 @@
          String outcome = null;
          String fromAction = null;
 
-         MethodExpression execute = action.getExecute();
+         MethodExpression execute = action.getActionExpression();
          // QUESTION shouldn't this be an illegal state otherwise??
          if (execute != null)
          {
-            if (log.isDebugEnabled())
-            {
-               log.debug("Executing view action expression {0}", execute.getExpressionString());
-            }
+//            if (log.isDebugEnabled())
+//            {
+//               log.debug("Executing view action expression {0}", execute.getExpressionString());
+//            }
             try
             {
                Object returnVal = execute.invoke(facesContext.getELContext(), null);
@@ -97,10 +95,10 @@
             }
             catch (ELException e)
             {
-               if (log.isErrorEnabled())
-               {
-                  log.error(e.getMessage(), e);
-               }
+//               if (log.isErrorEnabled())
+//               {
+//                  log.error(e.getMessage(), e);
+//               }
                throw new FacesException(execute.getExpressionString() + ": " + e.getMessage(), e);
             }
          }
@@ -110,10 +108,10 @@
          // short-circuit actions if response has been marked complete
          if (facesContext.getResponseComplete())
          {
-            if (log.isDebugEnabled())
-            {
-               log.debug("Response marked as complete during view action processing. Short-circuiting remaining actions.");
-            }
+//            if (log.isDebugEnabled())
+//            {
+//               log.debug("Response marked as complete during view action processing. Short-circuiting remaining actions.");
+//            }
             // FIXME this is lame; there should be some other way to stop view rendering
             facesContext.getViewRoot().setRendered(false);
             proceed = false;
@@ -122,10 +120,10 @@
          // short-circuit actions if a navigation case was pursued
          else if (!initialViewRoot.getViewId().equals(facesContext.getViewRoot().getViewId()))
          {
-            if (log.isDebugEnabled())
-            {
-               log.debug("Detected change in view ID during view action processing. Short-circuiting remaining actions.");
-            }
+//            if (log.isDebugEnabled())
+//            {
+//               log.debug("Detected change in view ID during view action processing. Short-circuiting remaining actions.");
+//            }
             proceed = false;
             break;
          }

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ManagedSeamPhaseListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ManagedSeamPhaseListener.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/ManagedSeamPhaseListener.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -1,8 +1,7 @@
 package org.jboss.seam.faces.lifecycle;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.util.AnnotationLiteral;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -4,9 +4,6 @@
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
 
-import org.jboss.seam.beans.BeanManagerHelper;
-import org.jboss.seam.bridge.ManagerBridge;
-
 /**
  * A JSF <strong>PhaseListener</strong> implementation that hooks Seam into the
  * JSF life cycle. This class observes all JSF phases and merely delegates to
@@ -18,12 +15,12 @@
 {
    public void beforePhase(PhaseEvent event)
    {
-      getDelegate().beforePhase(event);
+//      getDelegate().beforePhase(event);
    }
    
    public void afterPhase(PhaseEvent event)
    {
-      getDelegate().afterPhase(event);
+//      getDelegate().afterPhase(event);
    }
    
    public PhaseId getPhaseId()
@@ -31,9 +28,9 @@
       return PhaseId.ANY_PHASE;
    }
 
-   protected ManagedSeamPhaseListener getDelegate()
-   {
-      return BeanManagerHelper.getInstanceByType(ManagerBridge.getProvider().getCurrentManager(),ManagedSeamPhaseListener.class);
-   }
+//   protected ManagedSeamPhaseListener getDelegate()
+//   {
+//      return BeanManagerHelper.getInstanceByType(ManagerBridge.getProvider().getCurrentManager(),ManagedSeamPhaseListener.class);
+//   }
 
 }

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java	2010-03-09 23:01:19 UTC (rev 12153)
@@ -9,9 +9,6 @@
 import javax.faces.event.SystemEvent;
 import javax.faces.event.SystemEventListener;
 
-import org.jboss.seam.beans.BeanManagerHelper;
-import org.jboss.seam.bridge.ManagerBridge;
-
 /**
  * <p>
  * A JSF {@link SystemEventListener} that observes the PreRenderViewEvent, which
@@ -45,15 +42,15 @@
 
    public void processEvent(SystemEvent event) throws AbortProcessingException
    {
-      BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
-      for (Class<? extends FacesSystemEventProcessor> processorType : processorTypes)
-      {
-         boolean result = BeanManagerHelper.getInstanceByType(manager, processorType).execute();
-         if (!result)
-         {
-            break;
-         }
-      }
+//      BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
+//      for (Class<? extends FacesSystemEventProcessor> processorType : processorTypes)
+//      {
+//         boolean result = BeanManagerHelper.getInstanceByType(manager, processorType).execute();
+//         if (!result)
+//         {
+//            break;
+//         }
+//      }
    }
 
 }

Modified: modules/faces/trunk/src/main/resources/META-INF/seam-faces.taglib.xml
===================================================================
--- modules/faces/trunk/src/main/resources/META-INF/seam-faces.taglib.xml	2010-03-09 20:01:23 UTC (rev 12152)
+++ modules/faces/trunk/src/main/resources/META-INF/seam-faces.taglib.xml	2010-03-09 23:01:19 UTC (rev 12153)
@@ -23,7 +23,6 @@
       <tag-name>viewAction</tag-name>
       <component>
          <component-type>org.jboss.seam.faces.ViewAction</component-type>
-         <handler-class>org.jboss.seam.faces.facelets.ActionSourceHandler</handler-class>
       </component>
    </tag>
 



More information about the seam-commits mailing list