package com.vci.client.framework.appConfig;
|
|
import java.awt.BorderLayout;
|
import java.awt.Dimension;
|
import java.awt.Frame;
|
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.framework.appConfig.object.AppConfigCategoryObject;
|
import com.vci.client.logon.base.BaseJDialog;
|
import com.vci.client.ui.locale.LocaleDisplay;
|
import com.vci.client.ui.swing.KJButton;
|
import com.vci.client.ui.swing.KTextField;
|
|
public class AppConfigCategoryDialog extends BaseJDialog {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 8160118768668294558L;
|
private AppConfigCategoryPanel panel = null;
|
private AppConfigCategoryObject obj = null;
|
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");
|
private KTextField nameField;
|
private JTextArea descriptionArea;
|
|
public AppConfigCategoryDialog(Frame frame, AppConfigCategoryPanel panel, AppConfigCategoryObject obj) {
|
super(frame);
|
this.setModal(true);
|
this.panel = panel;
|
this.obj = obj;
|
init();
|
}
|
|
private void init() {
|
JLabel titleLabel = new JLabel();
|
titleLabel.setText("配置项分类");
|
|
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);
|
//this.setSize(new Dimension(430, 380));
|
initDialogSize(430, 380);
|
this.setVisible(true);
|
}
|
|
private JPanel initCenterContentPanel() {
|
JPanel contentPanel = new JPanel();
|
contentPanel.setLayout(null);
|
|
JLabel nameLabel = new JLabel("内容:");
|
nameField = new KTextField();
|
nameLabel.setBounds(new Rectangle(40,25,40,25));
|
nameField.setBounds(new Rectangle(85,25,280,25));
|
|
JLabel descriptionLabel = new JLabel("描述:");
|
descriptionArea = new JTextArea();
|
descriptionLabel.setBounds(new Rectangle(40,55,40,30));
|
JScrollPane jsDescription=new JScrollPane();
|
jsDescription.setBounds(new Rectangle(85,55,280,120));
|
contentPanel.add(descriptionLabel);
|
contentPanel.add(jsDescription);
|
descriptionArea.setLineWrap(true);
|
jsDescription.getViewport().add(descriptionArea);
|
|
|
contentPanel.add(nameLabel);
|
contentPanel.add(nameField);
|
contentPanel.add(descriptionLabel);
|
contentPanel.add(jsDescription);
|
|
conformButton.setActionCommand("confirm");
|
conformButton.addActionListener(new AppConfigCategoryDialogActionListener(this));
|
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
cancelButton_ActionPerformed(e);
|
}
|
});
|
initContent();
|
return contentPanel;
|
}
|
private void initContent(){
|
if (obj != null){
|
nameField.setText(obj.getName());
|
descriptionArea.setText(obj.getDesc());
|
}
|
}
|
|
public AppConfigCategoryObject getConfigDetail() {
|
if (obj == null){
|
obj = new AppConfigCategoryObject();
|
}
|
obj.setName(nameField.getText());
|
obj.setDesc(descriptionArea.getText());
|
return obj;
|
}
|
|
/**
|
* 取消按钮事件
|
* @param e
|
*/
|
private void cancelButton_ActionPerformed(ActionEvent e) {
|
this.dispose();
|
}
|
|
public AppConfigCategoryPanel getAppConfigCategoryPanel() {
|
return this.panel;
|
}
|
}
|