ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
 * <p>Title:</p>
 * <p>Description:</p>
 * <p>Copyright: Copyright (C) 2011 </p>
 * <p>Company: VCI </p>
 * @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());
    }
    
}