dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
/**
 * 
 */
package com.vci.client.logon.client;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.ui.swing.VCISwingUtil;
import com.vci.client.ui.swing.components.VCIJButton;
import com.vci.client.ui.swing.components.VCIJFrame;
import com.vci.client.ui.swing.components.VCIJLabel;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.VCIJScrollPane;
import com.vci.client.ui.swing.components.VCIJTextArea;
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
 
/**
 * 查看申请成功的代码,以便进行‘已阅知’
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2012</p>
 * <p>Company: VCI</p>
 * @author xchao
 * @time 2013-5-20
 * @version 1.0
 */
public class ViewCodeFrame extends VCIJFrame implements ActionListener {
    /**
     * 
     */
    private static final long serialVersionUID = 5313552457943357727L;
    private String codes = "";
    private String title = "查看申请的代码";
    private VCIJLabel lblCode = new VCIJLabel("代码列表:");
    private VCIJTextArea txtCode = new VCIJTextArea();
    
    private VCIJButton btnViewed = VCISwingUtil.createVCIJButton("viewed", "已阅知", "已阅知", "accept.png", this);
    private VCIJButton btnClose = VCISwingUtil.createVCIJButton("close", "关闭", "关闭", "cancel.png", this);
    
    
    public ViewCodeFrame(String codes){
        this.codes = codes;
        init();
    }
 
    private void init(){
        initComponents();
        initContents();
        initLocationAndSize();
    }
    
    private void initComponents(){
        txtCode.setBorder(null);
        txtCode.setLineWrap(true);
        txtCode.setWrapStyleWord(true);
        txtCode.setEditable(false);
        VCIJScrollPane jspCode = new VCIJScrollPane(txtCode);
        
        VCIJPanel palBtns = new VCIJPanel();
        palBtns.add(btnViewed);
        palBtns.add(btnClose);
 
        setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 0.1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 5,    5);
        
        gbc.gridx = 0; gbc.gridy = 0;
        add(lblCode, gbc);
        
        gbc.gridx = 0; gbc.gridy = 1;
        gbc.weightx = 1.0;
        gbc.weighty = 10.0;
        add(jspCode, gbc);
 
        gbc.weightx = 0.0;
        gbc.weighty = 0.0;
        gbc.gridx = 0; gbc.gridy = 2;
        add(palBtns, gbc);
    }
    
    private void initContents(){
        setTitle(title);
        txtCode.setText(codes.replace(",", "\n"));
    }
    
    private void initLocationAndSize(){
        setDefaultCloseOperation(VCIJFrame.EXIT_ON_CLOSE);
        setSize(600, 500);
        setLocationRelativeTo(null);
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        String actionCommand = e.getActionCommand();
        if("viewed".equals(actionCommand)){
            viewed();
        } else if("close".equals(actionCommand)){
            close();
        }
    }
    
    private void viewed(){
        if(!"".equals(this.codes)){
            ProcessCustomClientDelegate del = new ProcessCustomClientDelegate(null);
            try{
                del.searchComplateTask(new String[]{ codes, "IRMS", "" });
                VCIOptionPane.showMessage(this, "已阅知成功");
                this.close();
            }catch (VCIException e) {
                e.printStackTrace();
                VCIOptionPane.showMessage(this, "已阅知的过程中发生错误!");
            }
        }
    }
    
    private void close(){
        setVisible(false);
        dispose();
        System.exit(0);
    }
}