📄 checkbean.java
字号:
package cn.handson.managedBean;
import java.util.Iterator;
import java.util.List;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import cn.handson.base.Construct;
import cn.handson.base.Depart;
import cn.handson.base.Employee;
import cn.handson.dao.ConstructDao;
import cn.handson.dao.EmployeeDao;
public class CheckBean {
private DataModel tasks;
private Construct currentTask;
private String eachDate;
private ConstructDao conDao;
private EmployeeDao empDao;
private SelectItem[] emps;
private Object emp;
private int firstRowIndex=0;
private int rows=6;
public CheckBean() {
conDao=new ConstructDao();
tasks=new ListDataModel();
empDao=new EmployeeDao();
tasks.setWrappedData(conDao.getAllByemplyee());
//-----------初始化施工人员列表框---------------
List allEmps=empDao.loadAll();
int size=allEmps.size();
emps=new SelectItem[size];
Iterator iter=allEmps.iterator();
for(int i=0;i<emps.length;i++){
Employee temp=(Employee)iter.next();
emps[i]=new SelectItem(temp.getEmployeeId().toString(), temp.getEmployeeName());
}
// TODO Auto-generated constructor stub
}
public ConstructDao getConDao() {
return conDao;
}
public void setConDao(ConstructDao conDao) {
this.conDao = conDao;
}
public Object getEmp() {
if(currentTask!=null&¤tTask.getEmployee()!=null)
emp=currentTask.getEmployee().getEmployeeId().toString();
return emp;
}
public void setEmp(Object emp) {
this.emp = emp;
}
public SelectItem[] getEmps() {
return emps;
}
public void setEmps(SelectItem[] emps) {
this.emps = emps;
}
public Construct getCurrentTask() {
return currentTask;
}
public void setCurrentTask(Construct currentTask) {
this.currentTask = currentTask;
}
public DataModel getTasks() {
return tasks;
}
public void setTasks(DataModel tasks) {
this.tasks = tasks;
}
public int getFirstRowIndex() {
return firstRowIndex;
}
public void setFirstRowIndex(int firstRowIndex) {
this.firstRowIndex = firstRowIndex;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public String getEachDate() {
eachDate=((Construct)tasks.getRowData()).getConstDate().toString().substring(0, 10);
return eachDate;
}
public void setEachDate(String eachDate) {
this.eachDate = eachDate;
}
//施工申核
public String check(){
System.out.println("aaa");
currentTask=(Construct)tasks.getRowData();
this.currentTask=conDao.getConstructById(currentTask.getConstId());
return "checkInfo";
}
/*
* 审核通过
*/
public String passCheck(){
Employee conEmp=empDao.getEmployeeById(new Integer(emp.toString()));
currentTask.setEmployee(conEmp);
currentTask.setConstOver(new Integer(1));
conDao.update(currentTask);
tasks.setWrappedData(conDao.getAllByemplyee());
return "check";
}
// 首页响应事件
public void scrollFirst() {
firstRowIndex = 0;
}
//上一页响应事件
public void scrollPrevious() {
firstRowIndex -= rows;
if(firstRowIndex<0){
firstRowIndex=0;
}
}
//下一页响应事件
public void scrollNext() {
firstRowIndex += rows;
}
//尾页响应事件
public void scrollLast() {
firstRowIndex = getTasks().getRowCount() - rows;
}
public boolean isScrollFirstAbled() {
return firstRowIndex != 0;
}
public boolean isScrollPreviousAbled() {
return firstRowIndex != 0;
}
public boolean isScrollNextAbled() {
return firstRowIndex+rows < getTasks().getRowCount();
}
public boolean isScrollLastAbled() {
return firstRowIndex+rows < getTasks().getRowCount();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -