myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r563680 [8/42] - in /myfaces/trinidad/branches/1.2.2-branch: plugins/ plugins/maven-faces-plugin/ plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/ plugins/maven-faces-plugin/src/main/java/org/apache/my...
Date Tue, 07 Aug 2007 22:18:42 GMT
Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuNode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuNode.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuNode.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuNode.java Tue Aug  7 15:18:22 2007
@@ -742,7 +742,7 @@
   {
    String keystr = 
      str.trim().replaceFirst(_bundleKey, _bundleKey + getHandlerId());
-   String elVal = (String) MenuUtils.getBoundValue(keystr);
+   String elVal = MenuUtils.getBoundValue(keystr, String.class);
    return elVal;       
   }
   

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java Tue Aug  7 15:18:22 2007
@@ -30,8 +30,6 @@
 import java.util.Set;
 
 import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
 import javax.faces.webapp.UIComponentTag;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -46,7 +44,7 @@
   MenuUtils() {}
 
   //=======================================================================
-  // Bound Value/EL Binding utilities
+  // Bound Value/EL Expression utilities
   //=======================================================================
   
   /**
@@ -54,18 +52,17 @@
    * 
    * @param elExpression - String representing an EL expression
    */
-  static Object getBoundValue(String elExpression)
+  static <T> T getBoundValue(String elExpression, Class<T> desiredClass)
   {
-    Object retVal = null;
-    
     try
     {
-      // Value of rendered is EL method binding, so we 
-      // need to evaluate it
-      FacesContext ctx     = FacesContext.getCurrentInstance();
-      ValueBinding binding = 
-                        ctx.getApplication().createValueBinding(elExpression);
-      retVal               = binding.getValue(ctx);
+      if (desiredClass == null)
+        throw new NullPointerException();
+
+      FacesContext ctx = FacesContext.getCurrentInstance();
+      return (T) ctx.getApplication().evaluateExpressionGet(ctx,
+                                                            elExpression,
+                                                            desiredClass);
     }
     catch (Exception ex)
     {
@@ -74,7 +71,6 @@
       _LOG.severe(ex);
       return null;
     }
-    return retVal;
   }
   
   /**
@@ -99,7 +95,7 @@
         && UIComponentTag.isValueReference(boolStr)
        )
     {
-      Boolean bValue = (Boolean) getBoundValue(boolStr);
+      Boolean bValue = getBoundValue(boolStr, Boolean.class);
       return bValue.booleanValue();
     }
     else
@@ -123,7 +119,7 @@
         && UIComponentTag.isValueReference(propVal)
        )
     {
-      String elVal = (String) getBoundValue(propVal);
+      String elVal = getBoundValue(propVal, String.class);
       return elVal;
     }
     return propVal;
@@ -141,7 +137,7 @@
         && UIComponentTag.isValueReference(propVal)
        )
     {
-      Integer elVal = (Integer) getBoundValue(propVal);
+      Integer elVal = getBoundValue(propVal, Integer.class);
       return elVal.intValue();
     }
     return Integer.parseInt(propVal);
@@ -205,7 +201,7 @@
       // if _bundleName is an EL, then get its value
       if (UIComponentTag.isValueReference(resBundle)) 
       {
-        bundleName = (String)MenuUtils.getBoundValue(resBundle);
+        bundleName = MenuUtils.getBoundValue(resBundle, String.class);
       } 
       else
       {

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java Tue Aug  7 15:18:22 2007
@@ -69,7 +69,10 @@
     ResponseWriter rw = context.getResponseWriter();
     rw.startElement("input", null);
     rw.writeAttribute("type", "hidden", null);
-    rw.writeAttribute("name", _STATE_FIELD_NAME, null);
+    rw.writeAttribute("name", VIEW_STATE_PARAM, null);
+    // Don't write out the ID, as it can be written
+    // out twice
+    //    rw.writeAttribute("id", VIEW_STATE_PARAM, null);
 
     String s = encodeSerializedViewAsString(serializedView);
     rw.writeAttribute("value", s, null);
@@ -77,6 +80,16 @@
     rw.endElement("input");
   }
 
+  @Override
+  /**
+   * A request is a postback if it contains the state parameter.
+   */
+  public boolean isPostback(FacesContext context)
+  {
+    Map requestParams = context.getExternalContext().getRequestParameterMap();
+    return requestParams.containsKey(VIEW_STATE_PARAM);
+  }
+
 
   protected String encodeSerializedViewAsString(
     StateManager.SerializedView serializedView) throws IOException
@@ -146,7 +159,7 @@
       Map<String, String> requestParamMap =
          context.getExternalContext().getRequestParameterMap();
 
-      String stateString = requestParamMap.get(_STATE_FIELD_NAME);
+      String stateString = requestParamMap.get(VIEW_STATE_PARAM);
       if (stateString == null)
         return null;
 
@@ -196,8 +209,6 @@
 
     return view;
   }
