teacherinfobeancollectionds.java
来自「报表,关于ireport报表的一些源码(转)」· Java 代码 · 共 84 行
JAVA
84 行
import java.util.ArrayList;
import java.util.Collection;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class TeacherInfoBeanCollectionDS{
public JRDataSource createBeanCollectionDatasource(){
return new JRBeanCollectionDataSource(createBeanCollection());
}
public ArrayList createBeanCollection(){
ArrayList reportRows = new ArrayList();
reportRows.add(new TeacherBean("李建中", 56, "教授", "学士","主任","数据库,并行计算","专"));
reportRows.add(new TeacherBean("李金宝", 37, "教授", "硕士","副任","移动计算,传感器网络","专"));
reportRows.add(new TeacherBean("张兆功", 43, "教授", "博士","","计算生物学","专"));
reportRows.add(new TeacherBean("洪海", 58, "教授", "博士","","计算机视觉","专"));
return reportRows;
}
public class TeacherBean{
public String name;
public int age;
public String position;//职称
public String lastDegree;
public String headship;//职务
public String studyDirection;// 研究方向
public String other;//专,兼职
public TeacherBean(){}
public TeacherBean(String nName,int nAge,String nPosition,String nLastDegree,String nHeadship,String nStudyDirection,String nOther){
name = nName;
age =nAge;
position=nPosition;
lastDegree = nLastDegree;
headship = nHeadship;
studyDirection = nStudyDirection;
other = nOther;
}
public void setName(String name){
this.name = name;
}
public void setAge(int age){
this.age = age;
}
public void setLastDegree(String lastDegree){
this.lastDegree = lastDegree;
}
public void setHeadship(String headship){
this.headship = headship;
}
public void setStudyDirection(String studyDirection){
this.studyDirection = studyDirection;
}
public void setPosition(String position){
this.position = position;
}
public void setOther(String other){
this.other = other;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public String getLastDegree(){
return lastDegree;
}
public String getPosition(){
return position;
}
public String getHeadship(){
return headship;
}
public String getStudyDirection(){
return studyDirection;
}
public String getOther(){
return other;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?