propertycellformatter.java

来自「一个java工作流引擎」· Java 代码 · 共 32 行

JAVA
32
字号
package org.jbpm.web.tag.formatter;

import javax.servlet.jsp.*;

import org.apache.commons.logging.*;
import org.apache.struts.taglib.tiles.util.*;
import org.jbpm.web.tag.*;

public class PropertyCellFormatter implements CellFormatter {
  
  private PropertyCellFormatter() {}
  private static final PropertyCellFormatter instance = new PropertyCellFormatter();
  public static PropertyCellFormatter getInstance() { return instance; }

	public Object writeCell(Object rowObject, Column column, PageContext pageContext) throws JspException {
    Object cellObject = null;
    try {
      String property = column.getProperty();
      
      log.debug( "writing property " + property + "' for row '" + rowObject + "'" );
      
      cellObject = TagUtils.getProperty( rowObject, property );
    } catch (Exception e) {
      e.printStackTrace();
      throw new JspException( "PropertyCellFormatter couldn't format cell for rowObject '" + rowObject + "', column '" + column + "' : " +e.getMessage() );
    }
		return cellObject;
	}

  private static Log log = LogFactory.getLog(PropertyCellFormatter.class);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?