-
-  static private final String _STATE_FIELD_NAME = "org.apache.myfaces.trinidad.faces.STATE";
 
 
   /* Test code for dumping out the page's state

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/EditableValueRenderer.java Tue Aug  7 15:18:22 2007
@@ -22,12 +22,13 @@
 
 import java.util.Iterator;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
-import javax.faces.el.ValueBinding;
 import javax.faces.validator.Validator;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -237,15 +238,15 @@
     if (Boolean.TRUE.equals(o))
       return true;
 
-    // Now, if the ValueBinding underlying the value says it's
+    // Now, if the ValueExpression underlying the value says it's
     // read-only, then again, it is.
-    ValueBinding vb = getValueBinding(bean);
-    if ((vb != null) && vb.isReadOnly(context))
+    ValueExpression ve = getValueExpression(bean);
+    if ((ve != null) && ve.isReadOnly(context.getELContext()))
     {
       if (_LOG.isFiner())
       {
         _LOG.finer("Value expression {0} is read-only",
-                   vb.getExpressionString());
+                   ve.getExpressionString());
       }
 
       return true;

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java Tue Aug  7 15:18:22 2007
@@ -77,7 +77,7 @@
   {
     FacesBean bean = getFacesBean(component);
     // If there's a non-default action, then just launch away
-    if (getAction(bean) != null)
+    if (getActionExpression(bean) != null)
     {
       super.queueActionEvent(context, component);
     }
@@ -293,7 +293,7 @@
     // If the field has an action, use the default behavior.  Or,
     // if the field doesn't support launching a window at all,
     // use the default behavior.
-    if ((getAction(bean) != null) ||
+    if ((getActionExpression(bean) != null) ||
         !Boolean.TRUE.equals(
             arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_MULTIPLE_WINDOWS)))
       return super.getLaunchOnclick(context, arc, component, bean);

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java Tue Aug  7 15:18:22 2007
@@ -78,7 +78,7 @@
   {
     FacesBean bean = getFacesBean(component);
     // If there's a non-default action, then just launch away
-    if (getAction(bean) != null)
+    if (getActionExpression(bean) != null)
     {
       super.queueActionEvent(context, component);
     }
@@ -348,7 +348,7 @@
     // If the field has an action, use the default behavior.  Or,
     // if the field doesn't support launching a window at all,
     // use the default behavior.
-    if ((getAction(bean) != null) ||
+    if ((getActionExpression(bean) != null) ||
         !Boolean.TRUE.equals(
             arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_MULTIPLE_WINDOWS)))
       return super.getLaunchOnclick(context, arc, component, bean);

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputListOfValuesRenderer.java Tue Aug  7 15:18:22 2007
@@ -63,7 +63,7 @@
     super.findTypeConstants(type);
     _searchDescKey = type.findKey("searchDesc");
     _iconKey = type.findKey("icon");
-    _actionKey = type.findKey("action");
+    _actionExpressionKey = type.findKey("actionExpression");
   }
 
   //
@@ -360,9 +360,9 @@
     return true;
   }
 
-  protected Object getAction(FacesBean bean)
+  protected Object getActionExpression(FacesBean bean)
   {
-    return bean.getProperty(_actionKey);
+    return bean.getProperty(_actionExpressionKey);
   }
 
   protected String getSearchDesc(
@@ -395,7 +395,7 @@
     return "af|inputListOfValues::content";
   }
 
-  private PropertyKey _actionKey;
+  private PropertyKey _actionExpressionKey;
   private PropertyKey _iconKey;
   private PropertyKey _searchDescKey;
 

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java Tue Aug  7 15:18:22 2007
@@ -26,14 +26,14 @@
 import java.util.Arrays;
 import java.util.List;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 
-import javax.faces.el.ValueBinding;
-
 import javax.faces.model.SelectItem;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -95,10 +95,10 @@
       converter = getDefaultConverter(context, bean);
 
     Class<?> modelClass = null;
-    ValueBinding binding = getValueBinding(bean);
-    if (binding != null)
+    ValueExpression expression = getValueExpression(bean);
+    if (expression != null)
     {
-      modelClass = binding.getType(context);
+      modelClass = expression.getType(context.getELContext());
     }
 
     boolean valuePassThru = getValuePassThru(getFacesBean(component));
@@ -151,11 +151,11 @@
     FacesContext context,
     FacesBean    bean)
   {
-    ValueBinding binding = getValueBinding(bean);
-    if (binding == null)
+    ValueExpression expression = getValueExpression(bean);
+    if (expression == null)
       return null;
 
-    Class<?> type = binding.getType(context);
+    Class<?> type = expression.getType(context.getELContext());
     if ((type == null) || type.isAssignableFrom(List.class))
       return null;
 

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ValueRenderer.java Tue Aug  7 15:18:22 2007
@@ -18,10 +18,11 @@
  */
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
@@ -70,11 +71,11 @@
     FacesContext context,
     FacesBean    bean)
   {
-    ValueBinding binding = getValueBinding(bean);
-    if (binding == null)
+    ValueExpression expression = getValueExpression(bean);
+    if (expression == null)
       return null;
 
-    Class<?> type = binding.getType(context);
+    Class<?> type = expression.getType(context.getELContext());
     return ConverterUtils.createConverter(context, type);
   }
 
@@ -84,11 +85,11 @@
   }
 
   /**
-   * Returns the ValueBinding for the "value" property.
+   * Returns the ValueExpression for the "value" property.
    */
-  protected ValueBinding getValueBinding(FacesBean bean)
+  protected ValueExpression getValueExpression(FacesBean bean)
   {
-    return bean.getValueBinding(_valueKey);
+    return bean.getValueExpression(_valueKey);
   }
 
   protected Converter getConverter(FacesBean bean)

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java Tue Aug  7 15:18:22 2007
@@ -239,6 +239,13 @@
     }
 
     @Override
+    protected String getClientId(FacesContext context, UIComponent component)
+    {
+      // We use the table's container client ID
+      return component.getContainerClientId(context);
+    }
+
+    @Override
     protected Object getSubmittedValue(FacesBean bean)
     {
       TableRenderingContext tContext =

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeNodeColumnRenderer.java Tue Aug  7 15:18:22 2007
@@ -138,7 +138,7 @@
   {
     // we need to render a unique ID for the expand/collapse link, so that
     // PPR can restore the focus correctly after a PPR request:
-    String tableName = tContext.getTable().getClientId(fc);
+    String tableName = tContext.getTable().getContainerClientId(fc);
     String id = tableName + NamingContainer.SEPARATOR_CHAR + _ICON_ID; 
     fc.getResponseWriter().writeAttribute("id", id, null);
   }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/ComponentFacesBean.java Tue Aug  7 15:18:22 2007
@@ -21,6 +21,8 @@
 import java.util.Iterator;
 import java.util.Set;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
@@ -68,9 +70,20 @@
     throw new UnsupportedOperationException();
   }
 
+
   final public ValueBinding getValueBinding(PropertyKey key)
   {
     return _component.getValueBinding(key.getName());
+  }
+
+  final public ValueExpression getValueExpression(PropertyKey key)
+  {
+    return _component.getValueExpression(key.getName());
+  }
+
+  final public void setValueExpression(PropertyKey key, ValueExpression expression)
+  {
+    throw new UnsupportedOperationException();
   }
 
   final public Object getRawProperty(PropertyKey key)

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/SelectItemSupport.java Tue Aug  7 15:18:22 2007
@@ -25,13 +25,14 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectItem;
 import javax.faces.component.UISelectItems;
 import javax.faces.component.ValueHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
 import javax.faces.model.SelectItem;
 import org.apache.myfaces.trinidad.component.UIXSelectItem;
 import org.apache.myfaces.trinidadinternal.convert.ConverterUtils;
@@ -373,13 +374,13 @@
     Converter converter = null;
     Class<?> modelClass = null;
     
