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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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
 
    }
}