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
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
package com.vci.client.workflow.editor.user;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
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.ButtonGroup;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreePath;
 
import org.dom4j.DocumentException;
 
import com.vci.client.LogonApplication;
import com.vci.client.bof.ClientBusinessObject;
import com.vci.client.bof.ClientBusinessObjectOperation;
import com.vci.client.bof.ClientLinkObjectOperation;
import com.vci.client.common.TransmitTreeObject;
import com.vci.client.common.oq.OQTool;
import com.vci.client.framework.systemConfig.stafforgmanage.RightManagementTreeCellRenderer;
import com.vci.client.oq.QTClient;
import com.vci.client.portal.utility.TableDataUtil;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.KJButton;
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.common.qt.object.Condition;
import com.vci.common.qt.object.QueryTemplate;
import com.vci.corba.common.VCIError;
import com.vci.corba.omd.data.BusinessObject;
 
public class TaskUserDialog extends VCIJDialog {
    
    private ButtonGroup bgroup = new ButtonGroup();
    
    private JRadioButton allUserBtn = new JRadioButton("所有人");
    private JRadioButton creatorBtn = new JRadioButton("拟稿人");
    private JRadioButton creator_departmentBtn = new JRadioButton("拟稿人所在部门");
    private JRadioButton owner_departmentBtn = new JRadioButton("当前处理人所在部门");
    private JRadioButton allLeadersBtn = new JRadioButton("所有领导");
    private JRadioButton allSecretsBtn = new JRadioButton("所有秘书");
    private JRadioButton creator_department_leaderBtn = new JRadioButton("拟稿人所在部门领导");
    private JRadioButton owner_department_leaderBtn = new JRadioButton("当前处理人所在部门领导");
    private JRadioButton curNodeUserBtn = new JRadioButton("当前节点处理人");
    private JRadioButton postAllUsersBtn = new JRadioButton("某一级别的所有人");
    private JRadioButton nodeUserBtn = new JRadioButton("某一节点处理人");
    private JRadioButton selectByFormBtn = new JRadioButton("从业务表单中选择");
    private JRadioButton owner_deptBtn = new JRadioButton("当前人的自定义组");
    private JRadioButton owner_organizationBtn = new JRadioButton("当前处理人的一级部门");
    private JRadioButton reflectClassBtn = new JRadioButton("反射类名");
    
    RadioButtonListener radioBtnListener = new RadioButtonListener();
    private String selectJBtnText = "所有人";
    private String selectJBtnClass = "all";
    
    private JList list;
    private DefaultListModel listModel;
    private DefaultListModel departmentlistModel = new DefaultListModel();
    private JList departmentlist = new JList(departmentlistModel);
    private DefaultListModel rolelistModel = new DefaultListModel();
    private JList rolelist = new JList(rolelistModel);
    private DefaultListModel deptlistModel = new DefaultListModel();
    private JList deptlist = new JList(deptlistModel);
    private DefaultListModel linelistModel = new DefaultListModel();
    private JList linelist = new JList(linelistModel);
    private DefaultListModel deptUserlistModel = new DefaultListModel();
    private JList deptUserlist = new JList(deptUserlistModel);
    
    private String userName = LogonApplication.getUserEntityObject().getUserName();
    private List<Object> resultList = new ArrayList<Object>();
    private List<Object> departresultList = new ArrayList<Object>();
    private List<Object> roleresultList = new ArrayList<Object>();
    private List<Object> deptresultList = new ArrayList<Object>();
    private List<Object> lineresultList = new ArrayList<Object>();
    private List<Object> lineShowList = new ArrayList<Object>();
    private List<Object> deptUserresultList = new ArrayList<Object>();
    private VCIBaseTree rightManagementTree;
    private VCIBaseTreeModel treeModel;
    private VCIBaseTreeNode rootNode = new VCIBaseTreeNode("人员组织", "root");
    
    private TransmitTreeObject transmitTreeObject = new TransmitTreeObject();
 
    
    private ClientLinkObjectOperation cloo = new ClientLinkObjectOperation();
    private ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
    
    //初始化tab页面
    private JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    //当前选中的页签
    private String selectedPanelFlag = "用户部门";
//    用户部门
    private JPanel deptPanel = new JPanel();
//    用户角色
    private JPanel rolePanel = new JPanel();
//    用户群组
    private JPanel orgPanel = new JPanel();
//    用户关系
    private JPanel relationPanel = new JPanel();
//    部门用户关系
    JPanel deptAndUserPanel = new JPanel();
    
    private KJButton okBtn = new KJButton("确定", "ok.gif");
    private KJButton cancelBtn = new KJButton("取消", "cancel.gif");
    
    private boolean initTruth = true;
    //左侧的JScrollPane
    JScrollPane scrollPane = new JScrollPane();
    //右侧的JScrollPane
    JScrollPane scrollPane_1 = new JScrollPane();
    
    JButton rightChose = new JButton(">>");
    JButton liftRight = new JButton("<<");
    
    List<String[]> deptAndUserList = new ArrayList<String[]>();
    
    public List<Object> getLineShowList() {
        return lineShowList;
    }
    public void setLineShowList(List<Object> lineShowList) {
        this.lineShowList = lineShowList;
    }
    public List<Object> getDepartresultList() {
        return departresultList;
    }
    public void setDepartresultList(List<Object> departresultList) {
        this.departresultList = departresultList;
    }
    public List<Object> getRoleresultList() {
        return roleresultList;
    }
    public void setRoleresultList(List<Object> roleresultList) {
        this.roleresultList = roleresultList;
    }
    public List<Object> getDeptresultList() {
        return deptresultList;
    }
    public void setDeptresultList(List<Object> deptresultList) {
        this.deptresultList = deptresultList;
    }
    public List<Object> getLineresultList() {
        return lineresultList;
    }
    public void setLineresultList(List<Object> lineresultList) {
        this.lineresultList = lineresultList;
    }
    public List<Object> getDeptUserresultList() {
        return deptUserresultList;
    }
    public void setDeptUserresultList(List<Object> deptUserresultList) {
        this.deptUserresultList = deptUserresultList;
    }
    public List<String[]> getDeptAndUserList() {
        return deptAndUserList;
    }
    public void setDeptAndUserList(List<String[]> deptAndUserList) {
        this.deptAndUserList = deptAndUserList;
    }
    public DefaultListModel getListModel() {
        return listModel;
    }
    public void setListModel(DefaultListModel listModel) {
        this.listModel = listModel;
    }
    public List<Object> getResultList() {
        return resultList;
    }
    public void setResultList(List<Object> resultList) {
        this.resultList = resultList;
    }
    public String getSelectedPanelFlag() {
        return selectedPanelFlag;
    }
    public void setSelectedPanelFlag(String selectedPanelFlag) {
        this.selectedPanelFlag = selectedPanelFlag;
    }
    public TaskUserDialog() {
        super(LogonApplication.frame, true);
        initData();
        initUI();
        addListener();
        this.setLocationRelativeTo(null);
    }
    private void initUI() {
        setSize(680, 500);
        setTitle("处理人设置");
        centerToScreen();
        
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));
        panel.add(tabbedPane, BorderLayout.CENTER);
        tabbedPane.addTab("用户部门", null, deptPanel, null);
        tabbedPane.addTab("用户角色", null, rolePanel, null);
        tabbedPane.addTab("用户群组", null, orgPanel, null);
        tabbedPane.addTab("用户关系", null, relationPanel, null);
        tabbedPane.addTab("部门用户关系", null, deptAndUserPanel, null);
        
        //初始化tab页数据
        initTabPanel(selectedPanelFlag);
        
    }
    protected void initTabPanel(String selectedPanelFlag) {
        JPanel totalPanel = new JPanel();
        totalPanel.setLayout(new BorderLayout(0, 0));
        if ("用户部门".equals(selectedPanelFlag)) {
            if (deptPanel.getComponents().length == 0) {
                deptPanel.add(totalPanel);
            } else {
                deptPanel.removeAll();
                deptPanel.add(totalPanel);
            }
        } else if ("用户角色".equals(selectedPanelFlag)) {
            if (rolePanel.getComponents().length == 0) {
                rolePanel.add(totalPanel);
            } else {
                rolePanel.removeAll();
                rolePanel.add(totalPanel);
            }
        } else if ("用户群组".equals(selectedPanelFlag)) {
            if (orgPanel.getComponents().length == 0) {
                orgPanel.add(totalPanel);
            } else {
                orgPanel.removeAll();
                orgPanel.add(totalPanel);
            }
        } else if ("用户关系".equals(selectedPanelFlag)) {
            if (relationPanel.getComponents().length == 0) {
                relationPanel.add(totalPanel);
            } else {
                relationPanel.removeAll();
                relationPanel.add(totalPanel);
            }
        } else if ("部门用户关系".equals(selectedPanelFlag)) {
            if (deptAndUserPanel.getComponents().length == 0) {
                deptAndUserPanel.add(totalPanel);
            } else {
                deptAndUserPanel.removeAll();
                deptAndUserPanel.add(totalPanel);
            }
        }
 
        JPanel panel_3 = new JPanel();
        totalPanel.add(panel_3, BorderLayout.SOUTH);
        okBtn = new KJButton("确定", "ok.gif");
        cancelBtn = new KJButton("取消", "ok.gif");
        panel_3.add(okBtn);
        panel_3.add(cancelBtn);
 
        JPanel panel_1 = new JPanel();
        totalPanel.add(panel_1, BorderLayout.CENTER);
        GridBagLayout gbl_panel_1 = new GridBagLayout();
        panel_1.setLayout(gbl_panel_1);
 
        JPanel panel_2 = new JPanel();
        GridBagConstraints gbc_panel_2 = new GridBagConstraints();
        gbc_panel_2.weighty = 1.0;
        gbc_panel_2.weightx = 1.0;
        gbc_panel_2.insets = new Insets(0, 0, 0, 5);
        gbc_panel_2.fill = GridBagConstraints.BOTH;
        gbc_panel_2.gridx = 0;
        gbc_panel_2.gridy = 0;
        panel_1.add(panel_2, gbc_panel_2);
        panel_2.setLayout(new BorderLayout(0, 0));
        Dimension listDim = new Dimension(250, 350);
        
        if ("用户关系".equals(selectedPanelFlag)) {
            GridLayout layout = new GridLayout(15, 1);
            panel_2.setLayout(layout);
            panel_2.add(allUserBtn);
            panel_2.add(creatorBtn);
            panel_2.add(creator_departmentBtn);
            panel_2.add(owner_departmentBtn);
            panel_2.add(allLeadersBtn);
            panel_2.add(allSecretsBtn);
            panel_2.add(creator_department_leaderBtn);
            panel_2.add(owner_department_leaderBtn);
            panel_2.add(curNodeUserBtn);
            panel_2.add(postAllUsersBtn);
            panel_2.add(nodeUserBtn);
            panel_2.add(selectByFormBtn);
            panel_2.add(owner_deptBtn);
            panel_2.add(owner_organizationBtn);
            panel_2.add(reflectClassBtn);
        } else {
            //初始化设置用户部门树
            scrollPane = new JScrollPane();
            panel_2.add(scrollPane);
            scrollPane.setPreferredSize(listDim);
            
            VCIBaseTreeNode rootNode = new VCIBaseTreeNode(selectedPanelFlag, "root");
            treeModel = new VCIBaseTreeModel(rootNode);
            initUserTree(rootNode, "root");
            rightManagementTree = new VCIBaseTree(treeModel, new RightManagementTreeCellRenderer());
            scrollPane.setViewportView(rightManagementTree);
        }
 
        JPanel panel_5 = new JPanel();
        GridBagConstraints gbc_panel_5 = new GridBagConstraints();
        gbc_panel_5.weightx = 1.0;
        gbc_panel_5.weighty = 1.0;
        gbc_panel_5.insets = new Insets(0, 0, 0, 5);
        gbc_panel_5.fill = GridBagConstraints.NONE;
        gbc_panel_5.gridx = 1;
        gbc_panel_5.gridy = 0;
        panel_1.add(panel_5, gbc_panel_5);
        panel_5.setLayout(new BorderLayout(0, 0));
        
        rightChose = new JButton(">>");
        liftRight = new JButton("<<");
        panel_5.add(rightChose,BorderLayout.NORTH);
        panel_5.add(liftRight);
        
        JPanel panel_4 = new JPanel();
        GridBagConstraints gbc_panel_4 = new GridBagConstraints();
        gbc_panel_4.weightx = 1.0;
        gbc_panel_4.weighty = 1.0;
        gbc_panel_4.insets = new Insets(0, 0, 0, 5);
        gbc_panel_4.fill = GridBagConstraints.BOTH;
        gbc_panel_4.gridx = 2;
        gbc_panel_4.gridy = 0;
        panel_1.add(panel_4, gbc_panel_4);
        panel_4.setLayout(new BorderLayout(0, 0));
 
        scrollPane_1 = new JScrollPane();
        panel_4.add(scrollPane_1);
        if ("用户部门".equals(selectedPanelFlag)) {
            scrollPane_1.setViewportView(departmentlist);
        } else if ("用户角色".equals(selectedPanelFlag)) {
            scrollPane_1.setViewportView(rolelist);
        } else if ("用户群组".equals(selectedPanelFlag)) {
            scrollPane_1.setViewportView(deptlist);
        } else if ("用户关系".equals(selectedPanelFlag)) {
            scrollPane_1.setViewportView(linelist);
        } else if ("部门用户关系".equals(selectedPanelFlag)) {
            scrollPane_1.setViewportView(deptUserlist);
        }
        
//        listModel = new DefaultListModel();
//        list = new JList(listModel);
//        list.setBackground(Color.WHITE);
//        scrollPane_1.setViewportView(list);
        scrollPane_1.setPreferredSize(listDim);
        //重新给控件添加方法
        addListener();
        this.initTruth = false;
    }
    private void initData() {
        bgroup.add(allUserBtn);
        bgroup.add(creatorBtn);
        bgroup.add(creator_departmentBtn);
        bgroup.add(owner_departmentBtn);
        bgroup.add(allLeadersBtn);
        bgroup.add(allSecretsBtn);
        bgroup.add(creator_department_leaderBtn);
        bgroup.add(owner_department_leaderBtn);
        bgroup.add(curNodeUserBtn);
        bgroup.add(postAllUsersBtn);
        bgroup.add(nodeUserBtn);
        bgroup.add(selectByFormBtn);
        bgroup.add(owner_deptBtn);
        bgroup.add(owner_organizationBtn);
        bgroup.add(reflectClassBtn);
        allUserBtn.setSelected(true);
    }
    
    private void addListener() {
        allUserBtn.addActionListener(radioBtnListener);
        creatorBtn.addActionListener(radioBtnListener);
        creator_departmentBtn.addActionListener(radioBtnListener);
        owner_departmentBtn.addActionListener(radioBtnListener);
        allLeadersBtn.addActionListener(radioBtnListener);
        allSecretsBtn.addActionListener(radioBtnListener);
        creator_department_leaderBtn.addActionListener(radioBtnListener);
        owner_department_leaderBtn.addActionListener(radioBtnListener);
        curNodeUserBtn.addActionListener(radioBtnListener);
        postAllUsersBtn.addActionListener(radioBtnListener);
        nodeUserBtn.addActionListener(radioBtnListener);
        selectByFormBtn.addActionListener(radioBtnListener);
        owner_deptBtn.addActionListener(radioBtnListener);
        owner_organizationBtn.addActionListener(radioBtnListener);
        reflectClassBtn.addActionListener(radioBtnListener);
        //tab页面变化的方法
        if(this.initTruth) {
            tabbedPane.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    int num = tabbedPane.getSelectedIndex();
                    String title = tabbedPane.getTitleAt(num);
                    selectedPanelFlag = title;
                    initTabPanel(selectedPanelFlag);
                }
            });
        }
        
        rightChose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if ("用户关系".equals(selectedPanelFlag)) {
                    boolean res = true;
                    int size = linelistModel.getSize();
                    for(int i = 0; i < size; i++){
                        if(linelistModel.get(i).equals(selectJBtnText)){
                            res = false;
                            break;
                        }
                    }
                    if (res) {
                        linelistModel.addElement(selectJBtnText);
                        lineShowList.add(selectJBtnText);
                        lineresultList.add(selectJBtnClass);
                    }
                } else {
                    addToUserListFromTreeNode(false);
                }
            }
        });
        
        liftRight.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                removeUserFromUserList(false);
            }
        });
        
        okBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                dispose();
            }
        });
 
        cancelBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                departmentlistModel = new DefaultListModel();
                departresultList = new ArrayList<Object>();
                rolelistModel = new DefaultListModel();
                roleresultList = new ArrayList<Object>();
                deptlistModel = new DefaultListModel();
                deptresultList = new ArrayList<Object>();
                linelistModel = new DefaultListModel();
                lineresultList = new ArrayList<Object>();
                deptUserlistModel = new DefaultListModel();
                deptUserresultList = new ArrayList<Object>();
                deptAndUserList = new ArrayList<String[]>();
                dispose();
            }
        });
        rightManagementTree.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                if(e.getClickCount() != 2) return;
                TreePath path = rightManagementTree.getPathForLocation(e.getX(), e.getY());
                if(path == null) return;
                if(path != null && !(path.getLastPathComponent() instanceof VCIBaseTreeNode)) return;
                VCIBaseTreeNode clickedNode = (VCIBaseTreeNode)path.getLastPathComponent();
                if(clickedNode.getLevel()<2) return;
                transmitTreeObject.setCurrentTreeNode(clickedNode);
                addToUserListFromTreeNode(true);
            }
        });
        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();
                String objClsName = object.getClass().getName();
                if (!selectNode.isExpand() && "plm.bs.bom.clientobject.ClientBusinessObject".equals(objClsName)) {
                    selectNode.setExpand(true);
                    transmitTreeObject.getCurrentTreeNode().removeAllChildren();
                    
                    if ("用户部门".equals(selectedPanelFlag)) {
                        ClientBusinessObject cboObject = (ClientBusinessObject) object;
                        Map<String, String> map = new HashMap<String, String>();
                        try {
                            if ("root".equals(cboObject.getId())) {
                                List<ClientBusinessObject> list = searchBo("department", map);
                                for (int i = 0; i < list.size(); i++) {
                                    ClientBusinessObject cbo = list.get(i);
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                }
                            } else {
                                Map<String, String> conditionMap = new HashMap<String, String>();
                                conditionMap.put("isparttime", "0");
                                conditionMap.put("f_oid", cboObject.getOid());
//                                List<Map<String, String>> dataModel = searchLo("deptPersonTemplate", "deptperson", conditionMap);
                                List<Map<String, String>> dataModel = searchLo("deptUserTemplate", "deptuser", conditionMap);
                                if (dataModel != null && dataModel.size() > 0) {
                                    for (int i = 0 ; i < dataModel.size(); i++) {
                                        Map<String, String> personMap = dataModel.get(i);
                                        String userId = (String) personMap.get("oid");
//                                        ClientBusinessObject cbo = cboo.readBusinessObjectById(userId, "person");
                                        ClientBusinessObject cbo = cboo.readBusinessObjectById(userId, "user");
                                        treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                    }
                                }
                            }
                        } catch (VCIError e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        } catch (DocumentException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }
                    else if ("用户角色".equals(selectedPanelFlag)) {
                        ClientBusinessObject cboObject = (ClientBusinessObject) object;
                        Map<String, String> map = new HashMap<String, String>();
                        try {
                            if ("root".equals(cboObject.getId())) {
                                List<ClientBusinessObject> list = searchBo("role", map);
                                for (int i = 0; i < list.size(); i++) {
                                    ClientBusinessObject cbo = list.get(i);
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                }
                            } else {
                                Map<String, String> conditionMap = new HashMap<String, String>();
                                conditionMap.put("f_oid", cboObject.getOid());
//                                List<Map<String, String>> dataModel = searchLo("rolePersonTemplate", "roleperson", conditionMap);
                                List<Map<String, String>> dataModel = searchLo("roleUserTemplate", "roleuser", conditionMap);
                                if (dataModel != null && dataModel.size() > 0) {
                                    for (int i = 0 ; i < dataModel.size(); i++) {
                                        Map<String, String> personMap = dataModel.get(i);
                                        String userId = (String) personMap.get("oid");
//                                        ClientBusinessObject cbo = cboo.readBusinessObjectById(userId, "person");
                                        ClientBusinessObject cbo = cboo.readBusinessObjectById(userId, "user");
                                        treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                    }
                                }
                            }
                        } catch (VCIError e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        } catch (DocumentException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }
                    else if ("用户群组".equals(selectedPanelFlag)) {
                        ClientBusinessObject cboObject = (ClientBusinessObject) object;
                        Map<String, String> map = new HashMap<String, String>();
                        try {
                            if ("root".equals(cboObject.getId())) {
                                List<ClientBusinessObject> list = searchBo("organization", map);
                                for (int i = 0; i < list.size(); i++) {
                                    ClientBusinessObject cbo = list.get(i);
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                }
                            } else {
                                Map<String, String> conditionMap = new HashMap<String, String>();
                                conditionMap.put("f_oid", cboObject.getOid());
//                                List<Map<String, String>> dataModel = searchLo("orgpersonTemplate", "orgperson", conditionMap);
                                List<Map<String, String>> dataModel = searchLo("orgUserTemplate", "orguser", conditionMap);
                                if (dataModel != null && dataModel.size() > 0) {
                                    for (int i = 0 ; i < dataModel.size(); i++) {
                                        Map<String, String> personMap = dataModel.get(i);
                                        String userId = (String) personMap.get("oid");
//                                        ClientBusinessObject cbo = cboo.readBusinessObjectById(userId, "person");
                                        ClientBusinessObject cbo = cboo.readBusinessObjectById(userId, "user");
                                        treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                    }
                                }
                            }
                        } catch (VCIError e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        } catch (DocumentException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }
                    else if ("部门用户关系".equals(selectedPanelFlag)) {
                        ClientBusinessObject cboObject = (ClientBusinessObject) object;
                        Map<String, String> map = new HashMap<String, String>();
                        try {
                            if ("root".equals(cboObject.getId())) {
                                map.put("PARENTDEPT", "NULL");
                                List<ClientBusinessObject> list = searchBo("department", map);
                                for (int i = 0; i < list.size(); i++) {
                                    ClientBusinessObject cbo = list.get(i);
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                }
                            } else {
                                map.put("PARENTDEPT", cboObject.getOid());
                                List<ClientBusinessObject> list = searchBo("department", map);
                                for (int i = 0; i < list.size(); i++) {
                                    ClientBusinessObject cbo = list.get(i);
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(cbo.getName(), cbo), selectNode, selectNode.getChildCount());
                                }
                            }
                        } catch (VCIError e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }
                }
            }
            public void treeCollapsed(TreeExpansionEvent arg0) {
 
            }
        });
    }
    
    private static List<ClientBusinessObject> searchBo(String btmName, Map<String, String> queryCondition) throws VCIError{
        QueryTemplate qt = new QueryTemplate();
        qt.setId("queryBusinessQT");
        qt.setType("btm");
        qt.setBtmType(btmName);
        List<String> clauseList = new ArrayList<String>();
        clauseList.add("*");
        qt.setClauseList(clauseList);
        Condition condition = OQTool.getCondition(queryCondition);
        qt.setCondition(condition);
        BusinessObject[] bos = QTClient.getService().findBTMObjects(qt.getId(), OQTool.getQTTextByQT(qt));
        List<ClientBusinessObject> clos = new ArrayList<ClientBusinessObject>();
        if(bos != null && bos.length > 0){
            for(BusinessObject bo: bos){
                ClientBusinessObject cbo = new ClientBusinessObject();
                cbo.setBusinessObject(bo);
                clos.add(cbo);
            }
        }
        return clos;
    }
    
    private static List<Map<String, String>> searchLo(String qtName, String showType, Map<String, String> queryCondition) throws VCIError, DocumentException{
        Map<String, String> queryColumnsMap = new HashMap<String, String>();
        queryColumnsMap.put("*", "标题");
        TableDataUtil util = new TableDataUtil();
        List<Map<String, String>> dataModel = util.getObjectDataList(qtName, null,
                queryCondition , null, null, showType,
                queryColumnsMap, null, null);
 
        return dataModel;
    }
    
    /**
     * Description: 初始化人员组织结构树
     * @author cmk
     * @param rootNode
     * @param puid
     */
    private void initUserTree(VCIBaseTreeNode rootNode, String puid) {
//        try {
//            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
//        } catch (VCIException e) {
//            e.printStackTrace();
//            return;
//        }
        ClientBusinessObject cboObject = new ClientBusinessObject();
        cboObject.setId("root");
        VCIBaseTreeNode userNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.stafforg.menu.staff", "RMIPFramework", getLocale()), cboObject);
        rootNode.add(userNode);
        
    }
    
    private void removeUserFromUserList(boolean batch){
        if ("部门用户关系".equals(selectedPanelFlag)) {
            int[] selectedNum = deptUserlist.getSelectedIndices();
            for (int i = 0;i < selectedNum.length;i++) {
                deptUserlistModel.removeElementAt(selectedNum[i] - i);
                deptUserresultList.remove(selectedNum[i] - i);
                deptAndUserList.remove(selectedNum[i] - i);
            }
        } else if ("用户关系".equals(selectedPanelFlag)){
            int[] selectedNum = linelist.getSelectedIndices();
            for (int i = 0;i < selectedNum.length;i++) {
                linelistModel.removeElementAt(selectedNum[i] - i);
                lineresultList.remove(selectedNum[i] - i);
                lineShowList.remove(selectedNum[i] - i);
            }
        } else if ("用户部门".equals(selectedPanelFlag)){
            int[] selectedNum = departmentlist.getSelectedIndices();
            for (int i = 0;i < selectedNum.length;i++) {
                departmentlistModel.removeElementAt(selectedNum[i] - i);
                departresultList.remove(selectedNum[i] - i);
            }
        } else if ("用户角色".equals(selectedPanelFlag)){
            int[] selectedNum = rolelist.getSelectedIndices();
            for (int i = 0;i < selectedNum.length;i++) {
                rolelistModel.removeElementAt(selectedNum[i] - i);
                roleresultList.remove(selectedNum[i] - i);
            }
        } else if ("用户群组".equals(selectedPanelFlag)){
            int[] selectedNum = deptlist.getSelectedIndices();
            for (int i = 0;i < selectedNum.length;i++) {
                deptlistModel.removeElementAt(selectedNum[i] - i);
                deptresultList.remove(selectedNum[i] - i);
            }
        }
 
    }
    /**
     * 添加左侧节点数据
     * @param batch
     */
    private void addToUserListFromTreeNode(boolean batch){
        LinkedList<VCIBaseTreeNode> nodeList = new LinkedList<VCIBaseTreeNode>();
        TreePath[] paths = rightManagementTree.getSelectionPaths();
        if(batch && paths != null){
            if ("部门用户关系".equals(selectedPanelFlag)) {
                if(paths.length > 1){
                    JOptionPane.showMessageDialog(LogonApplication.frame, "请选择一个节点");
                    return;
                }
            }
            for(TreePath path : paths){
                nodeList.add((VCIBaseTreeNode)path.getLastPathComponent());
            }
        } else{
            nodeList.add(transmitTreeObject.getCurrentTreeNode());
        }
        for(VCIBaseTreeNode selectNode : nodeList){
            if(selectNode == null) {
                continue;
            } else {
                Object object = selectNode.getObj();
                if ("部门用户关系".equals(selectedPanelFlag)) {
                    DepartmentChooseDialog dialog = new DepartmentChooseDialog(((ClientBusinessObject) object).getOid());
                    dialog.setLocationRelativeTo(null);
                    dialog.setVisible(true);
                    
                    String isShowSubDept = dialog.getSelectDepartmentText().equals("显示子部门")?"Y":"N";
                    String isShowDeptPerson = dialog.getSelectDepartmentPersonText().equals("显示部门员工")?"Y":"N";
                    String selectedPost = dialog.getPostText();
                    String postId = dialog.getPostId();
                    if (postId != null && !"".equals(postId)) {
                        ClientBusinessObject cbo = (ClientBusinessObject) object;
                        if(checkUserIdAdded(cbo, deptUserresultList)) return;
                        String ele = ((ClientBusinessObject) object).getName() + ":" + selectedPost + ":" + isShowSubDept + ":" + isShowDeptPerson;
                        deptUserlistModel.addElement(ele);
                        String [] str = new String[2];
                        str[1] = ele;
                        str[0] = postId;
                        deptAndUserList.add(str);
                        deptUserresultList.add(object);
                    }
                } else {
                    if (object instanceof ClientBusinessObject) {
                        ClientBusinessObject cbo = (ClientBusinessObject) object;
                        if("root".equals(cbo.getId())){
                            continue;
                        }
                        if ("用户部门".equals(selectedPanelFlag)) {
                            if(checkUserIdAdded(cbo, departresultList)) return;
                            departmentlistModel.addElement(((ClientBusinessObject) object).getName());
                            departresultList.add(object);
                        } else if ("用户角色".equals(selectedPanelFlag)) {
                            if(checkUserIdAdded(cbo, roleresultList)) return;
                            rolelistModel.addElement(((ClientBusinessObject) object).getName());
                            roleresultList.add(object);
                        } else if ("用户群组".equals(selectedPanelFlag)) {
                            if(checkUserIdAdded(cbo, deptresultList)) return;
                            deptlistModel.addElement(((ClientBusinessObject) object).getName());
                            deptresultList.add(object);
                        }
                    }
                }
            }
        }
    }
    //判断用户是否已经被选中
    private boolean checkUserIdAdded(Object obj, List<Object> curlist){
        boolean res = false;
        int size = curlist.size();
        for(int i = 0; i < size; i++){
            if(curlist.get(i) instanceof ClientBusinessObject && obj instanceof ClientBusinessObject){
                obj = (ClientBusinessObject)obj;
                res = ((ClientBusinessObject) obj).getOid().equals(((ClientBusinessObject)curlist.get(i)).getOid());
                if(res) break;
            }
        }
        return res;
    }
    /**
     * 居中屏幕
     */
    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);
    }
    
    
    /**
     * 内部类--单选框点击事件
     * @author cmk
     *
     */
    class RadioButtonListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            JRadioButton btn = (JRadioButton) e.getSource();
            if (btn.isSelected()) {
                if ("反射类名".equals(btn.getText())) {
                    ReflectClassDialog dialog = new ReflectClassDialog();
                    dialog.setLocationRelativeTo(null);
                    dialog.setVisible(true);
                    
                    String reflectClass = dialog.getReflectClass();
                    if (reflectClass != null && !"".equals(reflectClass)) {
                        selectJBtnClass = reflectClass;
                        linelistModel.addElement(btn.getText());
                        lineShowList.add(btn.getText());
                        lineresultList.add(selectJBtnClass);
                    } else {
//                        return;
                    }
                    allUserBtn.setSelected(true);
                } else if ("所有人".equals(btn.getText())) {
                    selectJBtnClass = "expression:all";
                } else if ("拟稿人".equals(btn.getText())) {
                    selectJBtnClass = "expression:creator";
                } else if ("拟稿人所在部门".equals(btn.getText())) {
                    selectJBtnClass = "expression:creator.dept";
                } else if ("当前处理人所在部门".equals(btn.getText())) {
                    selectJBtnClass = "expression:owner.dept";
                } else if ("所有领导".equals(btn.getText())) {
                    selectJBtnClass = "expression:allleader";
                } else if ("所有秘书".equals(btn.getText())) {
                    selectJBtnClass = "expression:allsecretary";
                } else if ("拟稿人所在部门领导".equals(btn.getText())) {
                    selectJBtnClass = "expression:creator.dept.leader";
                } else if ("当前处理人所在部门领导".equals(btn.getText())) {
                    selectJBtnClass = "expression:owner.dept.leader";
                } else if ("当前节点处理人".equals(btn.getText())) {
                    selectJBtnClass = "expression:owner";
                } else if ("某一级别的所有人".equals(btn.getText())) {
                    selectJBtnClass = "expression:onenode.alluser";
                } else if ("某一节点处理人".equals(btn.getText())) {
                    selectJBtnClass = "expression:onenode.manager";
                } else if ("从业务表单中选择".equals(btn.getText())) {
                    selectJBtnClass = "expression:chooseByForm";
                } else if ("当前人的自定义组".equals(btn.getText())) {//暂不处理
                    selectJBtnClass = "expression:owner.customorg";
                } else if ("当前处理人的一级部门".equals(btn.getText())) {
                    selectJBtnClass = "expression:owner.childdept";
                }
                selectJBtnText = btn.getText();
                
//                btn.setSelected(false);
            }
        }
    }
}
 