-    ValueBinding binding = component.getValueBinding("value");
-    if (binding != null)
+    ValueExpression expression = component.getValueExpression("value");
+    if (expression != null)
     {
-      modelClass = binding.getType(fContext);
+      modelClass = expression.getType(fContext.getELContext());
       if (modelClass == null)
       {
-        Object o = binding.getValue(fContext);
+        Object o = expression.getValue(fContext.getELContext());
         if (o != null)
         {
           modelClass = o.getClass();

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java Tue Aug  7 15:18:22 2007
@@ -180,6 +180,11 @@
       {
         return text;
       }
+      else if (Enum.class.isAssignableFrom(type))
+      {
+        return Enum.valueOf((Class<? extends Enum>) type, text);
+      }
+
       throw new IllegalArgumentException(_LOG.getMessage(
         "CANNOT_BE_PARSED", new Object[]{text, type.getName()}));
     }
@@ -275,6 +280,10 @@
           Array.set(res, 0, arrayValue);
         }
         return res;
+      }
+      else if (Enum.class.isAssignableFrom(type))
+      {
+        return Enum.valueOf((Class<? extends Enum>) type, value.toString());
       }
 
       throw new IllegalArgumentException(_LOG.getMessage(

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java Tue Aug  7 15:18:22 2007
@@ -20,6 +20,7 @@
 
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidad.context.LocaleContext;
+import org.apache.myfaces.trinidad.skin.Skin;
 
 /**
  * The StyleContext interface is used to provide information

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java Tue Aug  7 15:18:22 2007
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -904,7 +904,7 @@
             if (styleClass != null && !styleClass.startsWith(SkinSelectors.STATE_PREFIX))
               if (!map.containsKey(styleClass))
                 map.put(styleClass, _getShortStyleClass(map.size()));
-            
+
             if (style.isEmpty())
               emptySelectors.add(styleClass);
             else
@@ -921,15 +921,14 @@
               {
                 String styleClass = styleClasses.next();
                 _putStyleClassInShortMap(styleClass, map);
-                
                 // Don't remove any styleclass that is referred to
                 nonEmptySelectors.add(styleClass);
               }
             }
-            
+
             // now search for the selectors that have namespaces and add those to the map
             int length = namespacePrefixes.length;
-            
+
             for (int i=0; i < length; i++)
             {
               String nsPrefix = namespacePrefixes[i];
@@ -944,7 +943,6 @@
                 {
                   String styleClass = afSelectors.next();
                   _putStyleClassInShortMap(styleClass, map);
-
                   if (isFirst && !afSelectors.hasNext() && style.isEmpty())
                   {
                     emptySelectors.add(styleClass);
@@ -953,7 +951,7 @@
                   {
                     nonEmptySelectors.add(styleClass);
                   }
-                  
+
                   isFirst = false;
                 }
               }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java Tue Aug  7 15:18:22 2007
@@ -26,7 +26,7 @@
 
 import javax.servlet.jsp.JspException;
 import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 public class ComponentDefTag extends TagSupport
@@ -45,7 +45,7 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+    UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       throw new JspException(_LOG.getMessage(
@@ -64,10 +64,6 @@
 
       if (_var != null)
       {
-        if (TagUtils.isValueReference(_var))
-          throw new JspException(_LOG.getMessage(
-            "COMPONENTDEF_NOT_SUPPORT_EL"));
-          
         ((UIXComponentRef) component).setVar(_var);
       }
     }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentRefTag.java Tue Aug  7 15:18:22 2007
@@ -209,7 +209,7 @@
       AttributeMetaData attr = attrs.get(i);
       String name = attr.getAttrName();
       Class<?> klass = attr.getAttrClass();
-      if (region.getValueBinding(name) != null)
+      if (region.getValueExpression(name) != null)
         continue;
 
       Object compValue = compAttrs.get(name);

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java Tue Aug  7 15:18:22 2007
@@ -20,7 +20,7 @@
 
 import javax.faces.component.UIComponent;
 import javax.faces.webapp.FacetTag;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.Tag;
@@ -49,7 +49,7 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+    UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       _LOG.warning("FACETREF_MUST_INSIDE_UICOMPONENT");

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java Tue Aug  7 15:18:22 2007
@@ -18,24 +18,27 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib;
 
+import java.io.Serializable;
+
 import java.lang.reflect.Array;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.el.ELContext;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
 import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.webapp.UIComponentTag;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspTagException;
 import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.jstl.core.IndexedValueExpression;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidad.webapp.ELContextTag;
-import org.apache.myfaces.trinidadinternal.el.Tokenizer;
-import org.apache.myfaces.trinidadinternal.el.Tokenizer.Token;
 
 //JSTL Core Library - <c:forEach> Tag
 //===================================
@@ -58,47 +61,38 @@
 /**
  *
  */
-public class ForEachTag extends TagSupport implements ELContextTag
+public class ForEachTag extends TagSupport
 {
-  public void setItems(String items)
+  public void setItems(ValueExpression items)
   {
-    if (!items.startsWith("#{") ||
-        !items.endsWith("}"))
+    if (items.isLiteralText())
       throw new IllegalArgumentException(_LOG.getMessage(
         "MUST_BE_SIMPLE_JSF_EL_EXPRESSION"));
     _items = items;
   }
 
-  public void setBegin(String begin)
+  public void setBegin(ValueExpression begin)
   {
-    _begin = begin;
+    _beginVE = begin;
   }
 
-  public void setEnd(String end)
+  public void setEnd(ValueExpression end)
   {
-    _end = end;
+    _endVE = end;
   }
 
-  public void setStep(String step)
+  public void setStep(ValueExpression step)
   {
-    _step = step;
+    _stepVE = step;
   }
 
   public void setVar(String var)
   {
-    if (UIComponentTag.isValueReference(var))
-      throw new IllegalArgumentException(_LOG.getMessage(
-        "VAR_CANNOT_BE_EXPRESSION"));
-
     _var = var;
   }
 
   public void setVarStatus(String varStatus)
   {
-    if (UIComponentTag.isValueReference(varStatus))
-      throw new IllegalArgumentException(_LOG.getMessage(
-        "VARSTATUS_CANNOT_BE_EXPRESSION"));
-
     _varStatus = varStatus;
   }
 
@@ -108,13 +102,20 @@
     _validateAttributes();
 
     FacesContext context = FacesContext.getCurrentInstance();
-    _parentELContext = (ELContextTag)
-       findAncestorWithClass(this, ELContextTag.class);
-    _currentBegin = _resolveInteger(context, _begin, 0);
+    _currentBegin = (_begin == null) ? 0 : _begin.intValue();
+    _isFirst = true;
     int length;
+
     if (null != _items)
     {
-      Object items = _resolveObject(context, _items);
+      // AdamWiner: for reasons I cannot yet explain, using the JSP's
+      // ELContext is giving me big problems trying to grab Lists
+      // from inside of managed beans.  Switching this one call
+      // to the JSF ELContext seems to resolve that.  We certainly
+      // have to use the JSPs ELResolver for calling through
+      // to the VariableMapper
+      Object items = _items.getValue(context.getELContext());//pageContext.getELContext());
+
       //pu: If items is specified and resolves to null, it is treated as an
       //  empty collection, i.e., no iteration is performed.
       if (items == null)
@@ -123,6 +124,8 @@
           _LOG.fine("Items expression " + _items + " resolved to null.");
         return SKIP_BODY;
       }
+
+      _itemsValue = items;
       // =-=AEW <c:forEach> supports arbitrary collections;  but
       // JSF only supports List in its EL.
       if (items instanceof List)
@@ -146,7 +149,8 @@
           _LOG.fine("Size of 'items' is less than 'begin'");
         return SKIP_BODY;
       }
-      _currentEnd = _resolveInteger(context, _end, length - 1);
+
+      _currentEnd = (_end == null) ? length - 1 : _end.intValue();
       //pu: If 'end' were specified, but is beyond the size of collection, limit
       //  the iteration to where the collection ends. A mimic of c:forEach and
       //  fix for bug 4029853.
@@ -155,35 +159,37 @@
     }
     else
     {
-      _currentEnd = _resolveInteger(context, _end, 0);
+      _currentEnd = (_end == null) ? 0 : _end.intValue();
     }
     _currentIndex = _currentBegin;
-    _currentStep = _resolveInteger(context, _step, 1);
+    _currentCount = 1;
+    _currentStep = (_step == null) ? 1 : _step.intValue();
     //pu: Now check the valid relation between 'begin','end' and validity of 'step'
     _validateRangeAndStep();
+    
+    // If we can bail, do it now
     if (_currentEnd < _currentIndex)
       return SKIP_BODY;
 
-    if (null != _var || null != _varStatus)
-    {
-      //pu: If items not defined (syntax 2), the return type of 'var' is an
-      //  int according to JSTL specs, and apache impl returns index. Mimic.
-      _varReplacement = (null == _items)?
-        String.valueOf(_currentIndex):
-        _items.substring(2, _items.length() - 1) + "[" + _currentIndex + "]";
-    }
-    //pu: If there is no varStatus set, no point in keeping loop status
-    //  variables updated.
+    _isLast = _currentIndex == _currentEnd;
+
+    // Save off the previous deferred variables
+    VariableMapper vm = 
+      pageContext.getELContext().getVariableMapper();
+    if (_var != null)
+      _previousDeferredVar = vm.resolveVariable(_var);
+
     if (null != _varStatus)
     {
-      _updateLoopStatus();
+      _previousDeferredVarStatus = vm.resolveVariable(_varStatus);
       _propertyReplacementMap = new HashMap<String, Object>(9, 1);
       _propertyReplacementMap.put("begin", Integer.valueOf(_currentBegin));
       _propertyReplacementMap.put("end", Integer.valueOf(_currentEnd));
       _propertyReplacementMap.put("step", Integer.valueOf(_currentStep));
       _propertyReplacementMap.put("count", Integer.valueOf(_currentCount));
       _propertyReplacementMap.put("index", Integer.valueOf(_currentIndex));
-      _propertyReplacementMap.put("current", _varReplacement);
+      // FIXME: Can we support "current" efficiently?
+      //      _propertyReplacementMap.put("current", _varReplacement);
       _propertyReplacementMap.put(
         "first",
         (_isFirst)? Boolean.TRUE:Boolean.FALSE);
@@ -197,6 +203,10 @@
       _LOG.finer("Iterating from " + _currentIndex + " to " + _currentEnd +
                  " by " + _currentStep);
     }
+
+    // Update the variables
+    _updateVars();
+
     return EVAL_BODY_INCLUDE;
   }
 
