package com.vci.client.workflow.task;
|
|
import java.awt.Dimension;
|
import java.awt.Toolkit;
|
|
import javax.swing.JDialog;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.framework.rightConfig.object.FunctionObject;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.client.ui.swing.VCIOptionPane;
|
import com.vci.client.ui.tree.VCIBaseTreeNode;
|
import com.vci.client.workflow.commom.ClientHelper;
|
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
|
import com.vci.client.workflow.editor.FlowDesigner;
|
import com.vci.client.workflow.template.object.ProcessCategoryObject;
|
import com.vci.corba.common.VCIError;
|
|
public class ProcessTaskOperate {
|
|
private ProcessTaskToolBar toolBar;
|
FunctionObject funcObject = new FunctionObject();
|
public ProcessTaskOperate(ProcessTaskToolBar toolBar) {
|
this.toolBar = toolBar;
|
}
|
|
/**
|
* 创建模板分类
|
*/
|
public void createProcessCategory() {
|
javax.swing.SwingUtilities.invokeLater(new Runnable() {
|
public void run() {
|
showCreateDialog();
|
}
|
});
|
}
|
|
private void showCreateDialog() {
|
/*
|
* VCIBaseTreeNode selectedNode = toolBar.getMainPanel().getCurrentSelectedTreeNode(); if(selectedNode == null || (selectedNode != null && !selectedNode.isRoot())){
|
* VCIOptionPane.showMessage(LogonApplication.frame, ClientHelper.getI18nStringForWorkflow(this.getClass().getName() + "." + "pleaseChooseRootTreeNode",
|
* toolBar.getLocale())); return; }
|
*/
|
showProcessCategoryDialog("create", null);
|
}
|
|
private void showProcessCategoryDialog(String optType, ProcessCategoryObject selectedObj) {
|
/*
|
* try { ProcessCategoryDialog dialog = new ProcessCategoryDialog("", optType, selectedObj, this); dialog.setVisible(true); } catch (VCIException exp) {
|
* VCIOptionPane.showError(LogonApplication.frame, "RMIPWorkflow", exp); }
|
*/
|
}
|
|
/**
|
* 修改优选库
|
*/
|
public void editProcessCategory() {
|
javax.swing.SwingUtilities.invokeLater(new Runnable() {
|
public void run() {
|
showModifyDialog();
|
}
|
});
|
}
|
|
private void showModifyDialog() {
|
Object selectedObj = toolBar.getMainPanel().getCurrentSelectedObject();
|
if (selectedObj instanceof ProcessCategoryObject) {
|
showProcessCategoryDialog("modify", (ProcessCategoryObject) selectedObj);
|
} else {
|
VCIOptionPane.showMessage(LogonApplication.frame,
|
ClientHelper.getI18nStringForWorkflow(this.getClass().getName() + "." + "pleaseChooseProcessCategoryNode", toolBar.getLocale()));
|
}
|
}
|
|
public void deleteProcessCategoryButton_mouseEntered() {
|
Object selectedObject = toolBar.getMainPanel().getCurrentSelectedObject();
|
if (selectedObject instanceof ProcessCategoryObject) {
|
if (VCIOptionPane.showQuestion(LogonApplication.frame,
|
ClientHelper.getI18nStringForWorkflow(this.getClass().getName() + "." + "deleteConfirmMessage", toolBar.getLocale())) != 0) {
|
return;
|
}
|
ProcessCategoryObject object = (ProcessCategoryObject) selectedObject;
|
deleteProcessCategoryClassify(object.getId());
|
toolBar.getMainPanel().setEmptyPanel();
|
} else {
|
VCIOptionPane.showError(LogonApplication.frame,
|
ClientHelper.getI18nStringForWorkflow(this.getClass().getName() + "." + "pleaseChooseNotRootTreeNode", toolBar.getLocale()));
|
}
|
}
|
|
private void deleteProcessCategoryClassify(String id) {
|
try {
|
ProcessCustomClientDelegate delegate = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
|
boolean rs = delegate.deleteProcessCategory(id);
|
if (rs) {
|
VCIBaseTreeNode node = toolBar.getMainPanel().getCurrentSelectedTreeNode();
|
toolBar.getMainPanel().removeNode(node);
|
}
|
} catch (VCIException exp) {
|
VCIOptionPane.showError(LogonApplication.frame, "RMIPWorkflow", exp);
|
}
|
}
|
|
public void refreshProcessCategory() {
|
toolBar.getMainPanel().updateTree();
|
|
Object selectedObj = toolBar.getMainPanel().getCurrentSelectedObject();
|
if (selectedObj instanceof IdName) {
|
IdName name = (IdName) selectedObj;
|
if ("todotask".equals(name.getId())) {
|
TodoTaskPanel t = TodoTaskPanel.getInstance(funcObject,"");
|
t.initData();
|
} else if ("donetask".equals(name.getId())) {
|
DoneTaskPanel t = DoneTaskPanel.getInstance(funcObject,"");
|
t.initData();
|
} else if ("tracktask".equals(name.getId())) {
|
TrackTaskPanel t = TrackTaskPanel.getInstance(funcObject,"");
|
t.initData();
|
}
|
|
}
|
}
|
|
public ProcessTaskToolBar getToolBar() {
|
return this.toolBar;
|
}
|
|
public void addProcessProcessDefinition() throws VCIError {
|
Object selectedObj = toolBar.getMainPanel().getCurrentSelectedObject();
|
if (selectedObj instanceof ProcessCategoryObject) {
|
JDialog dialog = new JDialog(LogonApplication.frame);
|
dialog.setTitle("流程自定义");
|
dialog.setModal(true);
|
FlowDesigner designer = new FlowDesigner();
|
designer.setFlowCategory((ProcessCategoryObject) selectedObj);
|
dialog.setContentPane(designer);
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
int width = 200, height = 50;
|
dialog.setSize(screenSize.width - width, screenSize.height - height);
|
dialog.setLocation(width / 2, height / 2);
|
dialog.setVisible(true);
|
// 刷新节点
|
refreshProcessCategory();
|
} else {
|
VCIOptionPane.showMessage(LogonApplication.frame,
|
ClientHelper.getI18nStringForWorkflow(this.getClass().getName() + "." + "pleaseChooseProcessCategoryNode", toolBar.getLocale()));
|
}
|
}
|
|
public void editProcessProcessDefinition() {
|
// TODO Auto-generated method stub
|
|
}
|
}
|