activitypagedselection.java

来自「这是一个工作流管理的后端EJB实现」· Java 代码 · 共 96 行

JAVA
96
字号
/*
 * Created on May 13, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.coshare.joyteam.projectMgr.webbeans;

import java.util.Collection;

import com.coshare.joyteam.projectMgr.businessDelegate.DelegateException;
import com.coshare.joyteam.projectMgr.businessDelegate.WFTemplateMgrDelegate;
import com.coshare.joyteam.projectMgr.dto.ActivityDTO;
import com.coshare.joyteam.projectMgr.dto.TemplateDTO;
import com.coshare.joyteam.util.ID;

/**
 * @author Edward
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ActivityPagedSelection extends PagedSelection {

	ID id;
	/**
	 * 根据 id 生成模板的ID对象
	 * @param <code>int</code> id 模板ID中的id项
	 */
	public void setId( int id ){
		this.id = TemplateDTO.intToID(id);
	}
	
	Collection result;
	Object[] resultSet;
	/**
	 * 获得结果集,为showNext(),showPrevious(),show()等查许做准备
	 */
	public void prepareResultSet() {
		if(pageNumber==null)
			pageNumber = new PageNumber();
		
		try{
			WFTemplateMgrDelegate pd=new WFTemplateMgrDelegate();
			result= pd.getActivitiesOfT(this.id);
		}catch(DelegateException e){
			e.printStackTrace();
		
		}
		resultSet=result.toArray();
		
		pageNumber.setPageCount(resultSet.length,this.nline);
		
	}
	
	/**
	 * 将信息组织成表格
	 * @param tableStr <code>StringBuffer</code> 
	 */
	protected void organizeTable(StringBuffer tableStr ){
	   int i =(this.pageNumber.getShowPage()-1)*this.pageNumber.getPageSize();	
	   int increment=Math.min(this.getNline(),this.pageNumber.getRowCount()-i);
	   int top=i+increment;
	   
	   tableStr.append("<TR >");
	   tableStr.append("<TD >"+"活动ID"+"</TD>");
	   tableStr.append("<TD >"+"活动名"+"</TD>");
	   tableStr.append("<TD >"+"描述"+"</TD>");
	   tableStr.append("<TD >"+"活动类型"+"</TD>");
	   tableStr.append("</TR>");
	   
	   for(int j=i;j<top;j++){
	   	  ActivityDTO tmpDto=(ActivityDTO)resultSet[j];
	   	  int type= tmpDto.getActivityType();
	   	  String activityType;
	   	  switch(type){
	   	  	case 1: activityType = "一般活动"; break;
	   	  	case 2: activityType = "开始结点"; break;
		   	case 3: activityType = "结束结点"; break;
		   	case 4: activityType = "同步结点"; break;
		   	case 5: activityType = "或结点 "; break;
		   	case 6: activityType = "子活动"; break;
		   	case 7: activityType = "系统活动"; break;
		   	default : activityType = "未定义活动"; break;
	   	  }
	   	  
	   	  tableStr.append("<TR >");
	   	  tableStr.append("<TD >"+tmpDto.getActivityId().getId()+"</TD>");
	   	  tableStr.append("<TD >"+tmpDto.getActivityName()+"</TD>");
	   	  tableStr.append("<TD >"+tmpDto.getTheDescription()+"</TD>");
	   	  tableStr.append("<TD >"+activityType+"</TD>");
	   	  tableStr.append("</TR>");
	   }  
	}
}

⌨️ 快捷键说明

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