You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/02/25 14:50:23 UTC

svn commit: r630851 - in /myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm: annot/ui/DataProvider.java guiBuilder/impl/jsf/JsfGuiBuilder.java

Author: skitching
Date: Mon Feb 25 05:50:20 2008
New Revision: 630851

URL: http://svn.apache.org/viewvc?rev=630851&view=rev
Log:
Change DataProvider annotation from using converterId to converterBean.

Modified:
    myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java
    myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java

Modified: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java?rev=630851&r1=630850&r2=630851&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java (original)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java Mon Feb 25 05:50:20 2008
@@ -24,24 +24,30 @@
 import java.lang.annotation.Target;
 
 /**
- * where to get the data for a relation between entities
+ * Where to get the data for a relation between entities.
+ * <p>
+ * This annotation can be added to the declaration of a property of a 
+ * persistent entity in order to ???
+ * <p>
+ * TODO: this class is very jsf-specific, but is not under a jsf package.
  */
 @Target(value = {ElementType.METHOD, ElementType.FIELD})
 @Retention(value = RetentionPolicy.RUNTIME)
 public @interface DataProvider
 {
 	/**
-	 * points to a method returning a list
+	 * An EL expression which evaluates to a list of objects of the same type
+	 * as the annotated property.
 	 */
 	public String value();
 
 	/**
-	 * the properties to use as description. This can be a JSF value-binding.
+	 * The properties to use as description.
 	 */
 	public String description();
 
 	/**
-	 * A converter to use to convert the object from/to a string value
+	 * A converter to use to convert the object from/to a string value.
 	 */
-	public String converterId() default "";
+	public String converterBean() default "";
 }

Modified: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java?rev=630851&r1=630850&r2=630851&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java (original)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java Mon Feb 25 05:50:20 2008
@@ -56,6 +56,7 @@
 import javax.faces.convert.NumberConverter;
 import javax.faces.convert.ShortConverter;
 import javax.faces.el.MethodBinding;
+import javax.faces.el.VariableResolver;
 import javax.faces.validator.DoubleRangeValidator;
 import javax.faces.validator.LengthValidator;
 import java.math.BigDecimal;
@@ -357,9 +358,17 @@
 		{
 			return context.getApplication().createConverter(field.getConverterClass());
 		}
+
 		if (field.getConverterId() != null)
 		{
 			return context.getApplication().createConverter(field.getConverterId());
+		}
+
+		if (field.getConverterBean() != null)
+		{
+			String beanName = field.getConverterBean();
+			VariableResolver vr =  context.getApplication().getVariableResolver();
+			return (Converter) vr.resolveVariable(context, beanName);
 		}
 
 		Class type = field.getType();