@@ -204,103 +214,49 @@
   public int doAfterBody()
   {
     _currentIndex += _currentStep;
-
-    if (null != _var || null != _varStatus)
-    {
-      //pu: If items not defined (syntax 2), the return type of 'var' is an
-      //  int according to JSTL specs, and apache impl returns index. Mimic.
-      _varReplacement = (null == _items)?
-        String.valueOf(_currentIndex):
-        _items.substring(2, _items.length() - 1) + "[" + _currentIndex + "]";
-    }
+    _currentCount += 1;
 
     //pu: if there is no varStatus set, no point in keeping loop status
     //  variables updated.
     if (null != _varStatus)
     {
-      //pu: _isFirst is not yet updated after first iteration
-      boolean isSecondIteration = (_isFirst)? true:false;
-      _updateLoopStatus();
-      if (isSecondIteration)
+      if (_isFirst)
       {
-        _propertyReplacementMap.put(
-          "first",
-          (_isFirst)? Boolean.TRUE:Boolean.FALSE);
+        _propertyReplacementMap.put("first", Boolean.FALSE);
+        _isFirst = false;
       }
+
+      _isLast = (_currentIndex == _currentEnd);
       if (_isLast)
       {
-        _propertyReplacementMap.put(
-          "last",
-          (_isLast)? Boolean.TRUE:Boolean.FALSE);
+        _propertyReplacementMap.put("last", _isLast);
       }
       _propertyReplacementMap.put("count", Integer.valueOf(_currentCount));
       _propertyReplacementMap.put("index", Integer.valueOf(_currentIndex));
-      _propertyReplacementMap.put("current", _varReplacement);
+      // FIXME: Can we support "current" efficiently?
+      //      _propertyReplacementMap.put("current", _varReplacement);
     }
 
+    // If we're at the end, bail
     if (_currentEnd < _currentIndex)
-      return SKIP_BODY;
-    return EVAL_BODY_AGAIN;
-  }
-
-  public String transformId(String id)
-  {
-    if (_parentELContext != null)
-      id = _parentELContext.transformId(id);
-
-    // SEPARATOR_CHAR would be nice;  but JSF does not allow
-    // the separator char in an ID - just in client IDs.
-    //    return id + NamingContainer.SEPARATOR_CHAR + _currentIndex;
-    return id + '_' + _currentIndex;
-  }
-  static String __transformExpression(
-    String expression,
-    String var,
-    String subst)
-  {
-    String varDot = var + ".";
-    Tokenizer tokens = new Tokenizer(expression);
-    StringBuffer buf = new StringBuffer(expression.length());
-    while(tokens.hasNext())
-    {
-      Token tok = tokens.next();
-      String exp = tok.getText();
-      if (tok.type == Tokenizer.VAR_TYPE)
-      {
-        if (var.equals(exp) || exp.startsWith(varDot))
-        {
-          buf.append(subst);
-          buf.append(exp.substring(var.length()));
-          continue;
-        }
-      }
-
-      buf.append(exp);
-    }
-    return buf.toString();
-  }
-  public String transformExpression(String expression)
-  {
-    if (expression != null)
     {
-      String transformedExp = expression;
-      int expressionStart = expression.indexOf("#{");
-      if (expressionStart >= 0)
-      {
-        transformedExp = _transformExpression(expression);
-
-        if (_parentELContext != null)
-          transformedExp = _parentELContext.transformExpression(transformedExp);
-      }
+      // Restore EL state
+      VariableMapper vm = 
+        pageContext.getELContext().getVariableMapper();
+      if (_var != null)
+        vm.setVariable(_var, _previousDeferredVar);
+      if (_varStatus != null)
+        vm.setVariable(_varStatus, _previousDeferredVarStatus);
 
-      if (_LOG.isFiner())
-        _LOG.finer("Transformed expression:{0} to:{1}",
-                   new String[] {expression, transformedExp});
-      return transformedExp;
+      return SKIP_BODY;
     }
+    
+    // Otherwise, update the variables and go again
+    _updateVars();
 
-    return null;
+    return EVAL_BODY_AGAIN;
   }
+
   /**
    * Release state.
    */
@@ -308,29 +264,85 @@
   public void release()
   {
     super.release();
-    //=-=pu: Does only the properties that has setters need to be released ?
-    //  What about variables like _propertyReplacementMap/_varReplacement etc. ?
     _begin = null;
     _end = null;
-    _end = null;
-    _items = null;
     _step = null;
+    _items = null;
+    _itemsValue = null;
     _var = null;
     _varStatus = null;
+    _propertyReplacementMap = null;
+    _previousDeferredVar = null;
+    _previousDeferredVarStatus = null;
   }
 
