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.bundle.BundleImage; import com.vci.client.ui.locale.LocaleDisplay; import com.vci.client.ui.swing.KJButton; import com.vci.client.ui.swing.KTextField; /** *

Title:部门添加修改界面

*

Description:

*

Copyright: Copyright (c) 2012

*

Company: VCI

* @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(); } /** *

Description:获取编号

* * @author wangxl * @time 2012-5-15 * @return */ public String getNumText(){ return this.numText.getText().trim(); } /** *

Description:获取部门代码

* * @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; } }