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.objects.RoleObject;
|
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-11
|
* @version 1.0
|
*/
|
public class RoleDialog extends BaseJDialog {
|
|
private static final long serialVersionUID = 1L;
|
private RoleTablePanel rolePanel ;
|
private RoleObject roleObj;
|
private String optType;
|
|
private JLabel nameLabel = new JLabel(LocaleDisplay.getI18nString("rmip.stafforg.logal.name", "RMIPFramework", getLocale()));
|
private JLabel descriptionLabel = new JLabel(LocaleDisplay.getI18nString("rmip.stafforg.logal.desc", "RMIPFramework", getLocale()));
|
KTextField nameText = new KTextField();
|
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 RoleDialog(RoleTablePanel rolePanel , String optType){
|
super(LogonApplication.frame);
|
this.setModal(true);
|
this.rolePanel = rolePanel;
|
this.optType = optType;
|
init();
|
}
|
public RoleDialog(RoleTablePanel rolePanel , RoleObject roleObj, String optType){
|
super(LogonApplication.frame);
|
this.setModal(true);
|
this.rolePanel = rolePanel;
|
this.roleObj = roleObj;
|
this.optType = optType;
|
init();
|
}
|
|
/**
|
* 初始化界面
|
*/
|
public void init (){
|
JLabel titleLabel = new JLabel();
|
titleLabel.setText("角色");
|
titleLabel.setIcon(new BundleImage().createImageIcon ("star.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(63,2));
|
jTextField2.setPreferredSize(new Dimension(63,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);
|
initDialogSize(400, 400);
|
this.setVisible(true);
|
}
|
|
private JPanel initCenterContentPanel() {
|
JPanel contentPanel = new JPanel();
|
contentPanel.setLayout(null);
|
JScrollPane jsDescription=new JScrollPane();
|
descriptionLabel.setBounds(new Rectangle(60,110,100,25));
|
jsDescription.setBounds(new Rectangle(95,110,200,100));
|
|
|
contentPanel.add(descriptionLabel);
|
contentPanel.add(jsDescription);
|
nameLabel.setBounds(new Rectangle(60,30,100,25));
|
nameText.setBounds(new Rectangle(95,30,200,25));
|
|
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);
|
|
descriptionLabel.setBounds(new Rectangle(60,70,100,25));
|
jsDescription.setBounds(new Rectangle(95,70,200,100));
|
contentPanel.add(descriptionLabel);
|
contentPanel.add(jsDescription);
|
conformButton.addActionListener(new CommenListener(this, rolePanel ,optType , roleObj));
|
|
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
cancelButton_ActionPerformed(e);
|
}
|
});
|
initContent();
|
return contentPanel;
|
}
|
private void initContent(){
|
if (roleObj != null){
|
nameText.setText(roleObj.getName());
|
descriptionArea.setText(roleObj.getDescription());
|
}
|
}
|
/**
|
* 取消按钮事件
|
* @param e
|
*/
|
private void cancelButton_ActionPerformed(ActionEvent e) {
|
this.dispose();
|
}
|
|
/**
|
* 获取名称
|
* @return
|
*/
|
public String getNameText(){
|
return this.nameText.getText().trim();
|
}
|
/**
|
* 获取描述
|
* @return
|
*/
|
public String getDescriptionArea() {
|
return descriptionArea.getText().trim();
|
}
|
}
|