-  protected ValueBinding createValueBinding(
+  // Push new values into the VariableMapper and the pageContext
+  private void _updateVars()
+  {
+    VariableMapper vm = 
+      pageContext.getELContext().getVariableMapper();
+    if (_var != null)
+    {
+      // Catch programmer error where _var has been set but
+      // _items has not
+      if (_items != null)
+      {
+        ValueExpression iterated = new IndexedValueExpression(_items,
+                                                              _currentIndex);
+        vm.setVariable(_var, iterated);
+      }
+      
+      // Ditto (though, technically, one check for
+      // _items is sufficient, because if _items evaluated
+      // to null, we'd skip the whole loop)
+      Object items = _itemsValue;
+      if (items != null)
+      {
+        Object item;
+        if (items instanceof List)
+          item = ((List) items).get(_currentIndex);
+        else
+          item = Array.get(items, _currentIndex);
+
+        pageContext.setAttribute(_var, item);
+      }
+    }
+    
+    if (_varStatus != null)
+    {
+      pageContext.setAttribute(_varStatus, _propertyReplacementMap);
+      ValueExpression constant = new Constants(
+                                      new HashMap(_propertyReplacementMap));
+      vm.setVariable(_varStatus, constant);
+    }
+  }
+
+  private Integer _evaluateInteger(
     FacesContext context,
-    String       expression)
+    ValueExpression ve)
   {
-    if (_parentELContext != null)
-      expression = _parentELContext.transformExpression(expression);
+    if (ve == null)
+      return null;
+
+    Object val = ve.getValue(context.getELContext());
+    if (val instanceof Integer)
+      return (Integer) val;
+    else if (val instanceof Number)
+      return Integer.valueOf(((Number) val).intValue());
 
-    return context.getApplication().createValueBinding(expression);
+    return null;
   }
 
   private void _validateAttributes() throws JspTagException
   {
+    // Evaluate these three ValueExpressions into integers
+    // For why we use FacesContext instead of PageContext, see
+    // above (the evaluation of _items)
+    FacesContext context = FacesContext.getCurrentInstance();
+    _end = _evaluateInteger(context, _endVE);
+    _begin = _evaluateInteger(context, _beginVE);
+    _step = _evaluateInteger(context, _stepVE);
+
     if (null == _items)
     {
       if (null == _begin || null == _end)
@@ -344,7 +356,7 @@
         _var.equals(_varStatus))
     {
       throw new JspTagException(
-        "'var' and 'varStatus' should not have same value");
+        "'var' and 'varStatus' should not have the same value");
     }
   }
 
@@ -355,154 +367,62 @@
     if (_currentStep < 1)
       throw new JspTagException("'step' < 1");
   }
