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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
package com.vci.client.framework.systemConfig.stafforgmanage;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
 
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
 
import com.vci.client.LogonApplication;
import com.vci.client.common.TransmitTreeObject;
import com.vci.client.common.objects.DeptObject;
import com.vci.client.logon.base.BaseJDialog;
import com.vci.client.ui.image.BundleImage;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.KJButton;
import com.vci.client.ui.swing.KTextField;
/**
 * <p>Title:部门添加修改界面 </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2012</p>
 * <p>Company: VCI</p>
 * @author wangxl
 * @time 2012-5-14
 * @version 1.0
 */
public class DeptDialog extends BaseJDialog {
 
    private static final long serialVersionUID = 1L;
    private TransmitTreeObject transmitTreeObject;
    private DeptTablePanel deptPanel ;
    private DeptObject deptObj;
    private DeptObject parentDeptObj;
    private String optType;
    
    private JLabel nameLabel = new JLabel(LocaleDisplay.getI18nString("rmip.stafforg.logal.name", "RMIPFramework", getLocale()));   
    private JLabel numLabel = new JLabel("编号:");
    private JLabel codeLabel = new JLabel("代号:");
    private JLabel labelSpecialties = new JLabel("专业:");
    private JLabel descriptionLabel = new JLabel(LocaleDisplay.getI18nString("rmip.stafforg.logal.desc", "RMIPFramework", getLocale()));
    KTextField nameText = new KTextField();
    JTextField numText = new JTextField();
    JTextField codeText = new JTextField();
    JTextField textSpecialties = new JTextField();
    JTextArea descriptionArea = new JTextArea();
    JTextField jTextField1 = new JTextField();//instead of up line
    JTextField jTextField2 = new JTextField();//instead of down line
    private KJButton conformButton = new KJButton(LocaleDisplay.getI18nString("rmip.framework.button.confirm", "RMIPFramework", getLocale()), "bullet_blue.png");
    private KJButton cancelButton = new KJButton(LocaleDisplay.getI18nString("rmip.framework.button.cancel", "RMIPFramework", getLocale()) , "bullet_delete.png");
    
    public DeptDialog(DeptTablePanel deptPanel , DeptObject parentDeptObj, String optType){
        super(LogonApplication.frame);
        this.setModal(true);
        this.deptPanel = deptPanel;
        this.parentDeptObj = parentDeptObj;
        this.optType = optType;
        init();
    }
    public DeptDialog(DeptTablePanel deptPanel , DeptObject parentDeptObj, DeptObject deptObj, String optType){
        super(LogonApplication.frame);
        this.setModal(true);
        this.deptPanel = deptPanel;
        this.parentDeptObj = parentDeptObj;
        this.deptObj = deptObj;
        this.optType = optType;
        init();
    }
    
    /**
     * 初始化界面 
     */
    public void  init (){
         JLabel titleLabel = new JLabel();
         titleLabel.setText("部门");
         titleLabel.setIcon(new BundleImage().createImageIcon ("book.png"));
        
         JPanel bottomPanel = new JPanel();
         bottomPanel.add(conformButton);
         bottomPanel.add(cancelButton);
         
         JPanel contentPanel = initCenterContentPanel();
         
         JPanel midPanel = new JPanel();
         midPanel.setLayout(new BorderLayout());
         JTextField jTextField1 = new JTextField();//instead of up line
         JTextField jTextField2 = new JTextField();//instead of down line
         jTextField1.setPreferredSize(new Dimension(80,2));
         jTextField2.setPreferredSize(new Dimension(80,2));
         midPanel.add(jTextField1, BorderLayout.NORTH);
         midPanel.add(jTextField2, BorderLayout.SOUTH);
         midPanel.add(contentPanel, BorderLayout.CENTER);
         
         this.setLayout(new BorderLayout());
         this.add(titleLabel, BorderLayout.NORTH);
         this.add(midPanel, BorderLayout.CENTER);
         this.add(bottomPanel, BorderLayout.SOUTH); 
//         int x = (int)(this.getParent().getLocationOnScreen().getX()) +500;
//         int y = (int)(this.getParent().getLocationOnScreen().getY()) +200;
//         this.setLocation(x , y);
//         this.setSize(400, 400);
         initDialogSize(410, 330);
         this.setVisible(true);
    }
    
    private JPanel initCenterContentPanel() {
        JPanel contentPanel = new JPanel();
        contentPanel.setLayout(null);
        
        nameLabel.setBounds(new Rectangle(40,10,80,25));
        nameText.setBounds(new Rectangle(85,10,300,25));
        
        numLabel.setBounds(new Rectangle(40,40,80,25));
        numText.setBounds(new Rectangle(85,40,300,25));
        
        codeLabel.setBounds(new Rectangle(40,70,80,25));
        codeText.setBounds(new Rectangle(85,70,300,25));
        
        labelSpecialties.setBounds(new Rectangle(40,100,80,25));
        textSpecialties.setBounds(new Rectangle(85,100,300,25));
        
        JScrollPane jsDescription=new JScrollPane();
        descriptionLabel.setBounds(new Rectangle(40,130,80,25));
        jsDescription.setBounds(new Rectangle(85,130,300,100));    
        contentPanel.add(descriptionLabel);
        contentPanel.add(jsDescription);
        
       
        descriptionArea.setLineWrap(true);
        jsDescription.getViewport().add(descriptionArea);
        jTextField1.setPreferredSize(new Dimension(60,2));
         jTextField2.setPreferredSize(new Dimension(60,2));
         
        contentPanel.setLayout(null);
        contentPanel.add(nameLabel);
        contentPanel.add(nameText);
        
        contentPanel.add(numLabel);
        contentPanel.add(numText);
        
        contentPanel.add(codeLabel);
        contentPanel.add(codeText);
        
        contentPanel.add(labelSpecialties);
        contentPanel.add(textSpecialties);
        
        contentPanel.add(descriptionLabel);
        contentPanel.add(jsDescription);
        conformButton.addActionListener(new CommenListener(this, deptPanel ,optType , parentDeptObj, deptObj));
            
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                cancelButton_ActionPerformed(e);
            }
        });
        
        
        initContent();
        return contentPanel;
    }
    private void initContent(){
        if (deptObj != null){
            this.nameText.setText(deptObj.getName());
            this.numText.setText(deptObj.getNum());
            this.codeText.setText(deptObj.getCode());
            this.textSpecialties.setText(deptObj.getSpecialties());
            this.descriptionArea.setText(deptObj.getDescription());
        }
    }
    /**
     * 取消按钮事件
     * @param e
     */
    private void cancelButton_ActionPerformed(ActionEvent e) {
        this.dispose();
    }
    
    /**
     * 获取名称 
     * @return
     */
    public String getNameText(){
        return this.nameText.getText().trim();
    }
    
    /**
     * <p>Description:获取编号 </p>
     * 
     * @author wangxl
     * @time 2012-5-15
     * @return
     */
    public String getNumText(){
        return this.numText.getText().trim();
    }
    
    /**
     * <p>Description:获取部门代码 </p>
     * 
     * @author wangxl
     * @time 2012-5-15
     * @return
     */
    public String getCodeText(){
        return this.codeText.getText().trim();
    }
    
    /**
     * 获取专业 
     * @return
     */
    public String getSpecialtiesText(){
        return this.textSpecialties.getText().trim();
    }
    
    /**
     * 获取描述
     * @return
     */
    public String getDescriptionArea() {
        return descriptionArea.getText().trim();
    }
    
    /**
     * 获取树节点
     * @return
     */
    public TransmitTreeObject getTransmitTreeObject() {
        return transmitTreeObject;
    }
}