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); } }