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

📄 traintypemanagebean.java

📁 HR系统模拟企业对内部职员的管理
💻 JAVA
字号:
/*$Id: TrainTypeManageBean.java,v 1.1 2008/07/15 03:38:23 liqi Exp $ *-------------------------------------- * Apusic (Kingdee Middleware) *--------------------------------------- * Copyright By Apusic ,All right Reserved * author   date   comment * chenhongxin  2008-4-14  Created*/package org.operamasks.example.ejb.hr.litebean.module;import java.util.List;import java.util.UUID;import org.operamasks.example.ejb.hr.entity.TrainType;import org.operamasks.example.ejb.hr.service.ServiceBean;import org.operamasks.faces.annotation.Action;import org.operamasks.faces.annotation.Bind;import org.operamasks.faces.annotation.DataModel;import org.operamasks.faces.annotation.ManagedBean;import org.operamasks.faces.annotation.ManagedBeanScope;import org.operamasks.faces.annotation.ManagedProperty;import org.operamasks.faces.annotation.Required;import org.operamasks.faces.component.grid.impl.UIDataGrid;import org.operamasks.faces.component.layout.impl.UIWindow;/** * 培训类别管理页面的托管Bean * @author chenhongxin */@ManagedBean(name="module.trainTypeManageBean", scope=ManagedBeanScope.SESSION)public class TrainTypeManageBean extends BeforeRenderBaseBean {		/**	 * 操作记录标识	 */	private Operation curOperation = Operation.NOTHING;		/**	 * 注入服务提供Bean,该Bean提供各种的业务操作对象	 */	@ManagedProperty("#{serviceBean}")	private ServiceBean service;		/**	 * 绑定页面的DataGrid组件	 */	@Bind(id="trainTypeDataGrid", attribute="binding")	private UIDataGrid trainTypeDataGrid;	/**	 * 绑定页面的Window组件	 */	@Bind(id="detailDialog", attribute="binding")	private UIWindow detailDialog;		/**	 * 绑定明细编辑框里的培训类别名称输入域,并指定Required验证失败的提示信息	 */	@Bind(id="trainTypeName", attribute="value")	@Required(message = "#{this.getMessages().get('required')}")	private String trainTypeName;		/**	 * DataGrid绑定数据的获取	 * @return 绑定数据的List集合	 */	@DataModel(id="trainTypeDataGrid")	private List<TrainType> getTrainTypeDataGridValues() {		return service.getTrainTypeService().listTrainType();	}		/**	 * 绑定添加按钮的点击击事件	 */	@Action(id="add")	public void add() {		curOperation = Operation.ADD;		detailDialog.show();	}		/**	 * 绑定修改按钮的点击事件	 */	@Action(id="modify")	public void modify() {		TrainType selectedTrainType = (TrainType)trainTypeDataGrid.getSelectedRowData();		if(selectedTrainType != null) {			trainTypeName = selectedTrainType.getName();			curOperation = Operation.MODIFY;			detailDialog.show();		}	}		/**	 * 绑定删除按钮的点击事件	 */	@Action(id="del")	public void del() {		TrainType selectedTrainType = (TrainType)trainTypeDataGrid.getSelectedRowData();		if(selectedTrainType != null) {			service.getTrainTypeService().removeTrainType(selectedTrainType);			trainTypeDataGrid.reload();		}		curOperation = Operation.NOTHING;	}		/**	 * 绑定取消按钮的点击事件,使用immediate=true跳过数据验证	 */	@Action(id="cancel", immediate=true)	public void cancel() {		trainTypeName = "";		curOperation = Operation.NOTHING;		detailDialog.close();	}	/**	 * 绑定确定按钮的点击事件	 */	@Action(id="ok")	public void ok(){		if(curOperation == Operation.ADD) {			TrainType newOne = new TrainType();			newOne.setId(UUID.randomUUID().toString());			newOne.setName(trainTypeName);			service.getTrainTypeService().createTrainType(newOne);			trainTypeDataGrid.reload();		} else if(curOperation == Operation.MODIFY) {			TrainType selectedTrainType = (TrainType)trainTypeDataGrid.getSelectedRowData();			if(selectedTrainType != null) {				selectedTrainType.setName(trainTypeName);				service.getTrainTypeService().modifyTrainType(selectedTrainType);				trainTypeDataGrid.reload();			}		}				cancel();	}}

⌨️ 快捷键说明

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