incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r466189 - in /incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: facelets/ taglib/listener/ taglib/util/ validator/
Date Fri, 20 Oct 2006 16:33:19 GMT
Author: awiner
Date: Fri Oct 20 09:33:18 2006
New Revision: 466189

URL: http://svn.apache.org/viewvc?view=rev&rev=466189
Log:
Merge back JSF 1.2 modifications, one step at a time.  Having svn problems with some files

Added:
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java
      - copied unchanged from r466160, incubator/adffaces/branches/faces-1_2/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java
Modified:
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
    incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
Fri Oct 20 09:33:18 2006
@@ -55,10 +55,10 @@
       ValueExpression valueExp = _value.getValueExpression(faceletContext, Object.class);
       ActionSource actionSource = (ActionSource)parent;
       ReturnActionListener listener = new ReturnActionListener();
-      listener.setValueBinding(ReturnActionListener.VALUE_KEY, new LegacyValueBinding(valueExp));
+      listener.setValueExpression(ReturnActionListener.VALUE_KEY, valueExp);
       actionSource.addActionListener(listener);
     }
   }
 
   private final TagAttribute _value;
-}
\ No newline at end of file
+}

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
Fri Oct 20 09:33:18 2006
@@ -24,14 +24,12 @@
 
 import com.sun.facelets.FaceletContext;
 import com.sun.facelets.FaceletException;
-import com.sun.facelets.el.LegacyValueBinding;
 import com.sun.facelets.tag.TagAttribute;
 import com.sun.facelets.tag.TagConfig;
 import com.sun.facelets.tag.TagHandler;
 import com.sun.facelets.tag.jsf.ComponentSupport;
 
 /**
- * @todo it should be removed after we consume JSF1.2.
  * @author Emmanuel Pirsch
  */
 public class SetActionListenerTag extends TagHandler
@@ -57,10 +55,10 @@
                                                             Object.class);
       ActionSource actionSource= (ActionSource) parent;
       SetActionListener listener = new SetActionListener();
