ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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.framework.systemConfig.object.CombinationObject;
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 2013-1-3
 * @version 1.0
 */
public class CombinationDialog extends BaseJDialog {
 
    private static final long serialVersionUID = 1L;
    private CombinationTablePanel combinationPanel ;
    private CombinationObject combinationObj;
    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 CombinationDialog(CombinationTablePanel combinationPanel , String optType){
        super(LogonApplication.frame);
        this.setModal(true);
        this.combinationPanel = combinationPanel;
        this.optType = optType;
        init();
    }
    public CombinationDialog(CombinationTablePanel combinationPanel , CombinationObject combinationObj, String optType){
        super(LogonApplication.frame);
        this.setModal(true);
        this.combinationPanel = combinationPanel;
        this.combinationObj = combinationObj;
        this.optType = optType;
        init();
    }
    
    /**
     * 初始化界面 
     */
    public void  init (){
         JLabel titleLabel = new JLabel();
         titleLabel.setText("密码组合方式");
         titleLabel.setIcon(new BundleImage().createImageIcon ("brick_edit.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); 
//         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(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, combinationPanel ,optType , combinationObj));
            
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                cancelButton_ActionPerformed(e);
            }
        });
        initContent();
        return contentPanel;
    }
    private void initContent(){
        if (combinationObj != null){
            nameText.setText(combinationObj.getName());
            descriptionArea.setText(combinationObj.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();
    }
}