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