/** *

Title:

*

Description:

*

Copyright: Copyright (C) 2011

*

Company: VCI

* @author Bear * @time 2011-7-29 * @version 1.0 */ package com.vci.client.framework.systemConfig.stafforgmanage; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JLabel; import javax.swing.JPanel; import com.vci.client.LogonApplication; import com.vci.client.common.objects.DeptObject; import com.vci.client.common.objects.RoleObject; import com.vci.client.framework.util.ClientHelper; import com.vci.client.logon.base.BaseJDialog; import com.vci.client.ui.swing.KJButton; public class DisplayDialog extends BaseJDialog { /** * */ private static final long serialVersionUID = -5065519451170218837L; private KJButton btnCancel = new KJButton("关闭", "cancel.gif", null, "btnCancel"); private DisplayTablePanel templateExpTablePanel = null; private DeptObject[] departObjects; private RoleObject[] roleObjs; private JLabel numLable = new JLabel(); public DisplayDialog(DeptObject[] departObjects){ super(LogonApplication.frame, true); this.departObjects = departObjects; init(); } public DisplayDialog(RoleObject[] roleObjs){ super(LogonApplication.frame, true); this.roleObjs = roleObjs; init(); } private void init(){ initSizeAndLocation(); initControl(); } private void initSizeAndLocation(){ // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // setLocation((screenSize.width - 400) / 2, (screenSize.height - 460) / 2); // setSize(600, 400); initDialogSize(600, 400); setTitle("人员信息"); } private void initControl(){ setLayout(new BorderLayout()); templateExpTablePanel = new DisplayTablePanel(); JPanel panel = new JPanel(); add(panel,BorderLayout.NORTH); add(templateExpTablePanel, BorderLayout.CENTER); JPanel palBtn = new JPanel(); palBtn.add(btnCancel); palBtn.add(numLable); add(palBtn, BorderLayout.SOUTH); initActionListener(); //load数据 loadUserInfo(); } public void loadUserInfo() { if (departObjects != null){ for (int i = 0 ; i < departObjects.length ; i ++){ String id = departObjects[i].getId() == null ? "root" : departObjects[i].getId(); String type = "dept"; String info = "该部门下人员总数:"; String roleName = ""; int count = this.templateExpTablePanel.reloadUserCompList(id,type,roleName); numLable.setText(info+count); } }else if (roleObjs != null){ for (int i = 0 ; i < roleObjs.length ; i ++){ String id = roleObjs[i].getId(); String type = "role"; String info = "该角色下人员总数:"; String roleName = roleObjs[i].getName(); int count = this.templateExpTablePanel.reloadUserCompList(id,type,roleName); numLable.setText(info+count); } } } private void initActionListener(){ btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); } public String getI18nString(String spCode){ return ClientHelper.getI18nStringForFramework(this.getClass().getName() + "." + spCode, this.getLocale()); } }