-  
-  private String _transformExpression(String expression)
+
+  // Basic ValueExpression that always returns a constant object
+  static private class Constants extends ValueExpression
+                                 implements Serializable
   {
-    boolean doVar = (_var != null);
-    boolean doVarStatus = (_varStatus != null);
-    if (!(doVar || doVarStatus))
-      return expression;
-    StringBuffer buf = new StringBuffer(expression.length());
-    // ACW: see bug 3754666:
-    Tokenizer tokens = new Tokenizer(expression);
-    String varDot = _var+".";
-    String varStatusDot = _varStatus+".";
-    while(tokens.hasNext())
-    {
-      Token tok = tokens.next();
-      String text = tok.getText();
-      if (tok.type == Tokenizer.VAR_TYPE)
-      {
-        if (doVar && (_var.equals(text) || text.startsWith(varDot)))
-        {
-          text = _replaceVariableAndPropertiesInExpression(
-            text, _var, _varReplacement, null);
-        }
-        else if (doVarStatus && (_varStatus.equals(text) || text.startsWith(varStatusDot)))
-        {
-          text = _replaceVariableAndPropertiesInExpression(
-            text, _varStatus, null, _propertyReplacementMap);
-        }
-      }
-      buf.append(text);
+    public Constants(Object o)
+    {
+      _o = o;
     }
-    return buf.toString();
-  }
-  /**
-   * Replaces all occurance of 'variable' and the property (the key in map)
-   * with the property replacement (value in the map).
-   * If propertyReplacementMap were to be null, then all the occurance of
-   * 'variable' will be replaced by 'variableReplacement'.
-   * Returns a string modified thus.
-   */
-  private String _replaceVariableAndPropertiesInExpression(
-    String subExpression,
-    String variable,
-    String variableReplacement,
-    Map<String, Object> propertyReplacementMap)
-  {
-    int variableLength = variable.length();
-    //pu: Now check whether the variable is followed by any property from
-    //  the supplied map.
-    if (null != propertyReplacementMap)
-    {
-      String property;
-      String propertyReplacement;
-      for(Map.Entry<String, Object> entry : propertyReplacementMap.entrySet())
-      {
-        property = entry.getKey();
-        String expressionAfterVar = subExpression.substring(variableLength);
-        if (expressionAfterVar.startsWith("."+property))
-        {
-          int propertyLength = property.length();
-          //pu: We found our property, but it could be followed
-          //  by an alphanumeric in which case we ignore and move on because
-          //  we just found it as a substring
-          int endOfReplacement = propertyLength + 1;
-          if (expressionAfterVar.length() > endOfReplacement)
-          {
-            if (Character.isLetterOrDigit(
-              expressionAfterVar.charAt(endOfReplacement)))
-            {
-              continue;
-            }
-          }
-          propertyReplacement = entry.getValue().toString();
-          //pu: Replace both the variable plus the property following it.
-          subExpression = _replaceSubString(
-            subExpression,
-            0,
-            variableLength + propertyLength + 1,
-            propertyReplacement);
-          //pu: If we handled atleast one property, break out from here.
-          break;
-        }
-      }
+
+    public Object getValue(ELContext context)
+    {
+      return _o;
     }
-    //pu: If there were no properties to be replaced, replace the variable itself
-    else
+
+    public void setValue(ELContext context, Object value)
     {
-      subExpression = _replaceSubString(subExpression, 0, variableLength, variableReplacement);
+      throw new PropertyNotWritableException();
     }
 
+    public boolean isReadOnly(ELContext context)
+    {
+      return true;
+    }
 
-    return subExpression;
-  }
-  /**
-   * Given the 'str', replaces a substring starting from 'beginIndex'
-   * of 'noOfChars' length with the string in 'replacement', returns the
-   * string modified thus.
-   */
-  private String _replaceSubString(
-    String str,
-    int beginIndex,
-    int noOfChars,
-    String replacement)
-  {
-    StringBuffer buffer = new StringBuffer(str.length() +
-                                           replacement.length() -
-                                           noOfChars);
-    buffer.append(str.substring(0, beginIndex));
-    buffer.append(replacement);
-    buffer.append(str.substring(beginIndex + noOfChars));
-    return buffer.toString();
-  }
-  /**
-   * Update the loop status variables.
-   */
-  private void _updateLoopStatus()
-  {
-    _currentCount = ((_currentIndex - _currentBegin)/_currentStep) + 1;
-    _isFirst = (_currentIndex == _currentBegin);
-    _isLast = (_currentIndex + _currentStep) > _currentEnd;
-  }
+    public Class getType(ELContext context)
+    {
+      return _o.getClass();
+    }
 
+    public Class getExpectedType()
+    {
+      return _o.getClass();
+    }
 
-  private Object _resolveObject(FacesContext context, String expression)
-  {
-    ValueBinding vb = createValueBinding(context, expression);
-    return vb.getValue(context);
-  }
+    public String getExpressionString()
+    {
+      return null;
+    }
 
-  private int _resolveInteger(
-    FacesContext context,
-    String       expression,
-    int          defaultValue)
-  {
-    if (expression == null)
-      return defaultValue;
+    public boolean equals(Object obj)
+    {
+      return obj == this;
+    }
 
-    if (UIComponentTag.isValueReference(expression))
+    public int hashCode()
     {
-      Object o = _resolveObject(context, expression);
-      if (o instanceof Number)
-        return ((Number) o).intValue();
-      if (o == null)
-        return defaultValue;
+      return _o.hashCode();
+    }
 
-      expression = o.toString();
+    public boolean isLiteralText()
+    {
+      return true;
     }
-    return Integer.parseInt(expression);
+
+    private Object _o;
   }
 
   private int _currentBegin;
@@ -512,18 +432,28 @@
   private int _currentCount;
   private boolean _isFirst;
   private boolean _isLast;
-  private ELContextTag _parentELContext;
 
-  private String _items;
-  private String _begin;
-  private String _end;
-  private String _step;
+
+  private ValueExpression _items;
+  private Object          _itemsValue;
+
+  private ValueExpression _beginVE;
+  private ValueExpression _endVE;
+  private ValueExpression _stepVE;
+
+  private Integer _begin;
+  private Integer _end;
+  private Integer _step;
+
   private String _var;
   private String _varStatus;
-  //pu: Map for properties referred off from 'varStatus' and their replacements
+  
+  // Saved values on the VariableMapper
+  private ValueExpression _previousDeferredVar;
+  private ValueExpression _previousDeferredVarStatus;
+
+  // Map for properties referred off from 'varStatus' and their replacements
   private Map<String, Object> _propertyReplacementMap;
-  //pu: Represents replacement for 'var' upon every iteration
-  private String _varReplacement;
 
   private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(ForEachTag.class);
 

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/UIXCollectionTag.java Tue Aug  7 15:18:22 2007
@@ -1,58 +1,60 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.trinidadinternal.taglib;
-
-import org.apache.myfaces.trinidad.bean.FacesBean;
-import org.apache.myfaces.trinidad.component.UIXCollection;
-import org.apache.myfaces.trinidad.webapp.UIXComponentTag;
-
-/**
- * Manually written because we don't auto-generate UIXCollection,
- * and we can't currently auto-generate only one of the two.
- */
-abstract public class UIXCollectionTag extends UIXComponentTag
-{
-  /**
-   * Construct an instance of the UIXCollectionTag.
-   */
-  public UIXCollectionTag()
-  {
-  }
-
-  private String _var;
-  public void setVar(String var)
-  {
-    _var = var;
-  }
-
-  @Override
-  protected void setProperties(
-    FacesBean bean)
-  {
-    super.setProperties(bean);
-    setProperty(bean, UIXCollection.VAR_KEY, _var);
-  }
-
-  @Override
-  public void release()
-  {
-    super.release();
-    _var = null;
-  }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidadinternal.taglib;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.component.UIXCollection;
+import org.apache.myfaces.trinidad.webapp.UIXComponentELTag;
+
+/**
+ * Manually written because we don't auto-generate UIXCollection,
+ * and we can't currently auto-generate only one of the two.
+ */
+abstract public class UIXCollectionTag extends UIXComponentELTag
+{
+  /**
+   * Construct an instance of the UIXCollectionTag.
+   */
+  public UIXCollectionTag()
+  {
+  }
+
+  private String _var;
+  public void setVar(String var)
+  {
+    _var = var;
+  }
+
+  @Override
+  protected void setProperties(
+    FacesBean bean)
+  {
+    super.setProperties(bean);
+    bean.setProperty(UIXCollection.VAR_KEY, _var);
+  }
+
+  @Override
+  public void release()
+  {
+    super.release();
+    _var = null;
+  }
+}
+
+

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/convert/ConvertIntegerTag.java Tue Aug  7 15:18:22 2007
@@ -18,8 +18,10 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.convert;
 
+import javax.faces.application.Application;
 import javax.faces.convert.Converter;
-import javax.faces.webapp.ConverterTag;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.ConverterELTag;
 
 import javax.servlet.jsp.JspException;
 import org.apache.myfaces.trinidadinternal.convert.IntegerConverter;
@@ -28,28 +30,22 @@
 
  * @version 2.0 (1.0) 2000/03/16 23:23:33
  */
-public class ConvertIntegerTag extends ConverterTag
+public class ConvertIntegerTag extends ConverterELTag
 {
 
   public ConvertIntegerTag()
   {
   }
 
-  @Override
-  public int doStartTag() throws JspException
-  {
-    super.setConverterId(IntegerConverter.CONVERTER_ID);
-    return super.doStartTag();
-  }
-
   /**
    * 
    */
   @Override
   protected Converter createConverter() throws JspException
   {
-    IntegerConverter converter =
-                              (IntegerConverter)super.createConverter();
+    Application application = FacesContext.getCurrentInstance().getApplication();
+    IntegerConverter converter = (IntegerConverter)
+      application.createConverter(IntegerConverter.CONVERTER_ID);
     return converter;
   }
 }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListener.java Tue Aug  7 15:18:22 2007
@@ -22,10 +22,11 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
 import javax.faces.component.StateHolder;
 import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ActionListener;
 
@@ -50,13 +51,13 @@
   static public final FacesBean.Type TYPE = new FacesBean.Type();
   static public final PropertyKey FILENAME_KEY =
     TYPE.registerKey("filename");
-  // Must be a ValueBinding
+  // Must be a ValueExpression
   static public final PropertyKey CONTENT_TYPE_KEY =
     TYPE.registerKey("contentType");
   static public final PropertyKey METHOD_KEY =
     TYPE.registerKey("method",
-                     MethodBinding.class,
-                     PropertyKey.CAP_NOT_BOUND | PropertyKey.CAP_STATE_HOLDER);
+                     MethodExpression.class,
+                     PropertyKey.CAP_NOT_BOUND);
 
   static
   {
@@ -90,11 +91,11 @@
           // TODO: what about non-ASCII characters in the filename?
           hsr.setHeader("Content-Disposition",
                         "attachment; filename=" + filename);
-        MethodBinding method = getMethod();
+        MethodExpression method = getMethod();
         OutputStream out = new BufferedOutputStream(hsr.getOutputStream());
         try
         {
-          method.invoke(context, new Object[]{context, out});
+          method.invoke(context.getELContext(), new Object[]{context, out});
         }
         finally
         {
@@ -111,12 +112,12 @@
     context.responseComplete();
   }
 
-  public MethodBinding getMethod()
+  public MethodExpression getMethod()
   {
-    return (MethodBinding) getProperty(METHOD_KEY);
+    return (MethodExpression) getProperty(METHOD_KEY);
   }
 
-  public void setMethod(MethodBinding method)
+  public void setMethod(MethodExpression method)
   {
     setProperty(METHOD_KEY, method);
   }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java Tue Aug  7 15:18:22 2007
@@ -22,6 +22,9 @@
 
 import java.io.OutputStream;
 
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
 import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.JspException;
 
@@ -38,17 +41,17 @@
  */
 public class FileDownloadActionListenerTag extends TagSupport
 {
-  public void setContentType(String contentType)
+  public void setContentType(ValueExpression contentType)
   {
     _contentType = contentType;
   }
 
-  public void setFilename(String filename)
+  public void setFilename(ValueExpression filename)
   {
     _filename = filename;
   }
 
-  public void setMethod(String method)
+  public void setMethod(MethodExpression method)
   {
     _method = method;
   }
@@ -84,53 +87,17 @@
 
     if (_filename != null)
     {
-      if (TagUtils.isValueReference(_filename))
-      {
-        String filename = _filename;
-        if (parentELContext != null)
-          filename = parentELContext.transformExpression(filename);
-
-        listener.setValueBinding(FileDownloadActionListener.FILENAME_KEY,
-                                 application.createValueBinding(filename));
-      }
-      else
-      {
-        listener.setFilename(_filename);
-      }
+      listener.setValueExpression(FileDownloadActionListener.FILENAME_KEY,
+                                  _filename);
     }
 
     if (_contentType != null)
     {
-      if (TagUtils.isValueReference(_contentType))
-      {
-        String contentType = _contentType;
-        if (parentELContext != null)
-          contentType = parentELContext.transformExpression(contentType);
-
-        listener.setValueBinding(FileDownloadActionListener.CONTENT_TYPE_KEY,
-                                 application.createValueBinding(contentType));
-      }
-      else
-      {
-        listener.setContentType(_contentType);
-      }
+      listener.setValueExpression(FileDownloadActionListener.CONTENT_TYPE_KEY,
+                                  _contentType);
     }
 
-
-    if (TagUtils.isValueReference(_method))
-    {
-      String method = _method;
-      if (parentELContext != null)
-          method = parentELContext.transformExpression(method);
-      
-      listener.setMethod(application.createMethodBinding(method,
-                  new Class[]{FacesContext.class, OutputStream.class}));
-    }
-    else
-    {
-      throw new JspException(_LOG.getMessage(
-        "FILEDOWNLOADACTIONLISTENERS_METHOD_MUST_BE_EL_EXPRESSION"));
-    }
+    listener.setMethod(_method);
 
     ((ActionSource) component).addActionListener(listener);
 
@@ -146,9 +113,10 @@
     _method = null;
   }
 
-  private String _contentType;
-  private String _filename;
-  private String _method;
+  private ValueExpression _contentType;
+  private ValueExpression _filename;
+  private MethodExpression _method;
   private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
     FileDownloadActionListenerTag.class);
 }
+

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java Tue Aug  7 15:18:22 2007
@@ -20,7 +20,7 @@
 
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.TagSupport;
@@ -34,7 +34,7 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+    UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       throw new JspException(_LOG.getMessage(

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java Tue Aug  7 15:18:22 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.listener;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.StateHolder;
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ActionListener;
@@ -47,19 +49,17 @@
 
   public void processAction(ActionEvent event)
   {
-    Object value = getValue();
+    Object value = getProperty(VALUE_KEY);
     RequestContext adf = RequestContext.getCurrentInstance();
     adf.returnFromDialog(value, null);
   }
 
-  public Object getValue()
-  {
-    return getProperty(VALUE_KEY);
-  }
-
-  public void setValue(Object value)
+  public void setValue(ValueExpression value)
   {
-    setProperty(VALUE_KEY, value);
+    if (value.isLiteralText())
+      setProperty(VALUE_KEY, value.getValue(null));
+    else
+      setValueExpression(VALUE_KEY, value);
   }
 
   @Override

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java Tue Aug  7 15:18:22 2007
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
 
+import javax.el.ValueExpression;
+
 import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.JspException;
 
@@ -27,7 +29,7 @@
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
 
 import org.apache.myfaces.trinidad.webapp.ELContextTag;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -38,7 +40,7 @@
  */
 public class ReturnActionListenerTag extends TagSupport
 {
-  public void setValue(String value)
+  public void setValue(ValueExpression value)
   {
     _value = value;
   }
@@ -46,7 +48,8 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+    UIComponentClassicTagBase tag =
+      UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       throw new JspException(_LOG.getMessage(
@@ -72,21 +75,8 @@
 
     ReturnActionListener listener = new ReturnActionListener();
     if (_value != null)
-    {
-      String value = _value;
-      if (TagUtils.isValueReference(value))
-      {
-        if (parentELContext != null)
-          value = parentELContext.transformExpression(value);
-
-        listener.setValueBinding(ReturnActionListener.VALUE_KEY,
-                                 application.createValueBinding(value));
-      }
-      else
-      {
-        listener.setValue(value);
-      }
-    }
+      listener.setValue(_value);
+
     ((ActionSource) component).addActionListener(listener);
 
     return super.doStartTag();
@@ -99,7 +89,7 @@
     _value = null;
   }
 
-  private String _value;
+  private ValueExpression _value;
   private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
     ReturnActionListenerTag.class);
 }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java Tue Aug  7 15:18:22 2007
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
 
+import javax.el.ValueExpression;
+
 import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.JspException;
 
@@ -27,7 +29,7 @@
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
 
 import org.apache.myfaces.trinidad.event.SetActionListener;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -40,12 +42,12 @@
  */
 public class SetActionListenerTag extends TagSupport
 {
-  public void setFrom(String from)
+  public void setFrom(ValueExpression from)
   {
     _from = from;
   }
 
-  public void setTo(String to)
+  public void setTo(ValueExpression to)
   {
     _to = to;
   }
@@ -53,7 +55,7 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+   UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       throw new JspException(_LOG.getMessage(
@@ -80,34 +82,13 @@
     SetActionListener listener = new SetActionListener();
     if (_from != null)
     {
-      if (TagUtils.isValueReference(_from))
-      {
-        String from = _from;
-        if (parentELContext != null)
-          from = parentELContext.transformExpression(from);
-
-        listener.setValueBinding("from",
-                                 application.createValueBinding(from));
-      }
-      else
-      {
-        listener.setFrom(_from);
-      }
-
-      if (TagUtils.isValueReference(_to))
-      {
-        String to = _to;
-        if (parentELContext != null)
-          to = parentELContext.transformExpression(to);
-
-        listener.setValueBinding("to",
-                                 application.createValueBinding(to));
-      }
-      else
-      {
+      listener.setValueExpression("from", _from);
+      if (_to.isLiteralText())
         throw new JspException(_LOG.getMessage(
           "SETACTIONLISTENERS_TO_MUST_BE_EL_EXPRESSION"));
-      }
+
+      if (_to != null)
+        listener.setValueExpression("to", _to);
     }
 
     ((ActionSource) component).addActionListener(listener);
@@ -123,8 +104,8 @@
     _to = null;
   }
 
-  private String _from;
-  private String _to;
+  private ValueExpression _from;
+  private ValueExpression _to;
   private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
     SetActionListenerTag.class);
 }

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java Tue Aug  7 15:18:22 2007
@@ -32,7 +32,6 @@
 
 import javax.faces.application.Application;
 import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
@@ -51,14 +50,6 @@
   {
   }
 
-  public static ValueBinding getValueBinding(String valueBindingExpression)
-  {
-    FacesContext context = FacesContext.getCurrentInstance();
-    Application app = context.getApplication();
-    ValueBinding vb = app.createValueBinding(valueBindingExpression);
-    return vb;
-  }
-
   public static void assertNotNull(Object object)
   {
     if (null == object)
@@ -73,9 +64,12 @@
    * @return
    */
   public static String getString(
-    String      value)
+    Object value)
   {
-    return value;
+    if (value == null)
+      return null;
+
+    return value.toString();
   }
 
   /**
@@ -84,9 +78,15 @@
    * @return
    */
   public static boolean getBoolean(
-    String      value)
+    Object  value)
   {
-    return Boolean.valueOf(value).booleanValue();
+    if (value == null)
+      return false;
+    
+    if (value instanceof Boolean)
+      return ((Boolean) value).booleanValue();
+
+    return Boolean.valueOf(value.toString()).booleanValue();
   }
 
   /**
@@ -95,9 +95,15 @@
    * @return
    */
   public static int getInteger(
-    String      value)
+    Object  value)
   {
-    return Integer.valueOf(value).intValue();
+    if (value == null)
+      return 0;
+
+    if (value instanceof Number)
+      return ((Number) value).intValue();
+
+    return Integer.valueOf(value.toString()).intValue();
 
   }
 
@@ -107,10 +113,12 @@
    * @return
    */
   public static long getLong(
-    String      value)
+    Object      value)
   {
-    return Long.valueOf(value).longValue();
+    if (value == null)
+      return 0;
 
+    return Long.valueOf(value.toString()).longValue();
   }
 
   /**
@@ -119,9 +127,12 @@
    * @return
    */
   public static double getDouble(
-    String      value)
+    Object      value)
   {
-    return Double.valueOf(value).doubleValue();
+    if (value == null)
+      return 0;
+
+    return Double.valueOf(value.toString()).doubleValue();
 
   }
 
