wangting
2024-12-30 306a9c4fde94c54d91aee5a69d59b993c7c707a1
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
package com.vci.client.workflow.task;
 
import java.awt.BorderLayout;
import java.awt.Color;
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.JTabbedPane;
import javax.swing.JTable;
 
import com.vci.client.LogonApplication;
import com.vci.client.ui.exception.VCIException;
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 DoneTaskDialog extends JDialog {
 
    private static final long serialVersionUID = 4239328464693862083L;
 
    private JTable table;
 
    private HistoryTableModel historyTableModel;
 
    private FlowTaskInfo flowHistoryTaskInfo;
    String finishFlag = "";
    public DoneTaskDialog(FlowTaskInfo flowHistoryTaskInfo, ProcessTaskInfo frocessTaskInfo,String finishFlag) {
        super(LogonApplication.frame, "已办任务", true);
        this.flowHistoryTaskInfo = flowHistoryTaskInfo;
        this.finishFlag = finishFlag;
        initUI();
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    initData();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
 
    private void initData() {
        ProcessCustomClientDelegate processCustomClientDelegate = new ProcessCustomClientDelegate();
        FlowApproveHistoryInfo[] historyActivity;
        try {
            historyActivity = processCustomClientDelegate.getHistoryActivityByProInsId(flowHistoryTaskInfo.executionId);
            historyTableModel.setData(historyActivity);
        } catch (VCIError e) {
            e.printStackTrace();
        }
 
    }
 
    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());
 
        JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
        panel.add(tabbedPane, BorderLayout.CENTER);
 
//        RmDataPanel rmDataPanel = new RmDataPanel();
//        rmDataPanel.initHistory(flowHistoryTaskInfo);
//        tabbedPane.addTab("流程数据", null, rmDataPanel, null);
 
//        try {
//            String deploymentId = new ProcessCustomClientDelegate().getDeploymentIdByExecutionId(flowHistoryTaskInfo.executionId);
//            String urlPath = new ProcessCustomClientDelegate().getUrlPath(deploymentId, flowHistoryTaskInfo.name);
//            if(urlPath.endsWith(".class")){
//                Class<?> cls;
//                try {
//                    cls = Class.forName(urlPath.substring(0,urlPath.lastIndexOf(".")));
//                } catch (ClassNotFoundException e) {
//                    e.printStackTrace();
//                } 
//                tabbedPane.addTab("流程数据", null, new JPanel(), null);
//            }
//        } catch (VCIError e1) {
//            e1.printStackTrace();
//        } catch (VCIException e) {
//            e.printStackTrace();
//        }
        JPanel panel_2 = new JPanel();
        tabbedPane.addTab("审核过程", null, panel_2, null);
        panel_2.setLayout(new BorderLayout());
 
        table = new JTable();
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setBackground(Color.WHITE);
        table.setRowHeight(25);
 
        Dimension size = table.getTableHeader().getPreferredSize();
        size.height = 22;
        table.getTableHeader().setPreferredSize(size);
        historyTableModel = new HistoryTableModel();
        table.setModel(historyTableModel);
 
        JScrollPane scrollPane_1 = new JScrollPane(table);
        panel_2.add(scrollPane_1);
 
        //查看流程结束后的流程图
        if("完成".equals(finishFlag)){
            ProcessCustomClientDelegate processCustomClientDelegate = new ProcessCustomClientDelegate();
            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);
    }
}