想要list中的N在列中显示为报废,Y->良好.....
写Java类:
package com.gecs.feeder;
import org.apache.commons.lang.StringUtils;
import org.extremecomponents.table.bean.Column;
import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.intercept.InterceptColumn;
public class YNRIntercept implements InterceptColumn
{
public void addColumnAttributes(TableModel arg0, Column arg1)
{ }
public void modifyColumnAttributes(TableModel arg0, Column arg1)
{
// TODO Auto-generated method stub
String career = arg1.getPropertyValueAsString();
if(StringUtils.contains(career, "Y"))
{
arg1.setValue("良好");
}
if(StringUtils.contains(career, "N"))
{
arg1.setValue("報廢");
}
if(StringUtils.contains(career, "R"))
{
arg1.setValue("維修");
}
}
}
---------------------------------------------------------------
这样使用就OK了
<ec:column property="OKORNG" title="狀態" intercept="com.gecs.feeder.YNRIntercept"></ec:column>
另改变字体样式了可以这样:
String career = column.getPropertyValueAsString();
if (StringUtils.contains(career, "xxxxx")) {
column.setStyle("color:#e75a08;font-weight:bold;");
} else {
column.setStyle("color:black");
}