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

📄 usermgrlistui.java

📁 《j2ee开发全程实录》随书源码
💻 JAVA
字号:
package com.cownew.PIS.base.permission.client;

import java.awt.event.ActionEvent;

import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JToolBar;

import com.cownew.PIS.base.permission.common.IUserDAO;
import com.cownew.PIS.base.permission.common.UserInfo;
import com.cownew.PIS.framework.client.RemoteServiceLocator;
import com.cownew.PIS.framework.common.IValueObject;
import com.cownew.PIS.framework.common.db.Selectors;

import com.cownew.PIS.ui.commonUI.ListUI;
import com.cownew.PIS.ui.ctrl.query.QueryColumnProperty;
import com.cownew.PIS.ui.ctrl.query.QueryColumnPropertyList;
import com.cownew.PIS.ui.ctrl.query.QueryExecutor;
import com.cownew.PIS.ui.utils.PISAbstractAction;
import com.cownew.PIS.ui.utils.UIUtils;
import com.cownew.ctk.ui.swing.MsgBox;

public class UserMgrListUI extends ListUI
{

	private static final long serialVersionUID = 1L;

	
	protected ActionChangePassword actionChangePwd;
	protected ActionFreeze actionFreeze;
	protected ActionUnFreeze actionUnFreeze;
	
	public UserMgrListUI() throws Exception
	{
		super();
	}

	protected void initAction()
	{
		super.initAction();
		actionFilter.setEnabled(false);
		actionChangePwd = new ActionChangePassword("修改密码");
		actionFreeze = new ActionFreeze("冻结");
		actionUnFreeze = new ActionUnFreeze("解冻");
	}
	
	protected void initToolBar(JToolBar tBar)
	{
		super.initToolBar(tBar);
		JButton btnChangePwd = new JButton();
		btnChangePwd.setAction(actionChangePwd);
		tBar.add(btnChangePwd);
		
		JButton btnFreeze = new JButton();
		btnFreeze.setAction(actionFreeze);
		tBar.add(btnFreeze);
		
		JButton btnunfButton = new JButton();
		btnunfButton.setAction(actionUnFreeze);
		tBar.add(btnunfButton);
	}

	public Class getEditUIClass()
	{
		return UserMgrEditUI.class;
	}

	public Class getServiceIntfClass()
	{
		return IUserDAO.class;
	}


	public IValueObject generateNewVO()
	{
		UserInfo userInfo = new UserInfo();
		userInfo.setIsSuperAdmin(false);
		userInfo.setIsFreezed(false);
		userInfo.setPassword("");
		return userInfo;
	}
	
	
	protected QueryExecutor getQueryExecutor() 
	{
		QueryExecutor qe = super.getQueryExecutor();
		//只显示非系统预设超级管理员,预设超级管理员直接在数据库中维护
		qe.setOQL("from "+UserInfo.class.getName()+" where isSuperAdmin=false");
		QueryColumnPropertyList columnList = new QueryColumnPropertyList();
		columnList.add(new QueryColumnProperty("id",false));
		columnList.add(new QueryColumnProperty("number","帐号"));
		columnList.add(new QueryColumnProperty("person.name","对应人员"));
		columnList.add(new QueryColumnProperty("isFreezed","是否冻结"));
		qe.setColumnList(columnList );
		
		Selectors selectors = new Selectors();
		selectors.add("person");
		qe.setSelectors(selectors);
		return qe;
	}

	protected void actionChangePassword_actionPerformed(ActionEvent e)
			throws Exception
	{
		UIUtils.checkSelected(getTableMain());

		String pwd = MsgBox.showInput(this, "请输入要设定的密码");
		if (pwd == null)
		{
			return;
		}

		IUserDAO userDAO = (IUserDAO) RemoteServiceLocator
				.getRemoteService(getServiceIntfClass());
		userDAO.changePassword(getSelectedId(), pwd);
		refreshData();
	}	
	
	protected void actionUnFreeze_actionPerformed(ActionEvent e) throws Exception
	{
		UIUtils.checkSelected(getTableMain());
		IUserDAO userDAO = (IUserDAO) RemoteServiceLocator
		.getRemoteService(getServiceIntfClass());
		userDAO.unFreeze(getSelectedId());
		MsgBox.showInfo(this,"解冻成功!");
		refreshData();
	}

	protected void actionFreeze_actionPerformed(ActionEvent e) throws Exception
	{
		UIUtils.checkSelected(getTableMain());
		IUserDAO userDAO = (IUserDAO) RemoteServiceLocator
		.getRemoteService(getServiceIntfClass());
		userDAO.freeze(getSelectedId());
		MsgBox.showInfo(this,"冻结成功!");
		refreshData();
	}

	protected class ActionChangePassword extends PISAbstractAction
	{

		public ActionChangePassword(String name, Icon icon)
		{
			super(name, icon);			
		}

		public ActionChangePassword(String name)
		{
			super(name);			
		}

		public void onActionPerformed(ActionEvent e) throws Exception
		{
			actionChangePassword_actionPerformed(e);
		}
		
	}
	
	protected class ActionFreeze extends PISAbstractAction
	{

		public ActionFreeze(String name, Icon icon)
		{
			super(name, icon);			
		}

		public ActionFreeze(String name)
		{
			super(name);			
		}

		public void onActionPerformed(ActionEvent e) throws Exception
		{
			actionFreeze_actionPerformed(e);
		}
		
	}
	
	protected class ActionUnFreeze extends PISAbstractAction
	{

		public ActionUnFreeze(String name, Icon icon)
		{
			super(name, icon);			
		}

		public ActionUnFreeze(String name)
		{
			super(name);			
		}

		public void onActionPerformed(ActionEvent e) throws Exception
		{
			actionUnFreeze_actionPerformed(e);
		}
		
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"

⌨️ 快捷键说明

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