@@ -131,10 +142,12 @@
    * @return
    */
   public static float getFloat(
-    String      value)
+    Object      value)
   {
-    return Float.valueOf(value).floatValue();
+    if (value == null)
+      return 0;
 
+    return Float.valueOf(value.toString()).floatValue();
   }
 
   /**
@@ -144,9 +157,12 @@
    * @return
    */
   public static String[] getStringArray(
-    String      value) throws ParseException
+    Object  value) throws ParseException
   {
-    return _getTokensArray(value);
+    if (value == null)
+      return null;
+
+    return _getTokensArray(value.toString());
   }
 
   /**
@@ -155,9 +171,15 @@
    * @return
    */
   public static Date getDate(
-    String      value)
+    Object   value)
   {
-     return _parseISODate(value);
+    if (value == null)
+      return null;
+
+    if (value instanceof Date)
+      return ((Date) value);
+
+    return _parseISODate(value.toString());
   }
 
   /**
@@ -166,9 +188,15 @@
    * @return
    */
   public static Locale getLocale(
-    String      value)
+    Object      value)
   {
-    return _getLocale(value);
+    if (value == null)
+      return null;
+
+    if (value instanceof Locale)
+      return ((Locale) value);
+
+    return _getLocale(value.toString());
   }
 
   /**
@@ -177,21 +205,15 @@
    * @return
    */
   public static TimeZone getTimeZone(
-    String value)
+    Object value)
   {
-     return TimeZone.getTimeZone(value);
-  }
+    if (value == null)
+      return null;
 