//反射类名弹出框
class ReflectClassDialog extends VCIJDialog {
    private JButton okReflectClassBtn = new JButton("确定");
    private JButton cancelReflectClassBtn = new JButton("取消");
    private JLabel label = new JLabel("反射类名:");
    private JTextField textField = new JTextField();
    private String reflectClass = "";
    private boolean flag = false;
    
    public ReflectClassDialog() {
        this.setModal(true);
        initUI();
        addLisner();
    }
    
    private void initUI() {
        setSize(300, 110);
        setTitle("自定义反射类");
        
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 2));
        
        JPanel centerPanel = new JPanel(new FlowLayout());
//        centerPanel.add(label);
//        textField.setSize(120, 20);
//        centerPanel.add(textField);
        centerPanel.setLayout(new GridLayout(1, 2));
        centerPanel.add(label);
        centerPanel.add(textField);
        
        panel.add(centerPanel, BorderLayout.CENTER);
        
        JPanel bottomPanel = new JPanel(new FlowLayout());
        bottomPanel.add(okReflectClassBtn);
        bottomPanel.add(cancelReflectClassBtn);
        panel.add(bottomPanel, BorderLayout.SOUTH);
    }
    
    private void addLisner() {
        okReflectClassBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String text = textField.getText();
                if (text != null && !"".equals(text)) {
                    setReflectClass("custom:" + text);
                } else {
                    setReflectClass("");
                }
                dispose();
            }
        });
        cancelReflectClassBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setReflectClass("");
                dispose();
            }
        });
    }
 
    public String getReflectClass() {
        return reflectClass;
    }
 
    public void setReflectClass(String reflectClass) {
        this.reflectClass = reflectClass;
    }
    
}
 
