⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 column.java

📁 一个java工作流引擎
💻 JAVA
字号:
package org.jbpm.web.tag;

import java.io.*;
import javax.servlet.jsp.*;

import org.jbpm.web.tag.formatter.*;

public class Column {

	private String title = null;
	private String property = null;
	private String key = null;
	private String formatter = null;
	private CellFormatter cellFormatter = null;

	public Column(String title, String property, String key, String formatter) throws JspException {
		this.title = title;
		this.property = property;
		this.key = key;
		this.formatter = formatter;

		if (formatter != null) {
			try {
				cellFormatter = (CellFormatter) Column.class.getClassLoader().loadClass(formatter).newInstance();
			} catch (Exception e) {
				e.printStackTrace();
				throw new JspException("couldn't instantiate cellformatter '" + formatter + "' : " + e.getMessage());
			}
		} else if (property != null) {
			cellFormatter = PropertyCellFormatter.getInstance();
		} else if (key != null) {
			cellFormatter = KeyCellFormatter.getInstance();
		} else {
			throw new JspException("no formatter, property or key specified for a table-column");
		}
	}

	public void writeTitle(PageContext pageContext) throws JspException {
		JspWriter jspOut = pageContext.getOut();
		try {
			jspOut.print(title);
		} catch (IOException e) {
			e.printStackTrace();
			throw new JspException( "couldn't write title for column '" + this +"' : " + e.getMessage());
		}
	}

	public void writeCell(Object rowObject, PageContext pageContext) throws JspException {
		Object cellObject = cellFormatter.writeCell(rowObject, this, pageContext);
		if (cellObject != null) {
			JspWriter jspOut = pageContext.getOut();
			try {
				jspOut.print(cellObject.toString());
			} catch (Exception e) {
				e.printStackTrace();
				throw new JspException(
					"couldn't write cell for rowObject '" + rowObject + "', column '" + this +"' : " + e.getMessage());
			}
		}
	}

	public String getFormatter() {
		return formatter;
	}
	public String getKey() {
		return key;
	}
	public String getProperty() {
		return property;
	}
	public String getTitle() {
		return title;
	}

  public String toString() {
   return "column[" + property + "|" + key +"]"; 
  }
}

⌨️ 快捷键说明

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