package com.vci.client.workflow.template;
|
|
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.ComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.JButton;
|
import javax.swing.JComboBox;
|
import javax.swing.JDialog;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JTextField;
|
import javax.swing.border.EmptyBorder;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.framework.rightConfig.object.WorkFlowObject;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
|
import com.vci.client.workflow.template.object.ProcessCategoryObject;
|
import com.vci.client.workflow.template.object.ProcessDefinitionObject;
|
|
|
/**
|
* This code was edited or generated using CloudGarden's Jigloo
|
* SWT/Swing GUI Builder, which is free for non-commercial
|
* use. If Jigloo is being used commercially (ie, by a corporation,
|
* company or business for any purpose whatever) then you
|
* should purchase a license for each developer using Jigloo.
|
* Please visit www.cloudgarden.com for details.
|
* Use of Jigloo implies acceptance of these licensing terms.
|
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
|
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
|
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
|
*/
|
/**
|
* 工作流配置页面
|
* @author liudi
|
*
|
* 2013-1-5
|
*/
|
public class WorkFlowConfDialog extends JDialog {
|
|
private final JPanel contentPanel = new JPanel();
|
private JLabel sysName;
|
private JComboBox processtypeComb = new JComboBox();
|
private JComboBox tasktypeCmb = new JComboBox();
|
private JLabel taskTypeLab;
|
private JLabel processTypeLab;
|
private JTextField operatetypeTxt;
|
private JLabel operatyTypeLab;
|
private JButton temChoiceBtn;
|
private JTextField procTemTxt;
|
private JLabel processTemNameLab;
|
private JTextField modelTxt;
|
private JLabel modelClassName;
|
private JComboBox sysComb;
|
private ComboBoxModel processtypeCombModel = null;
|
private ComboBoxModel tasktypeCmbModel = null;
|
private ProcessDefinitionObject processDefinitionObject;
|
TypeObject[] processObject = new TypeObject[6];
|
TypeObject[] taskObject = new TypeObject[6];
|
WorkFlowObject obj = new WorkFlowObject();
|
/**
|
* Create the dialog.
|
*/
|
public WorkFlowConfDialog(WorkFlowObject obj) {
|
super(LogonApplication.frame,true);
|
initProcessTypeCombox("编码管理系统");
|
initTaskTypeCombox("编码管理系统");
|
this.obj = obj;
|
init();
|
centerToScreen();
|
}
|
|
private void init() {
|
setSize(450, 400);
|
getContentPane().setLayout(new BorderLayout());
|
contentPanel.setLayout(null);
|
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
sysName = new JLabel();
|
contentPanel.add(sysName);
|
sysName.setText("系统名称:");
|
sysName.setBounds(86, 50, 80, 25);
|
ComboBoxModel sysCombModel =
|
new DefaultComboBoxModel(
|
new String[] { "编码管理系统", "资源管理系统" });
|
sysComb = new JComboBox();
|
sysComb.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
String string = sysComb.getSelectedItem().toString();
|
initProcessTypeCombox(string);
|
initTaskTypeCombox(string);
|
}
|
});
|
contentPanel.add(sysComb);
|
sysComb.setModel(sysCombModel);
|
sysComb.setBounds(177, 50, 120, 25);
|
modelClassName = new JLabel();
|
contentPanel.add(modelClassName);
|
modelClassName.setText("模块类名称:");
|
modelClassName.setBounds(86, 95, 80, 25);
|
modelTxt = new JTextField();
|
contentPanel.add(modelTxt);
|
modelTxt.setBounds(179, 95, 203, 25);
|
operatyTypeLab = new JLabel();
|
contentPanel.add(operatyTypeLab);
|
operatyTypeLab.setText("操作标识:");
|
operatyTypeLab.setBounds(86, 139, 80, 25);
|
operatetypeTxt = new JTextField();
|
contentPanel.add(operatetypeTxt);
|
operatetypeTxt.setBounds(179, 139, 121, 25);
|
processTypeLab = new JLabel();
|
contentPanel.add(processTypeLab);
|
processTypeLab.setBounds(86, 182, 80, 25);
|
processTypeLab.setText("流程类型:");
|
taskTypeLab = new JLabel();
|
contentPanel.add(taskTypeLab);
|
taskTypeLab.setText("任务箱类型:");
|
taskTypeLab.setBounds(86, 231, 80, 25);
|
contentPanel.add(tasktypeCmb);
|
tasktypeCmb.setBounds(181, 231, 123, 25);
|
contentPanel.add(processtypeComb);
|
processTemNameLab = new JLabel();
|
contentPanel.add(processTemNameLab);
|
processTemNameLab.setText("流程模版名称:");
|
processTemNameLab.setBounds(87, 277, 90, 17);
|
procTemTxt = new JTextField();
|
contentPanel.add(procTemTxt);
|
procTemTxt.setBounds(183, 274, 146, 24);
|
temChoiceBtn = new JButton();
|
temChoiceBtn.setText("选择");
|
contentPanel.add(temChoiceBtn);
|
temChoiceBtn.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
AssignProcessDialog dialog = new AssignProcessDialog(LogonApplication.frame);
|
dialog.setVisible(true);
|
if(dialog.isOk()) {
|
processDefinitionObject = dialog.getProcessDefinitionObject();
|
procTemTxt.setText(processDefinitionObject.toString());
|
}
|
}
|
});
|
temChoiceBtn.setBounds(348, 274, 62, 24);
|
processtypeComb.setBounds(181, 182, 116, 25);
|
JPanel buttonPane = new JPanel();
|
buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
|
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
JButton okButton = new JButton("确定");
|
okButton.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
WorkFlowObject object = new WorkFlowObject();
|
if(obj!=null){
|
object = obj;
|
object.setSysIdentify(sysComb.getSelectedItem().toString());
|
object.setOperateIdentify(operatetypeTxt.getText().trim());
|
TypeObject processType = (TypeObject) processtypeComb.getSelectedItem();
|
object.setProcessType(processType.getType());
|
TypeObject taskType = (TypeObject) tasktypeCmb.getSelectedItem();
|
object.setTaskType(taskType.getClassName());
|
ProcessCustomClientDelegate delSrv = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
|
ProcessCategoryObject[] processCategories;
|
try {
|
processCategories = delSrv.getProcessCategories("root");
|
for(int i =0;i<processCategories.length;i++){
|
ProcessDefinitionObject[] processDefinitions = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject()).getProcessDefinitions(processCategories[i].getId());
|
for(int j =0;j<processDefinitions.length;j++){
|
if(obj.getProcessTemID().equals(processDefinitions[i].getJbpmDeploymentId())){
|
object.setProcessTemID(processDefinitions[i].getJbpmDeploymentId());
|
}
|
}
|
}
|
|
} catch (VCIException e) {
|
e.printStackTrace();
|
}
|
object.setProcessTmeName(obj.getProcessTmeName());
|
}else{
|
object.setSysIdentify(sysComb.getSelectedItem().toString());
|
object.setOperateIdentify(operatetypeTxt.getText().trim());
|
TypeObject processType = (TypeObject) processtypeComb.getSelectedItem();
|
object.setProcessType(processType.getType());
|
TypeObject taskType = (TypeObject) tasktypeCmb.getSelectedItem();
|
object.setTaskType(taskType.getClassName());
|
object.setProcessTemID(getJbpmDeploymentId());
|
object.setProcessTmeName(processDefinitionObject.toString());
|
}
|
// try {
|
// new WorkFlowConfClientDelegate(LogonApplication.getUserEntityObject()).saveWorkFlowConf(object);
|
// VCIOptionPane.showMessage(LogonApplication.frame, "保存成功!");
|
// dispose();
|
// } catch (VCIException e) {
|
// e.printStackTrace();
|
// }
|
}
|
});
|
buttonPane.add(okButton);
|
JButton cancelButton = new JButton("取消");
|
cancelButton.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
dispose();
|
}
|
});
|
buttonPane.add(cancelButton);
|
if(obj!=null){
|
sysComb.setSelectedItem(obj.getSysIdentify());
|
operatetypeTxt.setText(obj.getOperateIdentify());
|
|
for(int i=0;i<processtypeComb.getModel().getSize();i++){
|
TypeObject elementAt = (TypeObject) processtypeComb.getModel().getElementAt(i);
|
if(obj.getProcessType().equals(elementAt.getType())){
|
processtypeComb.setSelectedIndex(i);
|
}
|
}
|
for(int i=0;i<tasktypeCmb.getModel().getSize();i++){
|
TypeObject elementAt = (TypeObject) tasktypeCmb.getModel().getElementAt(i);
|
if(obj.getTaskType().equals(elementAt.getClassName())){
|
tasktypeCmb.setSelectedIndex(i);
|
}
|
}
|
ProcessCustomClientDelegate delSrv = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
|
ProcessCategoryObject[] processCategories;
|
try {
|
processCategories = delSrv.getProcessCategories("root");
|
for(int i =0;i<processCategories.length;i++){
|
ProcessDefinitionObject[] processDefinitions = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject()).getProcessDefinitions(processCategories[i].getId());
|
for(int j =0;j<processDefinitions.length;j++){
|
if(obj.getProcessTemID().equals(processDefinitions[i].getJbpmDeploymentId())){
|
procTemTxt.setText(processDefinitions[i].toString());
|
}
|
}
|
}
|
|
} catch (VCIException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|
|
private TypeObject[] initProcessTypeCombox(String flagStr){
|
if("编码管理系统".equals(flagStr)){
|
processObject[0] = new TypeObject();
|
processObject[0].setName("申请任务");
|
processObject[0].setType("0");
|
processObject[1] = new TypeObject();
|
processObject[1].setName("编辑任务");
|
processObject[1].setType("2");
|
processObject[2] = new TypeObject();
|
processObject[2].setName("删除任务");
|
processObject[2].setType("3");
|
processObject[3] = new TypeObject();
|
processObject[3].setName("停用任务");
|
processObject[3].setType("4");
|
processObject[4] = new TypeObject();
|
processObject[4].setName("启用任务");
|
processObject[4].setType("5");
|
processObject[5] = new TypeObject();
|
processObject[5].setName("报废任务");
|
processObject[5].setType("6");
|
}else if("资源管理系统".equals(flagStr)){
|
processObject[0] = new TypeObject();
|
processObject[0].setName("入库任务");
|
processObject[0].setType("7");
|
processObject[1] = new TypeObject();
|
processObject[1].setName("修改任务");
|
processObject[1].setType("8");
|
processObject[2] = new TypeObject();
|
processObject[2].setName("删除任务");
|
processObject[2].setType("9");
|
processObject[3] = new TypeObject();
|
processObject[3].setName("停用任务");
|
processObject[3].setType("10");
|
processObject[4] = new TypeObject();
|
processObject[4].setName("启用任务");
|
processObject[4].setType("11");
|
processObject[5] = new TypeObject();
|
processObject[5].setName("报废任务");
|
processObject[5].setType("12");
|
}
|
processtypeCombModel = new DefaultComboBoxModel(processObject);
|
|
processtypeComb.setModel(processtypeCombModel);
|
processtypeComb.updateUI();
|
return processObject;
|
}
|
private TypeObject[] initTaskTypeCombox(String flagStr){
|
if("编码管理系统".equals(flagStr)){
|
taskObject[0] = new TypeObject();
|
taskObject[0].setName("申请任务箱");
|
taskObject[0].setClassName("com.vci.rmip.workflow.client.task.ApplicationTaskPanel");
|
taskObject[1] = new TypeObject();
|
taskObject[1].setName("编辑任务箱");
|
taskObject[1].setClassName("com.vci.rmip.workflow.client.task.ChangeTaskPanel");
|
taskObject[2] = new TypeObject();
|
taskObject[2].setName("删除任务箱");
|
taskObject[2].setClassName("com.vci.rmip.workflow.client.task.DeleteTaskPanel");
|
taskObject[3] = new TypeObject();
|
taskObject[3].setName("停用任务箱");
|
taskObject[3].setClassName("com.vci.rmip.workflow.client.task.BlockTaskPanel");
|
taskObject[4] = new TypeObject();
|
taskObject[4].setName("启用任务箱");
|
taskObject[4].setClassName("com.vci.rmip.workflow.client.task.StartTaskPanel");
|
taskObject[5] = new TypeObject();
|
taskObject[5].setName("报废任务箱");
|
taskObject[5].setClassName("6");
|
}else if("资源管理系统".equals(flagStr)){
|
taskObject[0] = new TypeObject();
|
taskObject[0].setName("入库任务箱");
|
taskObject[0].setClassName("7");
|
taskObject[1] = new TypeObject();
|
taskObject[1].setName("修改任务箱");
|
taskObject[1].setClassName("8");
|
taskObject[2] = new TypeObject();
|
taskObject[2].setName("删除任务箱");
|
taskObject[2].setClassName("9");
|
taskObject[3] = new TypeObject();
|
taskObject[3].setName("停用任务箱");
|
taskObject[3].setClassName("10");
|
taskObject[4] = new TypeObject();
|
taskObject[4].setName("启用任务箱");
|
taskObject[4].setClassName("11");
|
taskObject[5] = new TypeObject();
|
taskObject[5].setName("报废任务箱");
|
taskObject[5].setClassName("12");
|
}
|
tasktypeCmbModel = new DefaultComboBoxModel(taskObject);
|
|
tasktypeCmb.setModel(tasktypeCmbModel);
|
tasktypeCmb.updateUI();
|
return taskObject;
|
}
|
private void centerToScreen() {
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension componentSize = getSize();
|
if (componentSize.height > screenSize.height) {
|
componentSize.height = screenSize.height;
|
}
|
|
if (componentSize.width > screenSize.width) {
|
componentSize.width = screenSize.width;
|
}
|
|
this.setLocation((screenSize.width - componentSize.width) / 2,
|
(screenSize.height - componentSize.height) / 2);
|
}
|
public String getJbpmDeploymentId() {
|
if(processDefinitionObject == null) {
|
return "";
|
}
|
return processDefinitionObject.getJbpmDeploymentId();
|
}
|
|
}
|