//弹出框展示用户部门关系
class DepartmentChooseDialog extends VCIJDialog {
    private JComboBox positionCom = new JComboBox();
    private JRadioButton showDepartmentBtn = new JRadioButton("显示子部门", true);
    private JRadioButton hideDepartmentBtn = new JRadioButton("不显示子部门");
    private JRadioButton showDepartmentPersonBtn = new JRadioButton("显示部门员工", true);
    private JRadioButton hideDepartmentPersonBtn = new JRadioButton("不显示部门员工");
    private ButtonGroup departmentBG = new ButtonGroup();
    private ButtonGroup departmentPersonBG = new ButtonGroup();
    private JButton okBtn = new JButton("确定");
    private JButton cancelBtn = new JButton("取消");
    
    private String selectDepartmentText = "显示子部门";
    private String selectDepartmentPersonText = "显示部门员工";
    private String postText = "";
    private String deptId;
    private String postId = "";
    
    public DepartmentChooseDialog(String deptId) {
        this.deptId = deptId;
        this.setModal(true);
        initUI();
        try {
            initData();
        } catch (Exception e) {
            e.printStackTrace();
        }
        addLisner();
    }
    public String getSelectDepartmentText() {
        return selectDepartmentText;
    }
    public void setSelectDepartmentText(String selectDepartmentText) {
        this.selectDepartmentText = selectDepartmentText;
    }
    public String getSelectDepartmentPersonText() {
        return selectDepartmentPersonText;
    }
    public void setSelectDepartmentPersonText(String selectDepartmentPersonText) {
        this.selectDepartmentPersonText = selectDepartmentPersonText;
    }
    public String getPostText() {
        return postText;
    }
    public void setPostText(String postText) {
        this.postText = postText;
    }
    public String getPostId() {
        return postId;
    }
    public void setPostId(String postId) {
        this.postId = postId;
    }
    public DepartmentChooseDialog () {
    
    }
    private void initUI() {
        setSize(400, 300);
        setTitle("设置部门用户关系");
        
        departmentBG.add(showDepartmentBtn);
        departmentBG.add(hideDepartmentBtn);
        departmentPersonBG.add(showDepartmentPersonBtn);
        departmentPersonBG.add(hideDepartmentPersonBtn);
        
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 2));
        
        JPanel topPanel = new JPanel();
        topPanel.add(positionCom);
        panel.add(topPanel, BorderLayout.NORTH);
        JPanel bgPanel = new JPanel();
        panel.add(bgPanel, BorderLayout.CENTER);
        bgPanel.setLayout(new GridLayout(2, 2));
        bgPanel.add(showDepartmentBtn);
        bgPanel.add(hideDepartmentBtn);
        bgPanel.add(showDepartmentPersonBtn);
        bgPanel.add(hideDepartmentPersonBtn);
        
        JPanel bottomPanel = new JPanel(new FlowLayout());
        bottomPanel.add(okBtn);
        bottomPanel.add(cancelBtn);
        panel.add(bottomPanel, BorderLayout.SOUTH);
    }
    
    private static List<Map<String, String>> searchLo(String qtName, String showType, Map<String, String> queryCondition) throws VCIError, DocumentException{
        Map<String, String> queryColumnsMap = new HashMap<String, String>();
        queryColumnsMap.put("*", "标题");
        TableDataUtil util = new TableDataUtil();
        List<Map<String, String>> dataModel = util.getObjectDataList(qtName, null,
                queryCondition , null, null, showType,
                queryColumnsMap, null, null);
 
        return dataModel;
    }
    
    private ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
    
    private void initData() throws VCIError, DocumentException {
        Map<String, String> conditionMap = new HashMap<String, String>();
        //conditionMap.put("isparttime", "0");
        conditionMap.put("f_oid", deptId);
        List<Map<String, String>> dataModel = searchLo("deptpostTemplate", "deptpost", conditionMap);
        if (dataModel != null && dataModel.size() > 0) {
            for (int i = 0 ; i < dataModel.size(); i++) {
                Map<String, String> personMap = dataModel.get(i);
                String postId = (String) personMap.get("oid");
                this.postId = postId;
                ClientBusinessObject cbo = cboo.readBusinessObjectById(postId, "post");
                positionCom.addItem(personMap.get("name"));
                //positionCom.setSelectedItem(anObject)
            }
        }
    }
    private void addLisner() {
        okBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Object item = positionCom.getSelectedItem();
                if (item != null) {
                    postText = item.toString();
                }
                dispose();
            }
        });
        cancelBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setPostId("");
                dispose();
            }
        });
        showDepartmentBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JRadioButton btn = (JRadioButton) e.getSource();
                if (btn.isSelected()) {
                    selectDepartmentText = btn.getText();
                }
            }
        });
        hideDepartmentBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JRadioButton btn = (JRadioButton) e.getSource();
                if (btn.isSelected()) {
                    selectDepartmentText = btn.getText();
                }
            }
        });
        showDepartmentPersonBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JRadioButton btn = (JRadioButton) e.getSource();
                if (btn.isSelected()) {
                    selectDepartmentPersonText = btn.getText();
                }
            }
        });
        hideDepartmentPersonBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JRadioButton btn = (JRadioButton) e.getSource();
                if (btn.isSelected()) {
                    selectDepartmentPersonText = btn.getText();
                }
            }
        });
    }
    
    
}