dangsn
2025-01-16 d6e9b6f11fd8f36895eb70f092bdd8c412750111
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
package com.vci.client.workflow.subprocess;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
 
import com.vci.client.LogonApplication;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.ui.table.VCIBaseTableNode;
import com.vci.client.ui.tree.VCIBaseTree;
import com.vci.client.ui.tree.VCIBaseTreeNode;
import com.vci.client.workflow.template.ProcessCustomPanel;
import com.vci.client.workflow.template.object.ProcessCategoryObject;
import com.vci.client.workflow.template.object.ProcessDefinitionObject;
 
public class SubProcessChoiceDialog extends JDialog{
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private ProcessCustomPanel pc;
    
    private JButton okBtn ;
    private JButton cancelBtn ;
    
    private String subProcessName;
    
    FunctionObject object = new FunctionObject();
    
    public String getSubProcessName() {
        return subProcessName;
    }
 
    public void setSubProcessName(String subProcessName) {
        this.subProcessName = subProcessName;
    }
 
    public SubProcessChoiceDialog(){
        super(LogonApplication.frame,true);
        init();
        diplayCenter();
        this.setVisible(true);
    }
    
    /**
     * 剧中显示
     */
    private void diplayCenter() {
        Toolkit kit = Toolkit.getDefaultToolkit();
        Dimension screenSize = kit.getScreenSize();
        int width = (int) screenSize.getWidth();
        int height = (int) screenSize.getHeight();
        this.setSize(400, 300);
        int w = this.getWidth();
        int h = this.getHeight();
        this.setLocation( (width - w) / 2, (height - h) / 2);
    }
    private void init(){
        this.setTitle("子流程模板");
        pc = new ProcessCustomPanel(object);
        JScrollPane jsp = new JScrollPane();
        VCIBaseTree leftTree = pc.getLeftTree();
        jsp.getViewport().add(leftTree);
        add(jsp);
        
        JPanel bottom = new JPanel();
        bottom.setLayout(new FlowLayout());
        
        okBtn = new JButton("确定");
        cancelBtn = new JButton("取消");
        
        bottom.add(okBtn);
        bottom.add(cancelBtn);
        
        okBtn.addActionListener(new ActionListener() {
            
            public void actionPerformed(ActionEvent e) {
                action_Ok();
            }
        });
        
        cancelBtn.addActionListener(new ActionListener() {
            
            public void actionPerformed(ActionEvent e) {
                subProcessName= "";
                dispose();
            }
        });
        this.add(bottom,BorderLayout.SOUTH);
    }
    
    private void action_Ok(){
        VCIBaseTree leftTree = pc.getLeftTree();
        VCIBaseTreeNode lastPathComponent = (VCIBaseTreeNode) leftTree.getSelectionPath().getLastPathComponent();
        Object obj = lastPathComponent.getObj();
        if(obj instanceof ProcessDefinitionObject){
            ProcessDefinitionObject o = (ProcessDefinitionObject)obj;
            subProcessName = o.getId();
            dispose();
        }else{
            VCIOptionPane.showError(LogonApplication.frame, "请选择模板!");
            return;
        }
    }
}