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