You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/08/19 22:22:08 UTC

svn commit: r987295 - /myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java

Author: lu4242
Date: Thu Aug 19 20:22:08 2010
New Revision: 987295

URL: http://svn.apache.org/viewvc?rev=987295&view=rev
Log:
TOMAHAWK-1537 t:datatable updateModelFromPreservedDataModel does not take into account vb.getType could not return the right type

Modified:
    myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java

Modified: myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java?rev=987295&r1=987294&r2=987295&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java (original)
+++ myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java Thu Aug 19 20:22:08 2010
@@ -54,6 +54,7 @@ import org.apache.myfaces.custom.sorthea
 import org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer;
 import org.apache.myfaces.renderkit.html.util.TableContext;
 import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.util.ClassUtils;
 
 /**
  * The MyFacesDataTable extends the standard JSF DataTable by two
@@ -624,12 +625,15 @@ public abstract class AbstractHtmlDataTa
         if (vb != null && !vb.isReadOnly(context))
         {
             _SerializableDataModel dm = (_SerializableDataModel) getDataModel();
-            Class type = vb.getType(context);
+            Class type = (getValueType() == null) ? 
+                    vb.getType(context) : 
+                        ClassUtils.simpleClassForName(getValueType());
+            Class dmType = dm.getClass();
             if (DataModel.class.isAssignableFrom(type))
             {
                 vb.setValue(context, dm);
             }
-            else if (List.class.isAssignableFrom(type))
+            else if (List.class.isAssignableFrom(type) || _SerializableListDataModel.class.isAssignableFrom(dmType))
             {
                 vb.setValue(context, dm.getWrappedData());
             }
@@ -1890,5 +1894,16 @@ public abstract class AbstractHtmlDataTa
      * 
      * @JSFProperty
      */
-    public abstract String getDataformatas();    
+    public abstract String getDataformatas();
+
+    /**
+     * Indicate the expected type of the EL expression pointed
+     * by value property. It is useful when vb.getType() cannot
+     * found the type, like when a map value is resolved on 
+     * the expression.
+     * 
+     * @JSFProperty
+     */
+    public abstract String getValueType(); 
+
 }