田源
2025-01-09 8a166a60cfd1a2e593ffa103d10c0dc224fc8628
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
package com.vci.client.workflow.editor.user;
 
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 java.util.List;
 
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
 
import com.vci.client.LogonApplication;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
 
public class FowardUserDialog extends JDialog{
 
    FowardUserComponent ru ;
    private JButton okBtn ;
    private JButton cancelBtn ;
    //流程执行ID
    private String executionId;
    public FowardUserDialog(String executionId){
        super(LogonApplication.frame,true);
        this.executionId = executionId;
        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("用户列表");
        ru = new FowardUserComponent();
        this.add(ru);
        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) {
                dispose();
            }
        });
        this.add(bottom,BorderLayout.SOUTH);
    }
    
    private void action_Ok(){
        List<String> selectedUsers = ru.getSelectedUsers();
        if(selectedUsers.size()>0){
            String userName = selectedUsers.get(0);
            try{
                new ProcessCustomClientDelegate().assignTask(executionId, userName);
                VCIOptionPane.showMessage(LogonApplication.frame, "任务转交成功!");
            }catch (Exception e) {
                e.printStackTrace();
            }
            dispose();
        }
    }
}