[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...

Gavin King gavin.king at jboss.com
Mon Jul 24 19:54:30 EDT 2006


  User: gavin   
  Date: 06/07/24 19:54:30

  Modified:    src/main/org/jboss/seam  Component.java
  Log:
  ooops, bad class.forname
  support configgable properties of type ValueBinding
  
  Revision  Changes    Path
  1.149     +22 -8     jboss-seam/src/main/org/jboss/seam/Component.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Component.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
  retrieving revision 1.148
  retrieving revision 1.149
  diff -u -b -r1.148 -r1.149
  --- Component.java	24 Jul 2006 00:40:44 -0000	1.148
  +++ Component.java	24 Jul 2006 23:54:30 -0000	1.149
  @@ -28,6 +28,7 @@
   import javax.faces.application.Application;
   import javax.faces.context.FacesContext;
   import javax.faces.convert.Converter;
  +import javax.faces.el.ValueBinding;
   import javax.interceptor.Interceptors;
   import javax.servlet.ServletRequest;
   
  @@ -86,7 +87,7 @@
    *
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author Gavin King
  - * @version $Revision: 1.148 $
  + * @version $Revision: 1.149 $
    */
   @Scope(ScopeType.APPLICATION)
   public class Component
  @@ -804,11 +805,13 @@
   
         for ( Map.Entry<Method, InitialValue> me: initializerSetters.entrySet() )
         {
  -         setPropertyValue(bean, me.getKey(), me.getKey().getName(), me.getValue().getValue() );
  +         Method method = me.getKey();
  +         setPropertyValue(bean, method, method.getName(), me.getValue().getValue( method.getParameterTypes()[0] ) );
         }
         for ( Map.Entry<Field, InitialValue> me: initializerFields.entrySet() )
         {
  -         setFieldValue(bean, me.getKey(), me.getKey().getName(), me.getValue().getValue() );
  +         Field field = me.getKey();
  +         setFieldValue(bean, field, field.getName(), me.getValue().getValue( field.getType() ) );
         }
      }
   
  @@ -1548,7 +1551,7 @@
      
      public static interface InitialValue
      {
  -      Object getValue();
  +      Object getValue(Class type);
      }
      
      public static class ConstantInitialValue implements InitialValue
  @@ -1560,7 +1563,7 @@
            this.value = value;
         }
   
  -      public Object getValue()
  +      public Object getValue(Class type)
         {
            return value;
         }
  @@ -1583,11 +1586,22 @@
            //vb = FacesContext.getCurrentInstance().getApplication().createValueBinding(expression);
         }
   
  -      public Object getValue()
  +      public Object getValue(Class type)
  +      {
  +         if ( type.equals(ValueBinding.class) )
  +         {
  +            return createValueBinding();
  +         }
  +         else
  +         {
  +            return createValueBinding().getValue( FacesContext.getCurrentInstance() );
  +         }
  +      }
  +
  +      private ValueBinding createValueBinding()
         {
            return FacesContext.getCurrentInstance().getApplication()
  -               .createValueBinding(expression)
  -               .getValue( FacesContext.getCurrentInstance() );
  +               .createValueBinding(expression);
         }
         
         public String toString()
  
  
  



More information about the jboss-cvs-commits mailing list