wangting
2024-12-30 306a9c4fde94c54d91aee5a69d59b993c7c707a1
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
package com.vci.client.workflow.task;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
 
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.TitledBorder;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
 
import com.vci.client.LogonApplication;
import com.vci.client.common.TransmitTreeObject;
import com.vci.client.common.objects.DeptObject;
import com.vci.client.common.objects.RoleObject;
import com.vci.client.common.objects.UserObject;
import com.vci.client.framework.delegate.RightManagementClientDelegate;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.framework.systemConfig.stafforgmanage.RightManagementTreeCellRenderer;
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.ui.swing.components.VCIJDialog;
import com.vci.client.ui.tree.VCIBaseTree;
import com.vci.client.ui.tree.VCIBaseTreeModel;
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.template.object.ProcessDefinitionObject;
import com.vci.corba.common.VCIError;
 
/**
 * 更改任务候选人
 * 
 * @author Administrator
 * 
 */
public class ResetTaskUserByPlatformDialog extends VCIJDialog {
 
    private static final long serialVersionUID = 1461586100225135416L;
 
    
    private JTable historyTable;
 
    private HistoryTableModel historyTableModel;
    
    private boolean view = false;
    
    FunctionObject funcObject = new FunctionObject();
 
    private String executionId;
 
    private JButton commit;
    private JButton cancel;
 
 
    private String outCome;
    private String desc;
    private String taskId;
 
 
    private String taskName;
    
    private boolean saveFlag = false;
 
 
    private String status;
 
 
    private JList taskList;
 
 
    private DefaultListModel taskListModel;
 
 
    private VCIBaseTreeModel treeModel;
 
 
    private Object userInfo;
 
 
    private VCIBaseTree rightManagementTree;
    
    private TransmitTreeObject transmitTreeObject = new TransmitTreeObject();
    private Map<String,List<String>> taskAndUserMap = new HashMap<String,List<String>>();
    private Map<String,DefaultListModel> taskAndUserMap_1 = new HashMap<String,DefaultListModel>();
    
    private DefaultListModel resultListModel;
    private DefaultListModel tmpListModel = new DefaultListModel();
    
    private List<String> resultList = new ArrayList<String>();
    private JList userList;
    
    private String userValue ;
    private String roleValue ;
    private String departmentValue ;
    private VCIBaseTreeNode rootNode;
    
    public boolean isSaveFlag() {
        return saveFlag;
    }
 
    public void setSaveFlag(boolean saveFlag) {
        this.saveFlag = saveFlag;
    }
 
    public String getOutCome() {
        return outCome;
    }
 
    public void setOutCome(String outCome) {
        this.outCome = outCome;
    }
 
    public String getDesc() {
        return desc;
    }
 
    public void setDesc(String desc) {
        this.desc = desc;
    }
 
    public Map<String, List<String>> getTaskAndUserMap() {
        return taskAndUserMap;
    }
 
    public void setTaskAndUserMap(Map<String, List<String>> taskAndUserMap) {
        this.taskAndUserMap = taskAndUserMap;
    }
    
    public ResetTaskUserByPlatformDialog(String executionId,String taskId,String taskName,String status) {
        super(LogonApplication.frame, true);
        this.executionId = executionId;
        this.taskId = taskId;
        this.taskName = taskName;
        this.status = status;
        initUI();
        addListener();
        initTaskList();
        this.setLocationRelativeTo(null);
    }
 
//    public TodoTaskByPlatformDialog(Map<String,String> datamap, ProcessTaskInfo frocessTaskInfo, boolean view) {
//        super(LogonApplication.frame, true);
//        this.view = view;
//        setTitle("查看");
//        this.datamap = datamap;
//        this.frocessTaskInfo = frocessTaskInfo;
//        initUI();
//        initData();
//        addListener();
//    }
 