-      listener.setValueBinding(SetActionListener.FROM_KEY,
-                               new LegacyValueBinding(fromExpression));
-      listener.setValueBinding(SetActionListener.TO_KEY,
-                               new LegacyValueBinding(toExpression));
+      listener.setValueExpression(SetActionListener.FROM_KEY,
+                                  fromExpression);
+      listener.setValueExpression(SetActionListener.TO_KEY,
+                                  toExpression);
       actionSource.addActionListener(listener);
     }
   }

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
Fri Oct 20 09:33:18 2006
@@ -39,9 +39,9 @@
 {
   public static final MetaRule Instance = new TrinidadListenersTagRule();
 
-  private static class ListenerPropertyMetadata extends Metadata
+  private static class ListenerMBPropertyMetadata extends Metadata
   {
-    public ListenerPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
+    public ListenerMBPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
     {
       _method = method;
       _attribute = attribute;
@@ -74,6 +74,42 @@
     private final TagAttribute _attribute;
     private       Class[]      _paramList;
   }
+
+  private static class ListenerMEPropertyMetadata extends Metadata
+  {
+    public ListenerMEPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
+    {
+      _method = method;
+      _attribute = attribute;
+      _paramList = paramList;
+    }
+    
+    @Override
+    @SuppressWarnings("deprecation")
+    public void applyMetadata(FaceletContext ctx, Object instance)
+    {
+      MethodExpression expr =
+        _attribute.getMethodExpression(ctx, null, _paramList);
+      
+      try
+      {
+        _method.invoke(instance,
+                       new Object[]{expr});
+      }
+      catch (InvocationTargetException e)
+      {
+        throw new TagAttributeException(_attribute, e.getCause());
+      }
+      catch (Exception e)
+      {
+        throw new TagAttributeException(_attribute, e);
+      }
+    }
+
+    private final Method       _method;
+    private final TagAttribute _attribute;
+    private       Class[]      _paramList;
+  }
    
 
   @Override
@@ -82,7 +118,11 @@
      TagAttribute attribute,
      MetadataTarget meta)
   {
-    if ((meta.getPropertyType(name) == MethodBinding.class) &&
+    Class metaType = meta.getPropertyType(name);
+    boolean isMethodBinding = (metaType == MethodBinding.class);
+    boolean isMethodExpression = (metaType == MethodExpression.class);
+
+    if ((isMethodBinding || isMethodExpression) &&
         name.endsWith("Listener"))
     {
       // OK, we're trying to call setFooListener()
@@ -110,8 +150,12 @@
           return null;
 
         // And go
-        return new ListenerPropertyMetadata(m, attribute,
-                                            new Class[]{eventClass});
+        if (isMethodBinding)
+          return new ListenerMBPropertyMetadata(m, attribute,
+                                                new Class[]{eventClass});
+        else
+          return new ListenerMEPropertyMetadata(m, attribute,
+                                                new Class[]{eventClass});
       }
     }
     return null;

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
Fri Oct 20 09:33:18 2006
@@ -17,7 +17,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;
@@ -32,7 +32,7 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+    UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       throw new JspException(

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListener.java
Fri Oct 20 09:33:18 2006
@@ -15,6 +15,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;
@@ -45,19 +47,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: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
Fri Oct 20 09:33:18 2006
@@ -17,6 +17,8 @@
 
 import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
 
+import javax.el.ValueExpression;
+
 import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.JspException;
 
@@ -35,7 +37,7 @@
  */
 public class ReturnActionListenerTag extends TagSupport
 {
-  public void setValue(String value)
+  public void setValue(ValueExpression value)
   {
     _value = value;
   }
@@ -69,21 +71,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();
@@ -96,5 +85,5 @@
     _value = null;
   }
 
-  private String _value;
+  private ValueExpression _value;
 }

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListener.java
Fri Oct 20 09:33:18 2006
@@ -15,9 +15,10 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.listener;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.StateHolder;
 import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ActionListener;
 
@@ -43,7 +44,7 @@
   static public final FacesBean.Type TYPE = new FacesBean.Type();
   static public final PropertyKey FROM_KEY =
     TYPE.registerKey("from");
-  // Must be a ValueBinding
+  // Must be a ValueExpression
   static public final PropertyKey TO_KEY =
     TYPE.registerKey("to");
 
@@ -58,23 +59,23 @@
 
   public void processAction(ActionEvent event)
   {
-    ValueBinding to = getValueBinding(TO_KEY);
+    ValueExpression to = getValueExpression(TO_KEY);
     if (to != null)
     {
-      Object from = getFrom();
+      Object from = getProperty(FROM_KEY);
       try
       {
-        to.setValue(FacesContext.getCurrentInstance(), from);
+        to.setValue(FacesContext.getCurrentInstance().getELContext(), from);
       }
       catch (RuntimeException e)
       {
         if (_LOG.isWarning())
         {
-          ValueBinding fromBinding = getValueBinding(FROM_KEY);
+          ValueExpression fromExpression = getValueExpression(FROM_KEY);
           String mes = "Error setting:'"+to.getExpressionString() +
             "' to value:"+from;
-          if (fromBinding != null)
-            mes += " from:'"+fromBinding.getExpressionString()+"'";
+          if (fromExpression != null)
+            mes += " from:'"+fromExpression.getExpressionString()+"'";
             
           _LOG.warning(mes, e);
         }
@@ -83,14 +84,20 @@
     }
   }
 
-  public Object getFrom()
+  public void setFrom(ValueExpression from)
   {
-    return getProperty(FROM_KEY);
+    if (from.isLiteralText())
+      setProperty(FROM_KEY, from.getValue(null));
+    else
+      setValueExpression(FROM_KEY, from);
   }
 
-  public void setFrom(Object from)
+  public void setTo(ValueExpression to)
   {
-    setProperty(FROM_KEY, from);
+    if (to.isLiteralText())
+      throw new IllegalArgumentException("setActionListener's 'to' must be an EL expression");
+    
+    setValueExpression(TO_KEY, to);
   }
 
   @Override

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
Fri Oct 20 09:33:18 2006
@@ -17,6 +17,8 @@
 
 import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
 
+import javax.el.ValueExpression;
+
 import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.JspException;
 
@@ -24,7 +26,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;
 
@@ -37,12 +39,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;
   }
@@ -50,7 +52,7 @@
   @Override
   public int doStartTag() throws JspException
   {
-    UIComponentTag tag = UIComponentTag.getParentUIComponentTag(pageContext);
+   UIComponentClassicTagBase tag = UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
     if (tag == null)
     {
       throw new JspException(
@@ -77,34 +79,13 @@
     SetActionListener listener = new SetActionListener();
     if (_from != null)
     {
-      if (TagUtils.isValueReference(_from))
-      {
-        String from = _from;
-        if (parentELContext != null)
-          from = parentELContext.transformExpression(from);
-
-        listener.setValueBinding(SetActionListener.FROM_KEY,
-                                 application.createValueBinding(from));
-      }
-      else
-      {
-        listener.setFrom(_from);
-      }
-
-      if (TagUtils.isValueReference(_to))
-      {
-        String to = _to;
-        if (parentELContext != null)
-          to = parentELContext.transformExpression(to);
-
-        listener.setValueBinding(SetActionListener.TO_KEY,
-                                 application.createValueBinding(to));
-      }
-      else
-      {
+      listener.setFrom(_from);
+      if (_to.isLiteralText())
         throw new JspException("setActionListener's 'to' attribute must " +
                                "be an EL expression.");
-      }
+
+      if (_to != null)
+        listener.setTo(_to);
     }
 
     ((ActionSource) component).addActionListener(listener);
@@ -120,6 +101,6 @@
     _to = null;
   }
 
-  private String _from;
-  private String _to;
+  private ValueExpression _from;
+  private ValueExpression _to;
 }

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/TagUtils.java
Fri Oct 20 09:33:18 2006
@@ -30,7 +30,6 @@
 
 import javax.faces.application.Application;
 import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
@@ -50,14 +49,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)
@@ -72,9 +63,12 @@
    * @return
    */
   public static String getString(
-    String      value)
+    Object value)
   {
-    return value;
+    if (value == null)
+      return null;
+
+    return value.toString();
   }
 
   /**
@@ -83,9 +77,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();
   }
 
   /**
@@ -94,9 +94,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();
 
   }
 
@@ -119,9 +125,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());
   }
 
   /**
@@ -130,9 +139,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());
   }
 
   /**
@@ -141,9 +156,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());
   }
 
   /**
@@ -152,21 +173,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());
   }
 
   /**
@@ -174,9 +189,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;
 
@@ -190,7 +209,7 @@
       if (!colorCode.startsWith("#"))
         throw new ParseException(
           "Color code " + colorCode + " in '" + value + "' does not start with a '#'",
-          value.indexOf(colorCode));
+          valueStr.indexOf(colorCode));
 
       //pu: Allow NumberFormatException (RTE) to propogate as is, or transform to JspException
?.
       int rgb = Integer.parseInt(colorCode.substring(1), 16);

Modified: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/VirtualAttributeUtils.java
Fri Oct 20 09:33:18 2006
@@ -15,7 +15,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;
@@ -53,14 +53,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: incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java?view=diff&rev=466189&r1=466188&r2=466189
==============================================================================
--- incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
(original)
+++ incubator/adffaces/branches/faces-1_2-second/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
Fri Oct 20 09:33:18 2006
@@ -57,7 +57,7 @@
          
       Object label = component.getAttributes().get("label");
       if ( null == label)
-       label = component.getValueBinding("label");
+       label = component.getValueExpression("label");
        
       if (value != null && value instanceof Number)
       {



Mime
View raw message