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
131
132
133
134
135
136
137
138
package com.vci.client.framework.systemConfig.specialCharacter;
 
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.framework.systemConfig.object.SpecialCharClsfObject;
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;
/**
 * 
 * <p>Title:SpecialCharacterDialog </p>
 * <p>Description: 特殊字符分类</p>
 * <p>Copyright: Copyright (c) 2012</p>
 * <p>Company: VCI</p>
 * @author sunbo
 * @time 2012-5-24
 * @version 1.0
 */
public class SpecialCharacterDialog extends BaseJDialog{
    
    /**
     * 
     */
    private static final long serialVersionUID = 2175656472348441688L;
    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 = null;
    private JTextArea descriptionArea = null;
    private String nodeType;
    private SpecialCharacterPanel panel;
    private SpecialCharClsfObject obj;
    
    public SpecialCharacterDialog(SpecialCharacterPanel panel,String nodeType ,SpecialCharClsfObject obj){
        super(LogonApplication.frame);
        this.setModal(true);
        this.nodeType = nodeType;
        this.panel = panel;
        this.obj = obj;
        init();
    }
    public SpecialCharacterDialog(String nodeType ,SpecialCharClsfObject obj){
        super(LogonApplication.frame);
        this.setModal(true);
        this.nodeType = nodeType;
        this.obj = obj;
        init();
    }
    public 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); 
//        int x = (int)(this.getParent().getLocationOnScreen().getX()) +500;
//        int y = (int)(this.getParent().getLocationOnScreen().getY()) +200;
//        this.setLocation(x , y);
//        this.setSize(400, 300);
        initDialogSize(400, 300);
        this.setVisible(true);
    }
    private JPanel initCenterContentPanel() {
        JPanel contentPanel = new JPanel();
        contentPanel.setLayout(null);
        
        JLabel nameLabel = new JLabel("名称:");
        nameField = new KTextField();
        nameLabel.setBounds(new Rectangle(60,20,100,20));
        nameField.setBounds(new Rectangle(95,20,200,25));
        
        JLabel descriptionLabel = new JLabel("描述:");
        descriptionArea = new JTextArea();
        descriptionLabel.setBounds(new Rectangle(60,50,100,20));    
        JScrollPane jsDescription=new JScrollPane();
        jsDescription.setBounds(new Rectangle(95,50,200,100));    
        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.addActionListener(new SpecialCharacterClsActionListener(this,nodeType,panel,obj));
        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());
        }
    }
    /**
     * 取消按钮事件
     * @param e
     */
    private void cancelButton_ActionPerformed(ActionEvent e) {
        this.dispose();
    }
    public String getNameFieldText() {
        return nameField.getText().trim();
    }
    public String getDescriptionArea() {
        return descriptionArea.getText().trim();
    }
}