    private void addListener() {
        commit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                if(taskAndUserMap==null||taskAndUserMap.size()==0){
                    VCIOptionPane.showMessage(LogonApplication.frame, "您还没有没有选择用户!");
                    return;
                }else{
                    saveFlag = true;
                    dispose();
                }
            }
        });
        
        cancel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                dispose();
            }
        });
        
        taskList.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                super.mouseClicked(arg0);
                try {
                    String deploymentId = new ProcessCustomClientDelegate().getDeploymentIdByExecutionId(executionId);
                    String[] allCandidatesForTask = new ProcessCustomClientDelegate().getAllCandidatesForTask(deploymentId,(String)taskList.getSelectedValue(),"");
                    if(allCandidatesForTask.length==1){
                        userValue = allCandidatesForTask[0];
                        roleValue = null;
                        departmentValue = null;
                    }
                    if(allCandidatesForTask.length==2){
                        userValue = allCandidatesForTask[0];
                        roleValue = allCandidatesForTask[1];
                        departmentValue = null;
                    }
                    if(allCandidatesForTask.length==3){
                        userValue = allCandidatesForTask[0];
                        roleValue = allCandidatesForTask[1];
                        departmentValue = allCandidatesForTask[2];
                    }
                } catch (VCIError e) {
                    e.printStackTrace();
                } catch (VCIException e) {
                    e.printStackTrace();
                }
