📄 teacherinfobeancollectionds.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -