田源
2024-03-07 4b4083fd73dc27ece42f4835483565eef0e4f608
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
package com.vci.client.workflow.task;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
 
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
 
import com.vci.client.LogonApplication;
import com.vci.client.ui.swing.VCISwingUtil;
import com.vci.client.ui.swing.components.VCIJTabbedPane;
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
import com.vci.corba.common.VCIError;
import com.vci.corba.workflow.data.FlowApproveHistoryInfo;
import com.vci.corba.workflow.data.FlowTaskInfo;
import com.vci.corba.workflow.data.ProcessTaskInfo;
 
/**
 * 已办窗口
 * 
 * @author Administrator
 * 
 */
public class DoneProcessDialog extends JDialog {
 
    private static final long serialVersionUID = 4239328464693862083L;
 
    private JTable table;
 
    private HistoryTableModel historyTableModel;
    private FlowTaskInfo flowHistoryTaskInfo;
    String finishFlag = "";
 
    private ProcessTaskInfo frocessTaskInfo;
    public DoneProcessDialog(FlowTaskInfo flowHistoryTaskInfo, ProcessTaskInfo frocessTaskInfo,String finishFlag) {
        super(LogonApplication.frame, "已完成流程", true);
        this.flowHistoryTaskInfo = flowHistoryTaskInfo;
        this.finishFlag = finishFlag;
        this.frocessTaskInfo = frocessTaskInfo;
        initUI();
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    initData();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
 
    private void initData() {
        ProcessCustomClientDelegate processCustomClientDelegate = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
        FlowApproveHistoryInfo[] historyActivity;
        try {
            historyActivity = processCustomClientDelegate.getHistoryActivityByProInsId(flowHistoryTaskInfo.executionId);
            historyTableModel.setData(historyActivity);
        } catch (VCIError e) {
            e.printStackTrace();
        }
 
    }
//    private RMDataPanelForFlowData flowDataPanel = new RMDataPanelForFlowData(false, this);
    private void initUI() {
        setTitle("流程已办查看");
        setSize(780, 600);
        centerToScreen();
        getContentPane().setLayout(new BorderLayout());
 
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout());
 
        VCIJTabbedPane tabbedPane = new VCIJTabbedPane(VCIJTabbedPane.TOP);
        panel.add(tabbedPane, BorderLayout.CENTER);
 
        //查看流程数据
//        flowDataPanel.setInfo(frocessTaskInfo);
//        tabbedPane.addTab("流程数据", null, flowDataPanel, null);
//        flowDataPanel.init(flowHistoryTaskInfo,true);
        
        JPanel historyPanel = new JPanel();
        tabbedPane.addTab("审核过程", null, historyPanel, null);
        historyPanel.setLayout(new BorderLayout(0, 0));
 
        JScrollPane scrollPane = new JScrollPane();
        historyPanel.add(scrollPane, BorderLayout.CENTER);
        
        historyTableModel = new HistoryTableModel();
        table = new JTable(historyTableModel);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setShowGrid(true);
        scrollPane.setViewportView(table);
        table.setRowHeight(25);
        historyTableModel = new HistoryTableModel();
        table.setModel(historyTableModel);
        table.getTableHeader().setFont(VCISwingUtil.FONT_DEFAULT);
        table.getColumnModel().getColumn(0).setPreferredWidth(150);
        table.getColumnModel().getColumn(1).setPreferredWidth(150);
        table.getColumnModel().getColumn(2).setPreferredWidth(150);
        table.getColumnModel().getColumn(3).setPreferredWidth(150);
        table.getColumnModel().getColumn(4).setPreferredWidth(150);
        table.getColumnModel().getColumn(5).setPreferredWidth(250);
        
        //查看流程结束后的流程图.
        if("完成".equals(finishFlag)){
            ProcessCustomClientDelegate processCustomClientDelegate = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
            try {
                String jbpmDeploymentId = processCustomClientDelegate.getDepolymentID(flowHistoryTaskInfo.executionId);
                ViewFinishImagePanel viewPanel = new ViewFinishImagePanel(flowHistoryTaskInfo.executionId,"");
                tabbedPane.addTab("查看流程图", null, viewPanel, null);
            } catch (VCIError e) {
                e.printStackTrace();
            }
        }else{
            ViewExecutionImagePanel viewPanel = new ViewExecutionImagePanel(flowHistoryTaskInfo.executionId, flowHistoryTaskInfo.name);
            tabbedPane.addTab("查看流程图", null, viewPanel, null);
        }
 
    }
 
    /**
     * 居中屏幕
     */
    private void centerToScreen() {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension componentSize = this.getSize();
        if (componentSize.height > screenSize.height) {
            componentSize.height = screenSize.height;
        }
 
        if (componentSize.width > screenSize.width) {
            componentSize.width = screenSize.width;
        }
 
        setLocation((screenSize.width - componentSize.width) / 2, (screenSize.height - componentSize.height) / 2);
    }
    
    private void closeDialog(){
        this.dispose();
    }
}