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:18 UTC
svn commit: r987296 -
/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
Author: lu4242
Date: Thu Aug 19 20:22:18 2010
New Revision: 987296
URL: http://svn.apache.org/viewvc?rev=987296&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/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java?rev=987296&r1=987295&r2=987296&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java (original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java Thu Aug 19 20:22:18 2010
@@ -19,16 +19,13 @@
package org.apache.myfaces.component.html.ext;
import java.io.IOException;
-import java.io.Serializable;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.StringTokenizer;
import javax.el.ValueExpression;
@@ -36,7 +33,6 @@ import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.component.ContextCallback;
import javax.faces.component.EditableValueHolder;
-import javax.faces.component.StateHolder;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
@@ -62,6 +58,7 @@ import org.apache.myfaces.custom.crossta
import org.apache.myfaces.custom.sortheader.HtmlCommandSortHeader;
import org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer;
import org.apache.myfaces.renderkit.html.util.TableContext;
+import org.apache.myfaces.shared_tomahawk.util.ClassUtils;
/**
* The MyFacesDataTable extends the standard JSF DataTable by two
@@ -915,12 +912,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());
}
@@ -2175,7 +2175,17 @@ public abstract class AbstractHtmlDataTa
*/
@JSFProperty
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();
+
protected enum PropertyKeys
{
preservedDataModel