//                    
                    resultList = taskAndUserMap.get((String)taskList.getSelectedValue());
                    
                    if(resultList == null){
                        resultList = new ArrayList<String>();
                    }
                    resultListModel.clear();
                    DefaultListModel defaultListModel = taskAndUserMap_1.get((String)taskList.getSelectedValue());
                    for(int i=0;i<resultList.size();i++){
                        String resultValue = resultList.get(i);
                        int indexOf = resultValue.indexOf(":");
                        String resultFilter = resultValue.substring(indexOf+1);
                        for(int j=0;j<defaultListModel.size();j++){
                            Object object = defaultListModel.get(j);
                            if(j==0){
                                if(object instanceof UserObject){
                                    UserObject o = (UserObject)object;
                                    if(resultFilter.equals(o.getUserName())){
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof RoleObject){
                                    RoleObject o = (RoleObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof DeptObject){
                                    DeptObject o = (DeptObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        resultListModel.addElement(o);
                                    }
                                }
                            }else{
                                if(object instanceof UserObject){
                                    UserObject o = (UserObject)object;
                                    if(resultFilter.equals(o.getUserName())){
                                        if(checkUserIdAdded(o)) continue;
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof RoleObject){
                                    RoleObject o = (RoleObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        if(checkRoleIdAdded(o)) continue;
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof DeptObject){
                                    DeptObject o = (DeptObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        if(checkDeptIdAdded(o)) continue;
                                        resultListModel.addElement(o);
                                    }
                                }
                            }
                        }
                    }
//                    for(int i=0;i<resultList.size();i++){
//                        resultListModel.addElement(resultList.get(i));
//                    }
                    userList.setModel(resultListModel);
                    userList.updateUI();
                    
                    VCIBaseTreeNode root = (VCIBaseTreeNode) treeModel.getRoot();
                    int childCount = root.getChildCount();
                    for(int i=0;i<childCount;i++){
                        VCIBaseTreeNode childAt = (VCIBaseTreeNode) root.getChildAt(i);
                        childAt.removeAllChildren();
                    }
                    treeModel.reload();
                    rightManagementTree.updateUI();
                    
                
            }
        });
        rightManagementTree.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                if(e.getClickCount() != 2) return;
                TreePath path = rightManagementTree.getPathForLocation(e.getX(), e.getY());
                VCIBaseTreeNode clickedNode = (VCIBaseTreeNode) rightManagementTree.getLastSelectedPathComponent();
                if(path == null) return;
                if(clickedNode.getLevel()<2) return;
                transmitTreeObject.setCurrentTreeNode(clickedNode);
                addToUserListFromTreeNode(false);
                taskAndUserMap.put((String) taskList.getSelectedValue(), resultList);
                taskAndUserMap_1.put((String) taskList.getSelectedValue(), tmpListModel);
            }
        });
        rightManagementTree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                TreePath treePath = e.getPath();
                VCIBaseTreeNode selectNode = (VCIBaseTreeNode) treePath.getLastPathComponent();
                transmitTreeObject.setCurrentTreeNode(selectNode);
            }
        });
 
        /**
         * 树的展开事件
         */
        rightManagementTree.addTreeExpansionListener(new TreeExpansionListener() {
            public void treeExpanded(TreeExpansionEvent event) {
                TreePath treePath = event.getPath();
                VCIBaseTreeNode selectNode = (VCIBaseTreeNode) treePath.getLastPathComponent();
                transmitTreeObject.setCurrentTreeNode(selectNode);
                Object object = selectNode.getObj();
//                if (!selectNode.isExpand()) {
                    selectNode.setExpand(true);
                    transmitTreeObject.getCurrentTreeNode().removeAllChildren();
                    
                    if (object instanceof UserObject) {
                        UserObject user = (UserObject) object;
                        if (user.getId().equals("root")) {
                            try {
                                UserObject[] userInfos = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfo();
                                for (UserObject userObject : userInfos) {
                                    if(userValue!=null&&!"".equals(userValue)){
                                        String[] split = userValue.split(",");
                                        for(String userSplit : split){
                                            if(userSplit.equals(userObject.getUserName())){
                                                treeModel.insertNodeInto(new VCIBaseTreeNode(userObject.toString(), userObject), selectNode, selectNode.getChildCount());
                                            }
                                        }
                                    }
//                                    else{
//                                        treeModel.insertNodeInto(new VCIBaseTreeNode(userObject.toString(), userObject), selectNode, selectNode.getChildCount());
//                                    }
                                }
                                
                            } catch (VCIException e) {
                                e.printStackTrace();
                                return;
                            }
                        }
                    }
                    if (object instanceof RoleObject) {
                        RoleObject role = (RoleObject) object;
                        if (role.getId().equals("root")) {
                            try {
                                RoleObject[] roleInfos = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchRoleInfo();
 
                                for (RoleObject roleObject : roleInfos) {
                                    if(roleValue!=null&&!"".equals(roleValue)){
                                        String[] split = roleValue.split(",");
                                        for(String roleSplit : split){
                                            if(roleSplit.equals(roleObject.getId())){
                                                treeModel.insertNodeInto(new VCIBaseTreeNode(roleObject.getName(), roleObject), selectNode, selectNode.getChildCount());
                                            }
                                        }
                                    }
//                                    else{
//                                        treeModel.insertNodeInto(new VCIBaseTreeNode(roleObject.getName(), roleObject), selectNode, selectNode.getChildCount());
//                                    }
                                }
 
                            } catch (VCIException e) {
                                e.printStackTrace();
                                return;
                            }
                        }else{
                            try {
                                UserObject[] fetchUserInfoByRoleId = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByRoleId(role.getId(), role.getType());
                                for (UserObject userObject : fetchUserInfoByRoleId) {
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(userObject.getUserName(), userObject), selectNode, selectNode.getChildCount());
                                }
                            } catch (VCIException e) {
                                e.printStackTrace();
                            }
                        }
 
                    }
                    if (object instanceof DeptObject){
                        RightManagementClientDelegate del = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
                        try {
                            DeptObject[] DeptInfos = null;
                            DeptObject deptObject = (DeptObject) object;
                            if (deptObject.getId().equals("root")){
                                DeptInfos= new RightManagementClientDelegate(LogonApplication.getUserEntityObject())
                                                    .fetchDepartmentInfo();
                                
                            }else{
                                DeptInfos = new RightManagementClientDelegate(LogonApplication.getUserEntityObject())
                                                      .fetchDepartmentInfoByParentId(deptObject.getId());
                            }
                            if (DeptInfos == null){
                                if (!deptObject.getId().equals("root")){
                                    UserObject[] objs = del.getUserByDeptId(deptObject.getId());
                                    for(int i=0;i<objs.length;i++) {
                                        treeModel.insertNodeInto(new VCIBaseTreeNode(objs[i].getUserName(), objs[i]),selectNode,selectNode.getChildCount());
                                    }
                                }else{
                                    return;
                                }
                            }
                            int len = DeptInfos==null?0:DeptInfos.length;
                            for (int i = 0; i < len; i++) {
                                if(departmentValue!=null&&!"".equals(departmentValue)){
                                    String[] split = departmentValue.split(",");
                                    for(String deptmentSplit : split){
                                        if(deptmentSplit.equals(DeptInfos[i].getId())){
                                            treeModel.insertNodeInto(new VCIBaseTreeNode(DeptInfos[i].getName(), DeptInfos[i]),selectNode,selectNode.getChildCount());
                                        }
                                    }
                                }
//                                else{
//                                    treeModel.insertNodeInto(new VCIBaseTreeNode(DeptInfos[i].getName(), DeptInfos[i]),selectNode,selectNode.getChildCount());
//                                }
                            }
                            
                        } catch (VCIException e) {
                            e.printStackTrace();
                            return;
                        }            
                    }
//                }
            }
 
            public void treeCollapsed(TreeExpansionEvent arg0) {
 
            }
        });
        transmitTreeObject.setTreeModel(treeModel);
        transmitTreeObject.setTree(rightManagementTree);
        
    }
    private void initUI() {
        setSize(780, 600);
 
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));
 
        
        JPanel panel_1 = new JPanel();
        panel_1.setLayout(new BorderLayout(0, 0));
        panel.add(panel_1, BorderLayout.CENTER);
        
        JPanel panel_3 = new JPanel();
        FlowLayout flowLayout = (FlowLayout) panel_3.getLayout();
        flowLayout.setAlignment(FlowLayout.RIGHT);
        panel_1.add(panel_3, BorderLayout.SOUTH);
        
        commit = new JButton("提交");
        panel_3.add(commit);
        
        cancel = new JButton("关闭");
        panel_3.add(cancel);
        {
            {
                taskListModel = new DefaultListModel();
            }
        }
        {
            {
                rootNode = new VCIBaseTreeNode("人员组织", "root");
                treeModel = new VCIBaseTreeModel(rootNode);
//                initUserTree(rootNode, "root");
//                initRoleTree(rootNode, "root");
//                initDepartTree(rootNode, "root");
            }
        }
        {
            {
                resultListModel = new DefaultListModel();
            }
        }
        
                    JPanel panel_4 = new JPanel();
                    panel_1.add(panel_4, BorderLayout.CENTER);
                    panel_4.setBorder(new TitledBorder(null, "\u6D41\u7A0B", TitledBorder.LEADING, TitledBorder.TOP, null, null));
                    GridBagLayout gbl_panel_5 = new GridBagLayout();
                    gbl_panel_5.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
                    gbl_panel_5.rowHeights = new int[] { 0, 0, 0 };
                    gbl_panel_5.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 1.0,
                            0.0, 1.0, Double.MIN_VALUE };
                    gbl_panel_5.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
                    panel_4.setLayout(gbl_panel_5);
                    {
                        JLabel label_5 = new JLabel("任务列表");
                        GridBagConstraints gbc_label_5 = new GridBagConstraints();
                        gbc_label_5.insets = new Insets(0, 0, 0, 5);
                        gbc_label_5.gridx = 1;
                        gbc_label_5.gridy = 1;
                        panel_4.add(label_5, gbc_label_5);
                    }
                    JScrollPane scrollPane_4 = new JScrollPane();
                    GridBagConstraints gbc_scrollPane_4 = new GridBagConstraints();
                    gbc_scrollPane_4.insets = new Insets(0, 0, 0, 5);
                    gbc_scrollPane_4.fill = GridBagConstraints.BOTH;
                    gbc_scrollPane_4.gridx = 2;
                    gbc_scrollPane_4.gridy = 1;
                    panel_4.add(scrollPane_4, gbc_scrollPane_4);
                    taskList = new JList();
                    taskList.setModel(taskListModel);
                    scrollPane_4.setViewportView(taskList);
                    {
                        JLabel userListLab = new JLabel("人员列表");
                        GridBagConstraints gbc_userListLab = new GridBagConstraints();
                        gbc_userListLab.insets = new Insets(0, 0, 0, 5);
                        gbc_userListLab.gridx = 3;
                        gbc_userListLab.gridy = 1;
                        panel_4.add(userListLab, gbc_userListLab);
                    }
                    JScrollPane scrollPane = new JScrollPane();
                    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
                    gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
                    gbc_scrollPane.fill = GridBagConstraints.BOTH;
                    gbc_scrollPane.gridx = 4;
                    gbc_scrollPane.gridy = 1;
                    panel_4.add(scrollPane, gbc_scrollPane);
                    rightManagementTree = new VCIBaseTree(treeModel,
                            new RightManagementTreeCellRenderer());
                    scrollPane.setViewportView(rightManagementTree);
                    {
                        JPanel panel_5 = new JPanel();
                        GridBagConstraints gbc_panel_3 = new GridBagConstraints();
                        gbc_panel_3.insets = new Insets(0, 0, 0, 5);
                        gbc_panel_3.fill = GridBagConstraints.BOTH;
                        gbc_panel_3.gridx = 5;
                        gbc_panel_3.gridy = 1;
                        panel_4.add(panel_5, gbc_panel_3);
                        GridBagLayout gbl_panel_3 = new GridBagLayout();
                        gbl_panel_3.columnWidths = new int[] { 45, 0 };
                        gbl_panel_3.rowHeights = new int[] { 23, 0, 0, 0, 0, 0 };
                        gbl_panel_3.columnWeights = new double[] { 0.0,
                                Double.MIN_VALUE };
                        gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0,
                                0.0, Double.MIN_VALUE };
                        panel_5.setLayout(gbl_panel_3);
                        {
                            JButton btnNewButton = new JButton(">>");
                            btnNewButton.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    int selectedIndex = taskList.getSelectedIndex();
                                    if (selectedIndex == -1) {
                                        VCIOptionPane.showMessage(
                                                LogonApplication.frame, "请选择任务!");
                                        return;
                                    }
                                    addToUserListFromTreeNode(true);
                                    taskAndUserMap.put(
                                            (String) taskList.getSelectedValue(),
                                            resultList);
                                    taskAndUserMap_1.put((String) taskList.getSelectedValue(), tmpListModel);
                                    userList.setModel(resultListModel);
                                    userList.updateUI();
                                }
                            });
                            GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
                            gbc_btnNewButton.anchor = GridBagConstraints.NORTHWEST;
                            gbc_btnNewButton.insets = new Insets(0, 0, 5, 0);
                            gbc_btnNewButton.gridx = 0;
                            gbc_btnNewButton.gridy = 2;
                            panel_5.add(btnNewButton, gbc_btnNewButton);
                        }
                        {
                            JButton btnNewButton_1 = new JButton("<<");
                            btnNewButton_1.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    removeUserFromUserList(true);
                                }
                            });
                            GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints();
                            gbc_btnNewButton_1.anchor = GridBagConstraints.NORTHWEST;
                            gbc_btnNewButton_1.gridx = 0;
                            gbc_btnNewButton_1.gridy = 4;
                            panel_5.add(btnNewButton_1, gbc_btnNewButton_1);
                        }
                    }
                    JScrollPane scrollPane_5 = new JScrollPane();
                    GridBagConstraints gbc_scrollPane_5 = new GridBagConstraints();
                    gbc_scrollPane_5.fill = GridBagConstraints.BOTH;
                    gbc_scrollPane_5.gridx = 6;
                    gbc_scrollPane_5.gridy = 1;
                    panel_4.add(scrollPane_5, gbc_scrollPane_5);
                    userList = new JList();
                    userList.setModel(resultListModel);
                    scrollPane_5.setViewportView(userList);
    }
 
    /**
     * 居中屏幕
     */
    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;
        }
 
        setLocation((screenSize.width - componentSize.width) / 2, (screenSize.height - componentSize.height) / 2);
    }
 
    private String getI18nString(String spCode) {
        return ClientHelper.getI18nStringForWorkflow(this.getClass().getName() + "." + spCode, this.getLocale());
    }
 
    private String getI18nStringByCode(String spCode) {
        return ClientHelper.getI18nStringForWorkflow(spCode, this.getLocale());
    }
    
    private void initUserTree(VCIBaseTreeNode rootNode, String puid) {
        String userName = LogonApplication.getUserEntityObject().getUserName();
        try {
            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            return;
        }
        UserObject userObject = new UserObject();
        userObject.setId("root");
        VCIBaseTreeNode userNode = new VCIBaseTreeNode("用户", userObject);
        rootNode.add(userNode);
    }
    private void initRoleTree(VCIBaseTreeNode rootNode, String puid) {
        String userName = LogonApplication.getUserEntityObject().getUserName();
        try {
            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            return;
        }
        RoleObject roleObject = new RoleObject();
        roleObject.setId("root");
        VCIBaseTreeNode roleNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.stafforg.menu.role", "RMIPFramework", getLocale()), roleObject);
        rootNode.add(roleNode);
 
    }
    private void initDepartTree(VCIBaseTreeNode rootNode, String puid) {
        String userName = LogonApplication.getUserEntityObject().getUserName();
        try {
            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            return;
        }
        DeptObject rootDepartment = new DeptObject();
        rootDepartment.setId("root");
        VCIBaseTreeNode departmentNode = new VCIBaseTreeNode(
                LocaleDisplay.getI18nString("rmip.stafforg.menu.department",
                        "RMIPFramework", getLocale()), rootDepartment);
        rootNode.add(departmentNode);
    }
    private void addToUserListFromTreeNode(boolean batch){
        LinkedList<VCIBaseTreeNode> nodeList = new LinkedList<VCIBaseTreeNode>();
        TreePath[] paths = rightManagementTree.getSelectionPaths();
        if(batch && paths != null){
            for(TreePath path : paths){
                nodeList.add((VCIBaseTreeNode)path.getLastPathComponent());
            }
        } else{
            nodeList.add(transmitTreeObject.getCurrentTreeNode());
        }
//        for(VCIBaseTreeNode selectNode : nodeList){
//            if(selectNode == null) continue;
//            Object object = selectNode.getObj();
//            if (object instanceof UserObject) {
//                UserObject user = (UserObject) object;
//                if("root".equals(user.getId())){
//                    continue;
//                }
//                if(checkUserIdAdded(user)) return;
//                resultListModel.addElement(object);
//                resultList.add(user);
//            }
//        }
        for(VCIBaseTreeNode selectNode : nodeList){
            if(selectNode == null) continue;
            Object object = selectNode.getObj();
            if (object instanceof UserObject) {
                UserObject user = (UserObject) object;
                if("root".equals(user.getId())){
                    continue;
                }
                if(checkUserIdAdded(user)) return;
                resultListModel.addElement(object);
                tmpListModel.addElement(object);
                resultList.add("user:"+user.getUserName());
            }
            if (object instanceof RoleObject) {
                RoleObject role = (RoleObject) object;
                if("root".equals(role.getId())){
                    continue;
                }
                if(checkRoleIdAdded(role)) return;
                resultListModel.addElement(object);
                tmpListModel.addElement(object);
                resultList.add("role:"+role.getName());
            }
            if (object instanceof DeptObject) {
                DeptObject dept = (DeptObject) object;
                if("root".equals(dept.getId())){
                    continue;
                }
                if(checkDeptIdAdded(dept)) return;
                resultListModel.addElement(object);
                tmpListModel.addElement(object);
                resultList.add("department:"+dept.getName());
            }
        }
    }
    private boolean checkUserIdAdded(UserObject obj){
        boolean res = false;
        int size = resultListModel.getSize();
        for(int i = 0; i < size; i++){
            if(resultListModel.get(i) instanceof UserObject){
                res = obj.getId().equals(((UserObject)resultListModel.get(i)).getId());
                if(res) break;
            }
        }
        return res;
    }
    private void removeUserFromUserList(boolean batch){
        Object[] selectedIndices = userList.getSelectedValues();
        if(!batch){
            selectedIndices = new Object[]{userList.getSelectedValue()};
        }
        for(int i =0;i<selectedIndices.length;i++){
            resultListModel.removeElement(selectedIndices[i]);
            resultList.remove(selectedIndices[i]);
        }
    }
    private void initTaskList(){
        ProcessCustomClientDelegate delegate = new ProcessCustomClientDelegate();
        try {
            taskListModel.clear();
            String jbpmDeploymentId = delegate.getDeploymentIdByExecutionId(executionId);
            String[] allTaskNames = delegate.getAllTaskNames(jbpmDeploymentId);
            for(int i=0;i<allTaskNames.length;i++){
                if(!allTaskNames[i].equals(taskName)){
                    taskListModel.addElement(allTaskNames[i]);
                }
            }
            if(taskListModel.size()>0){
                initUserTree(rootNode, "root");
                initRoleTree(rootNode, "root");
                initDepartTree(rootNode, "root");
            }
        } catch (VCIException e) {
            e.printStackTrace();
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    private boolean checkRoleIdAdded(RoleObject obj){
        boolean res = false;
        int size = resultListModel.getSize();
        for(int i = 0; i < size; i++){
            if(resultListModel.get(i) instanceof RoleObject){
                res = obj.getId().equals(((RoleObject)resultListModel.get(i)).getId());
                if(res) break;
            }else{
                res = obj.getName().equals(resultListModel.get(i));
                if(res) break;
            }
        }
        return res;
    }
    private boolean checkDeptIdAdded(DeptObject obj){
        boolean res = false;
        int size = resultListModel.getSize();
        for(int i = 0; i < size; i++){
            if(resultListModel.get(i) instanceof DeptObject){
                res = obj.getId().equals(((DeptObject)resultListModel.get(i)).getId());
                if(res) break;
            }else{
                res = obj.getName().equals(resultListModel.get(i));
                if(res) break;
            }
        }
        return res;
    }
}