incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r488869 - in /incubator/adffaces/branches/faces-1_2-061214/trinidad: trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/
Date Wed, 20 Dec 2006 00:34:35 GMT
Author: awiner
Date: Tue Dec 19 16:34:34 2006
New Revision: 488869

URL: http://svn.apache.org/viewvc?view=rev&rev=488869
Log:
Support Application.getExpressionFactory in the renderkit test

Added:
    incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/ValueBindingValueExpression.java
Modified:
    incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
    incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java

Modified: incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java?view=diff&rev=488869&r1=488868&r2=488869
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
(original)
+++ incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
Tue Dec 19 16:34:34 2006
@@ -4,6 +4,7 @@
 
 import javax.faces.application.Application;
 import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
 import javax.faces.lifecycle.Lifecycle;
 
 import org.apache.shale.test.mock.MockFacesContext;
@@ -16,11 +17,13 @@
   {
     super(ec, lifecycle);
     elContext = createELContext(application);
+    elContext.putContext(FacesContext.class, this);
   }
 
   public MockFacesContext12(Application application)
   {
     elContext = createELContext(application);
+    elContext.putContext(FacesContext.class, this);
   }
 
   public ELContext getELContext()

Modified: incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java?view=diff&rev=488869&r1=488868&r2=488869
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
(original)
+++ incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
Tue Dec 19 16:34:34 2006
@@ -19,6 +19,12 @@
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
+
+import javax.el.ExpressionFactory;
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
 import javax.faces.FacesException;
 import javax.faces.application.Application;
 import javax.faces.application.NavigationHandler;
@@ -340,6 +346,48 @@
     return new MValueBinding(expression);
   }
 
+ public Object evaluateExpressionGet(FacesContext context, String expression, Class expectedType)

+  {
+      // TODO handle coercion
+    return createValueBinding(expression).getValue(context);
+  }
+
+  public ExpressionFactory getExpressionFactory()
+  {
+    return _exprFactory;
+  }
+
+  private ExpressionFactory _exprFactory = new ExpressionFactory()
+  {
+    public Object coerceToType(Object obj, Class<?> targetType)
+    {
+      return obj;
+    }
+
+    public MethodExpression createMethodExpression(
+      ELContext context,
+      String expression,
+      Class<?> expectedReturnType,
+      Class<?>[] expectedParamTypes) 
+    {
+      throw new UnsupportedOperationException("Not implemented yet");
+    }
+
+    public ValueExpression createValueExpression(
+       ELContext context, String expression, Class<?> expectedType)
+    {
+      // TODO handle coercion
+      ValueBinding vb = MApplication.this.createValueBinding(expression);
+      return new ValueBindingValueExpression(vb);
+    }
+    
+    
+    public ValueExpression createValueExpression(Object instance, Class<?> expectedType)
+    {
+      throw new UnsupportedOperationException("Not implemented yet");
+    }
+  };
+    
   private Map<String, String> _components = new HashMap<String, String>();
   private ViewHandler _viewHandler = new MViewHandler();
   private VariableResolver _variableResolver = new MVariableResolver();

Added: incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/ValueBindingValueExpression.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/ValueBindingValueExpression.java?view=auto&rev=488869
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/ValueBindingValueExpression.java
(added)
+++ incubator/adffaces/branches/faces-1_2-061214/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/ValueBindingValueExpression.java
Tue Dec 19 16:34:34 2006
@@ -0,0 +1,78 @@
+package org.apache.myfaces.trinidadinternal.renderkit;
+
+import java.io.Serializable;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+
+@Deprecated
+class ValueBindingValueExpression
+  extends ValueExpression implements Serializable
+{
+  public ValueBindingValueExpression(ValueBinding binding)
+  {
+    _binding = binding;
+  }
+  
+  public ValueBinding getValueBinding()
+  {
+    return _binding;
+  }
+  
+  public Object getValue(ELContext elContext)
+  {
+    return _binding.getValue(FacesContext.getCurrentInstance());
+  }
+
+  public void setValue(ELContext elContext, Object object)
+  {
+    _binding.setValue(FacesContext.getCurrentInstance(), object);
+  }
+
+  public boolean isReadOnly(ELContext elContext)
+  {
+    return _binding.isReadOnly(FacesContext.getCurrentInstance());
+  }
+
+  public Class<?> getType(ELContext elContext)
+  {
+    return _binding.getType(FacesContext.getCurrentInstance());
+  }
+
+  public Class<?> getExpectedType()
+  {
+    return null;
+  }
+
+  public String getExpressionString()
+  {
+    return _binding.getExpressionString();
+  }
+
+  public boolean isLiteralText()
+  {
+    return false;
+  }
+
+  public boolean equals(Object o)
+  {
+    if (o == this)
+      return true;
+    if (!(o instanceof ValueBindingValueExpression))
+      return false;
+      
+    ValueBindingValueExpression that = (ValueBindingValueExpression) o;
+    return that._binding.equals(_binding);
+  }
+
+  public int hashCode()
+  {
+    return _binding.hashCode();
+  }
+
+  private final ValueBinding _binding;
+}



Mime
View raw message