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

📄 accounteditbean.java

📁 模拟简单的会计信息录入管理应用
💻 JAVA
字号:
/*$Id: AccountEditBean.java,v 1.1 2008/07/15 03:36:41 liqi Exp $ *-------------------------------------- * Apusic (Kingdee Middleware) *--------------------------------------- * Copyright By Apusic ,All right Reserved * author   date   comment * wanx  2008-4-7  Created */package org.operamasks.example.ejb.gl.edit;import java.util.Map;import java.util.UUID;import javax.faces.model.SelectItem;import org.operamasks.example.ejb.gl.AccountBean;import org.operamasks.example.ejb.gl.entity.AccountView;import org.operamasks.faces.annotation.Accessible;import org.operamasks.faces.annotation.Action;import org.operamasks.faces.annotation.BeforeRender;import org.operamasks.faces.annotation.Bind;import org.operamasks.faces.annotation.Label;import org.operamasks.faces.annotation.LocalString;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.annotation.SelectItems;import org.operamasks.faces.component.form.impl.UICombo;@ManagedBean(name = "accountEditBean", scope = ManagedBeanScope.REQUEST)public class AccountEditBean {	@LocalString(basename = "org.operamasks.example.ejb.gl.LocalStrings")	private Map<String, String> messages;	@Bind(id = "edit_name", attribute = "value")	@Required(message = "#{this.messages.get('name.error')}")	@Label(value = "#{this.messages.get('OutputColumn.name.header')}")	private String edit_name_value;	@Bind(id = "edit_number", attribute = "value")	@Label(value = "#{this.messages.get('OutputColumn.number.header')}")	@Required(message = "#{this.messages.get('number.error')}")	private String edit_number_value;	@Bind(id = "edit_longNumber", attribute = "value")	@Label(value = "#{this.messages.get('OutputColumn.longNumber.header')}")	@Required(message = "#{this.messages.get('number.error')}")	private String edit_longNumber_value;	@Bind(id = "edit_level", attribute = "value")	@Label(value = "#{this.messages.get('OutputColumn.level.header')}")	private Integer edit_level_value;	@Accessible	private SelectItem[] edit_isLeaf_items = {			new SelectItem("true", "#{this.messages.boolean_true}"),			new SelectItem("false", "#{this.messages.boolean_false}") };	@Bind(id = "edit_isLeaf")	@SelectItems(source = "#{this.edit_isLeaf_items}")	@Label(value = "#{this.messages.get('OutputColumn.isLeaf.header')}")	private String edit_isLeaf = "true";	@Accessible	private SelectItem[] edit_isBank_items = {			new SelectItem("true", "#{this.messages.boolean_true}"),			new SelectItem("false", "#{this.messages.boolean_false}") };	@Bind(id = "edit_isBank")	@SelectItems(source = "#{this.edit_isBank_items}")	@Label(value = "#{this.messages.get('OutputColumn.isBank.header')}")	private String edit_isBank = "true";	@ManagedProperty("#{accountBean}")	private AccountBean accountCtrl;	@Bind(id = "edit_isLeaf", attribute = "binding")	private UICombo isLeaf_binding;	@Bind(id = "edit_isBank", attribute = "binding")	private UICombo isBank_binding;	/**	 * 填充科目数据	 * 	 * @param account	 */	private void populateAccount(AccountView account) {		account				.setIsBank(Boolean						.valueOf(isBank_binding.getValue().toString()));		account				.setIsLeaf(Boolean						.valueOf(isLeaf_binding.getValue().toString()));		if (edit_level_value != null) {			account.setLevel(edit_level_value);		}		account.setLongNumber(edit_longNumber_value);		account.setName(edit_name_value);		account.setNumber(edit_number_value);	}	/**	 * 保存方法	 */	@Action(id = "save")	@Label(value = "#{this.messages.get('Button.save.label')}")	public void save() {		AccountView account = null;		if (accountCtrl.isModify()) {			account = (AccountView) accountCtrl.getAccount_grid_binding()					.getSelectedRowData();			if (account != null) {				populateAccount(account);				accountCtrl.getDao().modifyAccount(account);			}		} else {			account = new AccountView();			account.setId(UUID.randomUUID().toString());			populateAccount(account);			accountCtrl.getDao().createAccount(account);		}		accountCtrl.getAccount_grid_binding().reload();		accountCtrl.getAccount_dialog_binding().close();	}	/**	 * 关闭对话框,同时直接Render	 */	@Action(id = "close", immediate = true)	@Label(value = "#{this.messages.get('Button.close.label')}")	public void close() {		accountCtrl.getAccount_dialog_binding().close();	}	/**	 * 在弹出的编辑器页面渲染前,判断是否是修改操作,如果是,会将所选择的行填充到弹出的编辑器页面中。	 * 	 * @param isPostBack	 */	@BeforeRender	private void beforeRender(boolean isPostBack) {		if (accountCtrl.isModify()) {			AccountView account = (AccountView) accountCtrl					.getAccount_grid_binding().getSelectedRowData();			edit_name_value = account.getName();			edit_number_value = account.getNumber();			edit_longNumber_value = account.getLongNumber();			edit_level_value = account.getLevel();			isLeaf_binding.setValue(account.getIsLeaf());			isBank_binding.setValue(account.getIsBank());		}	}}

⌨️ 快捷键说明

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