Author: julien_viet
Date: 2010-07-22 13:01:42 -0400 (Thu, 22 Jul 2010)
New Revision: 3687
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
Log:
should have reverted that as well
Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-07-22
14:02:31 UTC (rev 3686)
+++ portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-07-22
17:01:42 UTC (rev 3687)
@@ -1,6 +1,8 @@
<%
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.form.UIForm;
+ import java.text.DateFormat;
+ import java.text.SimpleDateFormat;
String[] beanFields = uicomponent.getBeanFields();
String[] beanActions = uicomponent.getBeanActions();
@@ -64,9 +66,22 @@
<%
for (field in beanFields)
{
- def fieldValue = uicomponent.getFieldValue(bean, field);
- def renderer = uicomponent.getRendererFor(fieldValue);
- println "<td><div class=\"" +
renderer.getCSSClassFor(fieldValue) + "\" title='$fieldValue'>"
+ renderer.render(fieldValue, _ctx) + "</div></td>";
+ def fieldValue = uicomponent.getFieldValue(bean, field);
+ def cssClass = "";
+ if(fieldValue != null) {
+ def fieldClass = fieldValue.getClass();
+ if(fieldClass == Integer.class) cssClass = "number";
+ else if(java.util.Date.class.isAssignableFrom(fieldClass)) {
+ if(dateFormat == null) dateFormat = new
SimpleDateFormat("HH:mm:ss yyyy-MM-dd");
+ cssClass = "Datetime";
+ fieldValue = dateFormat.format(fieldValue);
+ }
+ else cssClass = "Text";
+ } else {
+ fieldValue = "";
+ }
+ String value = fieldValue.toString();
+ println "<td><div
class=\""+cssClass+"\"
title='$fieldValue'>"+fieldValue+"</div></td>";
}
if (beanActions != null && beanActions.length > 0)
{