wangting
2024-12-26 fa261e8c1220b31af54e8167e4de9c3320b1af27
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
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;
    }
}