column配置:
<column id="waveDoc.code" title="waveDoc.code" visible="true" width="170" horizonAlign="left" verticalAlign="middle" sortIndex="1" sortType="DESC" format="waveDocFormartter"/>
formatContext.xml配置:
<bean id="waveDocFormartter" class="com.vtradex.swms.server.action.formatter.WaveDocFormartter"></bean>
WaveDocFormartter.java
package com.vtradex.swms.server.action.formatter; import java.util.List; import com.vtradex.thorn.server.format.Formatter; import com.vtradex.thorn.server.service.pojo.DefaultBaseManager; /** * * @Description : 波次颜色改变 */ public class WaveDocFormartter extends DefaultBaseManager implements Formatter { public String format(String property, Object cellValue, List origenData, String referenceModel, String locale) { return statusData(cellValue,origenData); } @SuppressWarnings("unchecked") private String statusData(Object cellValue,List origenData){ String code = cellValue.toString(); Double orderQuantity= Double.valueOf((String)origenData.get(12)); Double allocatedQuantity= Double.valueOf((String)origenData.get(13)); if(allocatedQuantity > 0){ if(orderQuantity > allocatedQuantity){ return "<font color=\"red\" size=\"1\">"+code+"</font>"; }else if(allocatedQuantity > orderQuantity){ return "<font color=\"blue\">"+code+"</font>"; } } return code; } //LocalizedMessage.addLocalizedMessage("<font color=\"red\" size=\"2\">"+"不能激活"+"</font>"); }