-  public static boolean isValueReference(String expression)
-  {
-    if (null != expression)
-    {
-      int start = expression.indexOf("#{");
-      if ((start >= 0) && (expression.indexOf('}', start + 1) >= 0))
-        return true;
-    }
+    if (value instanceof TimeZone)
+      return ((TimeZone) value);
 
-    return false;
+     return TimeZone.getTimeZone(value.toString());
   }
 
   /**
@@ -199,9 +221,13 @@
    *  java.util.List of java.awt.Color objects and returns it.
    * @throws ParseException In case of any parse errors upon such conversion.
    */
-  public static List<Color> getColorList(String value) throws ParseException
+  public static List<Color> getColorList(Object value) throws ParseException
   {
-    String[] tokenArray = _getTokensArray(value);
+    if (value == null)
+      return null;
+
+    String valueStr = value.toString();
+    String[] tokenArray = _getTokensArray(valueStr);
     if (tokenArray == null)
       return null;
 
@@ -214,7 +240,7 @@
       //pu: If we do not have correct starter, stop here
       if (!colorCode.startsWith("#"))
         throw new ParseException(_LOG.getMessage(
-          "COLOR_CODE_DOES_NOT_START_WITH_POUNDSIGN", new Object[]{colorCode, value}), value.indexOf(colorCode));
+          "COLOR_CODE_DOES_NOT_START_WITH_POUNDSIGN", new Object[]{colorCode, value}), valueStr.indexOf(colorCode));
 
       //pu: Allow NumberFormatException (RTE) to propogate as is, or transform to JspException ?.
       int rgb = Integer.parseInt(colorCode.substring(1), 16);

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java Tue Aug  7 15:18:22 2007
@@ -18,7 +18,7 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.util;
 
-import javax.faces.el.ValueBinding;
+import javax.el.ValueExpression;
 
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.bean.FacesBean;
@@ -55,14 +55,14 @@
 
   public static void setAccessKeyAttribute(
     FacesBean    bean,
-    ValueBinding valueBinding,
+    ValueExpression valueExpression,
     PropertyKey  textKey,
     PropertyKey  accessKeyKey)
   {
-    bean.setValueBinding(accessKeyKey,
-                         new AccessKeyBinding(valueBinding));
-    bean.setValueBinding(textKey,
-                         new StripAccessKeyBinding(valueBinding));
+    bean.setValueExpression(accessKeyKey,
+                            new AccessKeyBinding(valueExpression));
+    bean.setValueExpression(textKey,
+                         new StripAccessKeyBinding(valueExpression));
   }
 
   private VirtualAttributeUtils()

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java?view=diff&rev=563680&r1=563679&r2=563680
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UINodeFacesBean.java Tue Aug  7 15:18:22 2007
@@ -21,7 +21,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.faces.el.ValueBinding;
+import javax.el.ValueExpression;
 
 
 import org.apache.myfaces.trinidad.bean.FacesBean;
@@ -174,14 +174,14 @@
         AttributeKey attrKey = getAttributeKey(key);
         if (attrKey != null)
         {
-          // We're no longer shadowing a ValueBinding (if one's present);
+          // We're no longer shadowing a ValueExpression (if one's present);
           // re-establish that binding, or reset to null
           Object attrValue;
-          ValueBinding binding = getValueBinding(key);
-          if (binding == null)
+          ValueExpression expression = getValueExpression(key);
+          if (expression == null)
             attrValue = null;
           else
-            attrValue = new ValueBindingBoundValue(binding);
+            attrValue = new ValueExpressionBoundValue(expression);
 
           _node.setAttributeValue(attrKey, attrValue);
         }
@@ -193,9 +193,9 @@
   }
 
   @Override
-  protected PropertyMap createBindingsMap()
+  protected PropertyMap createExpressionsMap()
   {
-    FlaggedPropertyMap bindings = new FlaggedPropertyMap()
+    FlaggedPropertyMap expressions = new FlaggedPropertyMap()
     {
       @Override
       public Object put(PropertyKey key, Object value)
@@ -211,12 +211,12 @@
           if (attrKey != null)
           {
             // If there's no local value, then we're not shadowing;
-            // set up a new ValueBindingBoundValue
+            // set up a new ValueExpressionBoundValue
             if (getLocalProperty(key) == null)
             {
-              ValueBinding binding = (ValueBinding) value;
+              ValueExpression expression = (ValueExpression) value;
               _node.setAttributeValue(attrKey,
-                                      new ValueBindingBoundValue(binding));
+                                      new ValueExpressionBoundValue(expression));
             }
           }
 
@@ -243,8 +243,7 @@
       }
     };
 
-    bindings.setUseStateHolder(true);
-    return bindings;
+    return expressions;
   }
 
 



Mime
View raw message