dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
package com.vci.client.framework.rightConfig.functiontree;
 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedList;
 
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import javax.swing.tree.TreePath;
 
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Workbook;
 
import com.vci.client.ClientSession;
import com.vci.client.LogonApplication;
import com.vci.client.common.IconSelectDialog;
import com.vci.client.common.TransmitTreeObject;
import com.vci.client.framework.delegate.FunctionClientDelegate;
import com.vci.client.framework.rightConfig.modelConfig.ModuleConfigMainPanel;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.omd.btm.ui.BtmPanel;
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.image.BundleImage;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.process.QANProcessBar;
import com.vci.client.ui.process.QANProcessBarFrame;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.ui.swing.VCISwingUtil;
import com.vci.client.ui.swing.components.VCIJIntegerTextField;
import com.vci.client.ui.swing.components.VCIJOptionPane;
import com.vci.client.ui.swing.components.VCIJTextArea;
import com.vci.client.ui.swing.components.VCIJTextField;
import com.vci.client.ui.tree.VCIBaseTreeModel;
import com.vci.client.ui.tree.VCIBaseTreeNode;
import com.vci.client.ui.util.UIHelper;
import com.vci.client.utils.excel.ExcelCellStyleSettingCallback;
import com.vci.client.utils.excel.ExcelFileOperation;
import com.vci.client.utils.excel.WorkboolStyleSetting;
import com.vci.corba.common.VCIError;
import com.vci.mw.ClientContextVariable;
 
/**
* <p>Title:</p>
* <p>Description: 创建模块界面</p>
* <p>Copyright: Copyright {c} 2011</p>
* <p>Company: VCI</p>
* @author xf
* @time 2012-05-14
* @version 1.0
*/
public class ModelManagementPanel extends JPanel {
    
    private static final long serialVersionUID = 586924423L;
    
    private TransmitTreeObject transmitTreeObject = null;
    //模块对象
    private final FunctionClientDelegate modelDelegate = new FunctionClientDelegate(LogonApplication.getUserEntityObject());
    /**
     * 标题
     */
    private final JLabel titleLab = new JLabel(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.title", "RMIPFramework", getLocale()));
    /**
     * 模块名称
     */
    private final JLabel modelNameLab = new JLabel(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.modelName", "RMIPFramework", getLocale()));
    private final VCIJTextField modelNameTxt = new VCIJTextField(true);
    
    /**
     * 模块别名
     */
    private final JLabel aliasNameLbl = new JLabel("模块别名:");
    private final VCIJTextField aliasTxt = new VCIJTextField(true);
    private final JLabel prompLbl = new JLabel("(*模块别名用来记录日志用)");
    
    /**
     * B/S标识
     */
    private final JLabel bsSystemLab = new JLabel("B/S:");
    private final VCIJTextArea bsTxt = new VCIJTextArea(false);
    /**
     * C/S标识
     */
    private final JLabel csSystemLab = new JLabel("C/S:");
    private final VCIJTextArea csTxt = new VCIJTextArea(false);
    /**
     * .NET标识
     */
    private final JLabel dotNetSystemLab = new JLabel(".NET:");
    private final VCIJTextArea dotNetTxt = new VCIJTextArea(false);
    /**
     * C/S标识
     */
    private final JLabel mobileSystemLab = new JLabel("Mobile:");
    private final VCIJTextArea mobileTxt = new VCIJTextArea(false);
    /**
     * 序号
     */
    private final JLabel sequenceLab = new JLabel("序号");
    private final VCIJIntegerTextField sequenceTxt = new VCIJIntegerTextField("");    
    
    /**
     * 编号
     */
    private final JLabel moduleNoLab = new JLabel("编号");
    private final VCIJIntegerTextField moduleNoTxt = new VCIJIntegerTextField("");
    /**
     * 简图
     */
    private final JLabel imageLab = new JLabel("简图");
    private final VCIJTextField imageTxt = new VCIJTextField(false);
    private final JLabel imageConentLab = new JLabel();
    private final JButton imageButton = new JButton("选择图标");
    /**
     * 描述
     */
    private final JLabel descriptionLabel = new JLabel(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.description", "RMIPFramework", getLocale()));
    private final VCIJTextArea descriptionText = new VCIJTextArea();
    /**
     * 是否有效标识
     */
    private final JCheckBox isValid = new JCheckBox(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.isValid", "RMIPFramework", getLocale()));
    
    private final JTextField textField1 = new JTextField();
    private final JTextField textField2 = new JTextField();
    
    //操作按钮
    private final JButton  addButton = new JButton();
    private final JButton  modifyButton = new JButton();
    private final JButton  deleteButton = new JButton();
    private final JButton  addOperateButton = new JButton();
    private final JButton  importButton = new JButton("导入");
    private final JButton  exportButton = new JButton("导出");
    private final JButton  exportSqlButton = new JButton("导出sql");
    //private final JButton  viewI18nButton = new JButton("查看国际化字典");
    /**
     * 删除非系统模块
     */
    private final JButton  delNonSysBtn = new JButton();
    /**
     * 删除业务模块
     */
    private final JButton  delBusiBtn = new JButton();
    
    // 控件的坐标位置变量
    private int x = 10;
    private int y = 20;
    private int width = 50;
    private int height = 25;
    
    //父对象
    private FunOperateImportDialog ownerDialog = null;
    private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>();
    private ModuleConfigMainPanel mainPanel;
    /**
     * 初始化
     */
    public ModelManagementPanel(Object obj,TransmitTreeObject transmitTreeObject, ModuleConfigMainPanel mainPanel) {
        this.transmitTreeObject = transmitTreeObject;
        this.mainPanel = mainPanel;
        init();
        if(obj instanceof FunctionObject){
            initData((FunctionObject)obj);
            delNonSysBtn.setVisible(false);
            delBusiBtn.setVisible(false);
        }else{
            controlButtons();
        }
    }
    
    /**
     * <p>Description: 右边面板的初始化</p>
     *
     *@author ligang
     *@time 2011-6-2
     *@return void
     */
    private void init() {
        titleLab.setIcon(new BundleImage().createImageIcon("specialCharacter.gif"));
        titleLab.setBounds(0, 0, 30, 25);
        
        JPanel bottomPanel = new JPanel();
        JPanel middlePanel = new JPanel();
 
        initBottom(bottomPanel);
        initMiddleV2(middlePanel);
        
        //按钮事件
        initAction();
        //自动生成模块编号
        //initModuleNo();
        
        this.setLayout(new BorderLayout());
        //布局面板的上部,中部和下部
        this.add(titleLab, BorderLayout.NORTH);
        this.add(middlePanel, BorderLayout.CENTER);
        this.add(bottomPanel, BorderLayout.SOUTH);
    }
    
    
    private void initMiddleV2(JPanel middlePanel){
        textField1.setPreferredSize(new Dimension(63,2));
        textField2.setPreferredSize(new Dimension(63,2));
        int gridx = 0;
        int gridy = 0;
        int padxy = 3;
 
        // 用于初始批显示数据
//        initMiddle(new JPanel());
        
        JPanel panel = new JPanel(new GridBagLayout());
        // 模块名称
        gridx = 0; gridy = 0;
        panel.add(modelNameLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(modelNameTxt, getGBC(gridx++, gridy, 1, 1, 2.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
 
        // 别名
        gridx = 0; gridy += 1;
        prompLbl.setForeground(Color.RED);
        panel.add(aliasNameLbl, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(aliasTxt, getGBC(gridx++, gridy, 1, 1, 2.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        panel.add(prompLbl, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, padxy));
        
        // B/S
        JScrollPane jspBSText = new JScrollPane(bsTxt);
        gridx = 0; gridy += 1;
        panel.add(bsSystemLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(jspBSText, getGBC(gridx++, gridy, 1, 1, 2.0, 2.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        
        // C/S
        JScrollPane jspCSText = new JScrollPane(csTxt);
        gridx = 0; gridy += 1;
        panel.add(csSystemLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(jspCSText, getGBC(gridx++, gridy, 1, 1, 2.0, 2.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        
        //.NET
        JScrollPane jspNotNet = new JScrollPane(dotNetTxt);
        gridx = 0; gridy += 1;
        panel.add(dotNetSystemLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(jspNotNet, getGBC(gridx++, gridy, 1, 1, 2.0, 2.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        
        //Moblie
        JScrollPane jspMobile = new JScrollPane(mobileTxt);
        gridx = 0; gridy += 1;
        panel.add(mobileSystemLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(jspMobile, getGBC(gridx++, gridy, 1, 1, 2.0, 2.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
 
        // 序号
        gridx = 0; gridy += 2;
        sequenceTxt.setRequired(true);
        panel.add(sequenceLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(sequenceTxt, getGBC(gridx++, gridy, 1, 1, 2.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        JLabel lblSeqInfo = new JLabel("" +
                "(* 数字,描述该模块在其父模块下的显示顺序)"); 
        lblSeqInfo.setForeground(Color.red);
        panel.add(lblSeqInfo, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, padxy));
        
        // 编号
//        gridx = 0; gridy += 1;
//        moduleNoTxt.setRequired(true);
//        panel.add(moduleNoLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
//        panel.add(moduleNoTxt, getGBC(gridx++, gridy, 1, 1, 2.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
//        JLabel lblMNInfo = new JLabel("" +
//                "(* 数字,描述该模块唯一的数字编号)"); 
//        lblMNInfo.setForeground(Color.red);
//        panel.add(lblMNInfo, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, padxy));
        
        // 简图
        imageTxt.setEditable(false);
        gridx = 0; gridy += 1;
        panel.add(imageLab, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
        panel.add(imageTxt, getGBC(gridx++, gridy, 1, 1, 2.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        panel.add(imageButton, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, padxy));
        
        // 描述
        gridx = 0; gridy += 1;
        panel.add(descriptionLabel, getGBC(gridx++, gridy, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, padxy));
 
        bsTxt.setLineWrap(true);
        bsTxt.setRows(3);
        bsTxt.setColumns(10);
        bsTxt.setDocument(getNotIncludeLineDoc());
        
        csTxt.setLineWrap(true);
        csTxt.setRows(3);
        csTxt.setColumns(10);
        csTxt.setDocument(getNotIncludeLineDoc());
        
        dotNetTxt.setLineWrap(true);
        dotNetTxt.setRows(3);
        dotNetTxt.setColumns(10);
        dotNetTxt.setDocument(getNotIncludeLineDoc());
        
        mobileTxt.setLineWrap(true);
        mobileTxt.setRows(3);
        mobileTxt.setColumns(10);
        mobileTxt.setDocument(getNotIncludeLineDoc());
        
        descriptionText.setLineWrap(true);
        descriptionText.setRows(3);
        descriptionText.setColumns(10);
        
        JScrollPane jspDesc = new JScrollPane(descriptionText);
        panel.add(jspDesc, getGBC(gridx++, gridy, 1, 1, 2.0, 2.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, padxy));
        gridx += 3;
        
        // 是否生效
        gridx = 1; gridy += 1;
        panel.add(isValid, getGBC(gridx++, gridy, 1, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, padxy));
        JLabel lblValidInfo = new JLabel("" +
                "(* 不生效(不√选)时,该模块在功能模块授权里不显示)"); 
        lblValidInfo.setForeground(Color.red);
        panel.add(lblValidInfo, getGBC(gridx++, gridy, 1, 1, 0.5, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, padxy));
        
        gridx = 0; gridy += 1;
        panel.add(new JLabel(""), getGBC(gridx++, gridy, 3, 10, 10.0, 10.0, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, padxy));
        
        middlePanel.setLayout(new BorderLayout());
        middlePanel.add(textField1, BorderLayout.NORTH);
        middlePanel.add(panel, BorderLayout.CENTER);
        middlePanel.add(textField2, BorderLayout.SOUTH);
    }
    
    private javax.swing.text.Document getNotIncludeLineDoc(){
        javax.swing.text.Document res = new PlainDocument(){
            @Override
            public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
                if (str == null) {
                    return;
                }
                LinkedList<Character> charsList = new LinkedList<Character>();
                char[] chars = str.toCharArray();
                for(char c : chars){
                    if(c == '\n'){
                        continue;
                    }
                    charsList.add(c);
                }
                char[] charsNew = new char[charsList.size()];
                for(int i = 0; i < charsNew.length; i++){
                    charsNew[i] = charsList.get(i);
                }
                super.insertString(offs, new String(charsNew), a);
            }
        };
        return res;
    }
    
    /**
     * <p>Description: 面板中部的布局</p>
     *
     *@author ligang
     *@time 2011-6-2
     *@return void
     * @param middlePanel
     */
    private void initMiddle(JPanel middlePanel) {
        JPanel panel = new JPanel();
        panel.setPreferredSize(new Dimension(600,600));
        panel.setLayout(null);        
        textField1.setPreferredSize(new Dimension(63,2));
        textField2.setPreferredSize(new Dimension(63,2));
        
        //第一行
        x = 30; y = 30; width = 70; height = 25; 
        modelNameLab.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.modelName", "RMIPFramework", getLocale()));
        modelNameLab.setBounds(x, y, width, height);//模块名称
        
        x += modelNameLab.getBounds().width ; y = 30; width = 600;height = 25;
        modelNameTxt.setBounds(x, y, width, height);//模块内容
        
        //第二行
        x = 30; y = 70; width = 70; height = 25; 
        aliasNameLbl.setText("模块别名:");
        aliasNameLbl.setBounds(x, y, width, height);//别名
        
        x += aliasNameLbl.getBounds().width ; y = 70; width = 600;height = 25;
        aliasTxt.setBounds(x, y, width, height);//模块别名
        
        x += aliasTxt.getBounds().width + 5 ; y = 70; width = 300;height = 25;
        
        //第三行
        x = 30;y = 110;width = 70;height = 25;
        bsSystemLab.setText("B/S:");
        bsSystemLab.setBounds(x, y, width, height);//B/S
        
        x += bsSystemLab.getBounds().width ; y = 110; width=600;height=25;
        bsTxt.setBounds(x, y, width, height);
        
        //第四行
        x = 30;y = 150;width = 70;height = 25;
        csSystemLab.setText("C/S:");
        csSystemLab.setBounds(x, y, width, height);//C/S
        
        x += csSystemLab.getBounds().width ; y = 150; width=600;height=25;
        csTxt.setBounds(x, y, width, height);
        
        //第五行
        x = 30;y = 190;width = 70;height = 25;
        sequenceLab.setText("序号:");
        sequenceLab.setBounds(x, y, width, height);//序号
        
        x += sequenceLab.getBounds().width;y = 190; width = 600;height = 25;
        sequenceTxt.setBounds(x, y, width, height);
        
        //第六行
//        x = 30;y = 230;width = 70;height = 25;
//        moduleNoLab.setText("编号:");
//        moduleNoLab.setBounds(x, y, width, height);//编号
//        
//        x += moduleNoLab.getBounds().width;y = 230; width = 600;height = 25;
//        moduleNoTxt.setBounds(x, y, width, height);
        
        //第七行
        x = 30; y = 270; width = 70; height = 25;
        imageLab.setBounds(x, y, width, height);
        
        x += imageLab.getBounds().width; y = 270;width = 150; height = 25;
        imageTxt.setBounds(x, y, width, height);
        
        x += imageTxt.getBounds().width+5; y = 270;width = 25; height = 25;
        imageConentLab.setBounds(x, y, width, height);
        
        x += imageConentLab.getBounds().width; y = 270; width = 120; height = 25;
        imageButton.setBounds(x, y, width, height);
        
        //第八行
        x = 30;y = 310;width = 70;height = 25;
        descriptionLabel.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.description", "RMIPFramework", getLocale()));
        descriptionLabel.setBounds(x,y,width,height);//描述
        
        x += descriptionLabel.getBounds().width ; y = 310; width=600;height=130;
        JScrollPane jsDescription=new JScrollPane();
        descriptionText.setLineWrap(true);
        jsDescription.setViewportView(descriptionText);
        jsDescription.setBounds(x, y, width, height);
        
        //是否有效
        x = 30; y += jsDescription.getBounds().getHeight()+15; width = 80; height = 25;
        isValid.setSelected(true);
        isValid.setBounds(x, y, width, height);
        
        panel.add(modelNameLab);
        panel.add(modelNameTxt);
        
        panel.add(aliasNameLbl);
        panel.add(aliasTxt);
        panel.add(prompLbl);
        
        panel.add(bsSystemLab);
        panel.add(bsTxt);
        
        panel.add(csSystemLab);
        panel.add(csTxt);
        
        panel.add(sequenceLab);
        panel.add(sequenceTxt);
        
//        panel.add(moduleNoLab);
//        panel.add(moduleNoTxt);
        
        panel.add(imageLab);
        panel.add(imageTxt);
        panel.add(imageConentLab);
        panel.add(imageButton);
        
        panel.add(descriptionLabel);
        panel.add(jsDescription);
        
        panel.add(isValid);
        
//        moduleNoTxt.setEnabled(false);
        imageTxt.setEnabled(false);
        
        middlePanel.setLayout(new BorderLayout());
        middlePanel.add(textField1, BorderLayout.NORTH);
        middlePanel.add(panel, BorderLayout.CENTER);
        middlePanel.add(textField2, BorderLayout.SOUTH);
        
    }
    
    private GridBagConstraints getGBC(int gridx, int gridy, int gridwidth,
            int gridheight, double weightx, double weighty, int anchor,
            int fill, int padxy) {
        return new GridBagConstraints(gridx, gridy, gridwidth, gridheight,
                weightx, weighty, anchor, fill, new Insets(padxy, padxy, padxy,
                        padxy), padxy, padxy);
    }
    
    private void controlButtons(){
        modifyButton.setEnabled(false);
        deleteButton.setEnabled(false);
        addOperateButton.setEnabled(false);
    }
    
//    private void initModuleNo(){
//        int moduleNo = 0;
//        try {
//            moduleNo = modelDelegate.getAutoModuleNo();
//        } catch (VCIException e) {
//            e.printStackTrace();
//            VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
//            return;
//        }
//        moduleNoTxt.setText(String.valueOf(moduleNo));
//    }
    
    /**
     * <p>Description: 面板底部布局</p>
     *
     *@author ligang
     *@time 2011-6-2
     *@return void
     * @param bottomPanel
     */
    private void initBottom(JPanel bottomPanel) {
        addButton.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.addButton", "RMIPFramework", getLocale()));
        addButton.setIcon(new BundleImage().createImageIcon("create.gif"));//添加控件
        
        modifyButton.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.modifyButton", "RMIPFramework", getLocale()));
        modifyButton.setIcon(new BundleImage().createImageIcon("modify.gif"));//修改控件
        
        deleteButton.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.deleteButton", "RMIPFramework", getLocale()));
        deleteButton.setIcon(new BundleImage().createImageIcon("delete.gif"));//删除控件
        
        addOperateButton.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.addOperationTypeButton", "RMIPFramework", getLocale()));
        addOperateButton.setIcon(new BundleImage().createImageIcon("grouplist.gif"));//增加操作类型
        
        delNonSysBtn.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.delNonSysBtn", "RMIPFramework", getLocale()));
        delNonSysBtn.setIcon(new BundleImage().createImageIcon("delete.gif"));//删除控件
        
        delBusiBtn.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.delBusiBtn", "RMIPFramework", getLocale()));
        delBusiBtn.setIcon(new BundleImage().createImageIcon("delete.gif"));//删除控件
        
        bottomPanel.add(addButton);
        bottomPanel.add(modifyButton);
        bottomPanel.add(deleteButton);
        bottomPanel.add(addOperateButton);
        bottomPanel.add(delNonSysBtn);
        bottomPanel.add(delBusiBtn);
        bottomPanel.add(importButton);
        bottomPanel.add(exportButton);
        bottomPanel.add(exportSqlButton);
        //bottomPanel.add(viewI18nButton);
    }
    
    
    private void initData(FunctionObject obj){
        this.modelNameTxt.setText(obj.getName());
        this.bsTxt.setText(obj.getResourceB());
        this.csTxt.setText(obj.getResourceC());
        //this.moduleNoTxt.setText(String.valueOf(obj.getModuleNo()));
        this.sequenceTxt.setText(String.valueOf(obj.getSequence()));
        this.imageTxt.setText(obj.getImage());
        this.imageConentLab.setIcon(new BundleImage().createImageIcon(obj.getImage()));
        this.isValid.setSelected(obj.getIsValid());
        this.aliasTxt.setText(obj.getAliasName());
        this.descriptionText.setText(obj.getDesc());
        this.dotNetTxt.setText(obj.getResourceDotNet());
        this.mobileTxt.setText(obj.getResourceMobile());
        
        try {
            /**判断该模块下子对象是模块还是操作,0表示无子节点,1表示是模块,2表示是操作**/
            int childType = new FunctionClientDelegate(LogonApplication.getUserEntityObject()).checkChildObject(obj.getId());
            if(childType == 1){//有模块
                addOperateButton.setEnabled(false);
                exportButton.setEnabled(false);
                importButton.setEnabled(false);
            }else if(childType == 2){
                addButton.setEnabled(false);
                exportButton.setEnabled(false);
                importButton.setEnabled(false);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
        }
        
    }
    
    /**
     * <p>Description: 按钮动作事件</p>
     *
     *@author Administrator
     *@time 2011-6-2
     *@return void
     */
    private void initAction() {
        
        imageButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                selectImages();
            }
        });
        
        addButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                addButton_actionPerformed();
            }
        });
        
        modifyButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                modifyButton_actionPerformed();
            }
        });
        
        deleteButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                deleteButton_actionPerformed();
            }
        });
        
        addOperateButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                addOperateTypeButton_actionPerformed(transmitTreeObject);
            }
        });
        
        delNonSysBtn.addActionListener(new ActionListener() {
            
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    if(ClientSession.getFrameworkService().deleteModules("nonsys")){
                        JOptionPane.showMessageDialog(getThis(), "删除非系统模块成功", "删除成功", JOptionPane.INFORMATION_MESSAGE);
                        return;
                    }
                } catch (VCIError e1) {
                    e1.printStackTrace();
                    JOptionPane.showMessageDialog(getThis(), "删除非系统模块失败", "删除失败", JOptionPane.WARNING_MESSAGE);
                    return;
                }
            }
        });
        
        delBusiBtn.addActionListener(new ActionListener() {
            
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    if(ClientSession.getFrameworkService().deleteModules("business")){
                        JOptionPane.showMessageDialog(getThis(), "删除业务模块成功", "删除成功", JOptionPane.INFORMATION_MESSAGE);
                        return;
                    }
                } catch (VCIError e1) {
                    e1.printStackTrace();
                    JOptionPane.showMessageDialog(getThis(), "删除业务模块失败", "删除失败", JOptionPane.WARNING_MESSAGE);
                    return;
                }
            }
        });
        /**
         * 导出功能模块管理树结构
         * add by caill
         * 
         * */
         exportButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    exportTable();
                }
            });
         
         importButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    importTable();
                }
            });
         exportSqlButton.addActionListener(new ActionListener() {
                
                @Override
                public void actionPerformed(ActionEvent arg0) {
                    // TODO Auto-generated method stub
                    exportTxt();
                }
            });
//         viewI18nButton.addActionListener(new ActionListener() {
//                
//                @Override
//                public void actionPerformed(ActionEvent arg0) {
//                    // TODO Auto-generated method stub
//                    i18nTable();
//                }
//            });
         
    }    
    //add by caill start 2015.12.8 为功能模块及模块下的操作添加导出sql功能
    public void exportTxt(){
        int size = 0;
        try {
            size = modelDelegate.getAllModelManagementNum();
        } catch (VCIException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        String[][] plDatas = new String[size][23];
        try {
            plDatas = modelDelegate.getAllDatas(size);
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("导出sql");
        fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fileChooser.setApproveButtonText("导出");
        int result = fileChooser.showOpenDialog(this);
        if(result == JFileChooser.APPROVE_OPTION){
            String dir = fileChooser.getSelectedFile().getAbsolutePath();
            if(expData(dir,plDatas)==true){
                JOptionPane.showMessageDialog(BtmPanel.getInstance(), "导出成功", "导出成功", JOptionPane.INFORMATION_MESSAGE);
            }else{
                JOptionPane.showMessageDialog(BtmPanel.getInstance(), "导出失败", "导出失败", JOptionPane.INFORMATION_MESSAGE);
            }
            
        }
    }
    public boolean expData(String dir, String[][] plDatas){
        new File(dir).mkdir();
        File file = new File(dir + "/plfuncoperation.sql");
        try {
            FileWriter w = new FileWriter(file);
            BufferedWriter bw = new BufferedWriter(w);
            System.out.println("长度为:"+plDatas.length);
            for(int i=0;i<plDatas.length;i++){
                if(!plDatas[i][16].trim().equals("") && plDatas[i][16]!=null && !plDatas[i][16].equals("-1")){
                    bw.write("insert into plfunction values('"+plDatas[i][0]+"','"+plDatas[i][1]+"',"+"'"+plDatas[i][2]+"',"+"'"+plDatas[i][3]+"',"+"'"+plDatas[i][4]+"',"
                            +"'"+plDatas[i][5]+"',"+"'"+plDatas[i][6]+"',"+"'"+plDatas[i][7]+"',"+"'"+plDatas[i][8]+"',"+"'"+plDatas[i][9]+"',"+"'"+plDatas[i][10]+"',"+"'"+plDatas[i][11]+"',"
                            +"'"+plDatas[i][12]+"',"+"'"+plDatas[i][13]+"',"+"'"+plDatas[i][14]+"',"+"'"+plDatas[i][15]+"');");
                    bw.write("\r\n");
                }
                if(!plDatas[i][16].trim().equals("") && plDatas[i][16]!=null && plDatas[i][16].equals("-1")){
                    bw.write("insert into plfuncoperation values('"+plDatas[i][17]+"','"+plDatas[i][18]+"',"+"'"+plDatas[i][19]+"',"+"'"+plDatas[i][20]+"',"+"'"+plDatas[i][21]+"',"
                            +"'"+plDatas[i][22]+"');");
                    bw.write("\r\n");
                }
            }    
            
            bw.flush();
            bw.close();
            return true;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;
    }
    
    /**
     * 
     * <p>国际化字典Dialog: </p>
     * @author yangyang
     * @time 2017-10-31
     */
//    public void i18nTable(){
//        VciI18nTableDialog vi18n = new VciI18nTableDialog();
//        vi18n.setModal(true);
//        vi18n.init();
//        vi18n.setSize(900,600);
//        vi18n.setLocationRelativeTo(ClientContextVariable.getFrame());
//        vi18n.setVisible(true);
//    }
    //add by caill end
    public void importTable(){
        FunOperateImportDialog eid = new FunOperateImportDialog(this.mainPanel);
        eid.init();
        eid.setSize(UIHelper.DIALOG_DEFAULT_WIDTH, UIHelper.DIALOG_DEFAULT_HEIGHT);
        eid.setLocationRelativeTo(ClientContextVariable.getFrame());
        eid.setVisible(true);
    }
    /**
     * 塑造excel表头
     * add by caill start
     * */
    public void exportTable() {
        final String[] columns = new String[] {"PLNAME","PLRESOURCEC","PLSUFFIXC","PLRESOURCEB",
                "PLSUFFIXB","PLMODULENO","PLDESC","PLISVALID","PLIMAGE","PLMODULESEQUENCE","PLALIASNAME","PLMODULENAME",
                "PLRESOURCEDOTNET","PLRESOURCEMOBIL","级别","别名","PLNO","PLISVALID","PLNAME","PLUNIQUEFLAG","PLDESC","PLALIAS","PLSEQUENCE"};// 设置表单列名
        int count=transmitTreeObject.getCurrentTreeNode().getChildCount();
        String[][] firstLevel = new String[3000][23];    
        try {
            firstLevel = modelDelegate.checkLevel();
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        final boolean[] ress = new boolean[1];
        String[][] datas = new String[10000][columns.length];
        datas[0] = columns;
        for(int i=0;i<firstLevel.length;i++){
            datas[i+1] =firstLevel[i];
        }    
        
        ress[0] = exportExcel(datas, "模块操作模板");
        final QANProcessBarFrame frame = new QANProcessBarFrame();
        final QANProcessBar[] bar = new QANProcessBar[1];
        bar[0] = new QANProcessBar(new Thread() {
            public void run() {
                try {
                    frame.setContent("正在导出Excel文件,请稍等......");
//                    String[][] datas = new String[1][columns.length];
//                    datas[0] = columns;
//                    ress[0] = exportExcel(datas, "人员模板");                    
                } finally {
                    frame.setProcessBarCancel(true);
                }
            }
        }, frame, frame, "模块操作模板导出", false);
        bar[0].setVisible(true);
        if (ress[0]) {
            VCIOptionPane.showMessageDialog(LogonApplication.frame, "导出成功!");
        }
 
    }
    
    private boolean exportExcel(String[][] datas, String sheetName) {
        File file = getRequiredFile(false);
        if (file == null) {
            return false;
        }
        String fileName = file.getAbsolutePath();
        // add by xchao 2014.05.15 end
        new ExcelFileOperation().writeExcelFileInfo(fileName, sheetName, datas,
                new ExcelCellStyleSettingCallback() {
                    @Override
                    public WorkboolStyleSetting doSetWorkbookStyle(
                            final Workbook workbook) {
                        WorkboolStyleSetting setting = new WorkboolStyleSetting() {
                            @Override
                            public LinkedHashMap<String, CellStyle> getStyleMap() {
                                LinkedHashMap<String, CellStyle> styleMap = new LinkedHashMap<String, CellStyle>();
                                org.apache.poi.ss.usermodel.CellStyle style = workbook
                                        .createCellStyle();
                                org.apache.poi.ss.usermodel.Font font = (org.apache.poi.ss.usermodel.Font) workbook
                                        .createFont();
                                font.setColor(HSSFFont.COLOR_RED);
                                style.setFont(font);
                                for (int column : ColumnNameisRed) {
                                    styleMap.put("0*" + (column) + "", style);
                                }
                                return styleMap;
                            }
                        };
                        return setting;
                
                    }
                });
        return true;
    }
    private File getRequiredFile(boolean isRead) {
        File files = getExcelFile();
        // add by xchao 2014.04.15 begin
        // 有错误数据要输出时,必须选择有效的excel文件
        while (files == null) {
            return null;
        }
        String fileName = files.getAbsolutePath();
        // 需要写入时,必须选择一个有效的、可以写入的文件
        if (!isRead) {
            // 如果文件被打开着,则必须选择其它的未打开着的文件
            while (files.exists() && !files.renameTo(new File(fileName))) {
                VCIJOptionPane.showMessageDialog(null,
                        "另一个程序正在使用此文件,进程无法访问,请重新选择!");
                // 重新选择文件时,也必须选择有效的excel文件
                files = null;
                while (files == null) {
                    files = getExcelFile();
                    while (files == null) {
                        return null;
                    }
                }
                fileName = files.getAbsolutePath();
            }
        }
        return files;
    }
    private File getExcelFile() {
        File file = null;
        String filePath = VCISwingUtil.getExcelFileURL(ownerDialog, true, "");
        if (filePath != null) {
            file = new File(filePath);
        }
        return file;
    }
    //add by caill end 
    /**
     * 选择模块的图片
     */
    private void selectImages(){
        IconSelectDialog iconDialog = new IconSelectDialog(LogonApplication.frame, "选择图标", true , this.imageConentLab);
        iconDialog.setVisible(true);
        String icon = iconDialog.getSelectedIcon();
        if(!icon.equals("")){
            this.imageTxt.setText(icon);
        }
    }
    
    /**
     * <p>Description: 添加按钮事件</p>
     *
     *@author ligang
     *@time 2011-6-2
     *@return void
     */
    private void addButton_actionPerformed() {
        //获取当前选中节点
        System.out.println("");
         if (transmitTreeObject.getCurrentTreeNode() == null) {
             VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.root.notSelect", "RMIPFramework", getLocale()));
             return;
         }
         FunctionObject obj = check("add"); 
         if(obj == null) {
             return ;
         }
         
         try {
             //往数据库里插入新建模块数据
//            int num = modelDelegate.getAutoModuleNo();
//            obj.setModuleNo(num);
            String puid = modelDelegate.saveModule(obj);
            /**
             * 返回值:1,表示模块名称重复
             *            2,表示模块标识重复
             *         3, 模板别名存在重复
             */
            if(puid.equals("1")){
                VCIOptionPane.showMessage(LogonApplication.frame, "模块名称重复,请修改!");
                return;
            }else if(puid.equals("2")){
                VCIOptionPane.showMessage(LogonApplication.frame, "模块标识重复,请修改!");
                return;
            }else if(puid.equals("3")) {
                VCIOptionPane.showMessage(LogonApplication.frame, "模块别名重复,请修改!");
                return;
//            }else if (puid.equals("4")) {
//                VCIOptionPane.showMessage(LogonApplication.frame, "模块编号重复,请修改!");
//                return;
            } 
            obj.setId(puid);
            VCIBaseTreeNode attrViewNode = new VCIBaseTreeNode(obj.getName(), obj);
            VCIBaseTreeModel model= transmitTreeObject.getTreeModel();
            int count=transmitTreeObject.getCurrentTreeNode().getChildCount();
            if(transmitTreeObject.getCurrentTreeNode().isExpand()){
                model.insertNodeInto(attrViewNode, transmitTreeObject.getCurrentTreeNode(), transmitTreeObject.getCurrentTreeNode().getChildCount());
                transmitTreeObject.getTree().setSelectionPath(new TreePath(attrViewNode.getPath()));
                attrViewNode.setExpand(true);
                attrViewNode.setLeaf(true);
            }else{
                transmitTreeObject.getTree().expandPath(new TreePath(transmitTreeObject.getCurrentTreeNode().getPath()));
                transmitTreeObject.getTree().setSelectionPath(new TreePath(transmitTreeObject.getCurrentTreeNode().getPath()));
            }
            transmitTreeObject.getCurrentTreeNode().setLeaf(false);
         } catch (VCIException e) {
             VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
             return ;
        }
        
    }
    
    /**
     * <p>Description: 删除事件</p>
     *
     *@author xf
     *@time 2012-5-15
     *@return void
     */
    private void deleteButton_actionPerformed() {
        //获取当前选中节点
         if (transmitTreeObject.getCurrentTreeNode() == null) {
             VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.model.delete", "RMIPFramework", getLocale()));
             return ;
         }
         int i = VCIOptionPane.showConfirmDialog(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.model.deleteQuery", "RMIPFramework", getLocale()),LocaleDisplay.getI18nString("rmip.framework.friend.message.dialog.title", "RMIPFramework", getLocale()),VCIOptionPane.YES_NO_OPTION);
         if (i != 0) {
             return;
         }
         String res = "";
         try {
             Object object = transmitTreeObject.getCurrentTreeNode().getObj();
             String puid = "";
             if(object instanceof FunctionObject) {
                FunctionObject plFunObject = (FunctionObject) object;
                puid = plFunObject.getId();
             }else if("business".equals(object)) {
                puid = "business";
             }else if("system".equals(object)) {
                puid = "system";
             }
             res = modelDelegate.deleteModule(puid);
             /**
              * 返回值:1表示模块在权限模块已经有授权信息,无法删除
              */
             if(res.equals("1")){
                 VCIOptionPane.showMessage(LogonApplication.frame, "当前模块(或下级模块)已经存在授权信息,无法删除。");
                 return;
             }
        } catch (VCIException e) {
            VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
            return;
        }
        VCIBaseTreeNode parentNode = (VCIBaseTreeNode)transmitTreeObject.getCurrentTreeNode().getParent();
        VCIBaseTreeModel model = transmitTreeObject.getTreeModel();
        model.removeNodeFromParent(transmitTreeObject.getCurrentTreeNode());
        transmitTreeObject.getTree().setSelectionPath(new TreePath(parentNode.getPath()));
        transmitTreeObject.setCurrentTreeNode(parentNode);
    }
    
    
    /**
     * <p>Description: 修改模块事件</p>
     *
     *@author xf
     *@time 2012-5-15
     *@return void
     */
    private void modifyButton_actionPerformed() {
        //获取当前选中节点
         if (transmitTreeObject.getCurrentTreeNode() == null) {
             VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.root.notSelect", "RMIPFramework", getLocale()));
             return ;
         }
         
         FunctionObject obj = check("update");
         
         try {
            String res = "";
            //更新数据库
            res = modelDelegate.updateModule(obj);
            /**
             * 返回:1表示模块名重复。
             *       2表示模块标识重复。
             *       3标示模块别名重复。
             */
            if(res.equals("1")){
                VCIOptionPane.showMessage(LogonApplication.frame, "模块名称重复,请修改!");
                return;
            }else if(res.equals("2")){
                VCIOptionPane.showMessage(LogonApplication.frame, "模块标识重复,请修改!");
                return;
            }else if(res.equals("3")) {
                VCIOptionPane.showMessage(LogonApplication.frame, "模块别名重复,请修改!");
                return;
            } else if (res.equals("4")) {
                VCIOptionPane.showMessage(LogonApplication.frame, "模块编号重复,请修改!");
                return;
            } else {
                VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.model.modifyInfo", "RMIPFramework", getLocale()));
                transmitTreeObject.getCurrentTreeNode().setUserObject(obj.getName());
                transmitTreeObject.getCurrentTreeNode().setObj(obj);
                transmitTreeObject.getTreeModel().nodeChanged(transmitTreeObject.getCurrentTreeNode());
            }
        } catch (VCIException e) {
            VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
            return;
        }
        
    }
    
    /**
     * <p>Description: 页面输入的校验</p>
     *
     *@author xf
     *@time 2012-5-15
     *@return FunctionObject
     * @return
     */
    private FunctionObject check(String type) {
        FunctionObject obj = new FunctionObject();
        
        Object currentObj = transmitTreeObject.getCurrentTreeNode().getObj();
        
        FunctionObject objForTree = new FunctionObject();
        if(currentObj instanceof FunctionObject) {
            objForTree = (FunctionObject) currentObj;
        }
//        FunctionObject objForTree = (FunctionObject)transmitTreeObject.getCurrentTreeNode().getObj(); 
        
        
//        if(type.equals("update")){
//            obj = (FunctionObject)transmitTreeObject.getCurrentTreeNode().getObj();
//        }
        //获取表单输入的值
        String modelName = modelNameTxt.getText().trim();
        String csIdentity = csTxt.getText().trim();
        String bsIdentity = bsTxt.getText().trim();
        String aliasName = aliasTxt.getText().trim();
        String resDotNet = dotNetTxt.getText();
        String resMobile = mobileTxt.getText();
        
        //int moduleNo = transferStringToNum(moduleNoTxt.getText());
        int sequence = transferStringToNum(sequenceTxt.getText());
        String description = descriptionText.getText();
        
        if("".equals(modelName) || "null".equals(modelName) || modelName == null) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelNmae.isNull", "RMIPFramework", getLocale()));
            return null;
        }else if(modelName.length() > 128) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelNmae.lenght", "RMIPFramework", getLocale()));
            return null;
        }else if(description.length() > 255) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.desc.lenght", "RMIPFramework", getLocale()));
            return null;
        }/**else if("".equals(csIdentity) || "null".equals(csIdentity) || csIdentity == null) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.cs.name", "RMIPFramework", getLocale()));
            return null;
        }**/else if(csIdentity != null && !"".equals(csIdentity) && csIdentity.length() > 255) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.cs.lenght", "RMIPFramework", getLocale()));
            return null;
        } else if(resDotNet != null && !"".equals(resDotNet) && resDotNet.length() > 255) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.dotnet.lenght", "RMIPFramework", getLocale()));
            return null;
        }else if(resMobile != null && !"".equals(resMobile) && csIdentity.length() > 255) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.mobile.lenght", "RMIPFramework", getLocale()));
            return null;
//        }else if (moduleNo < 0) {
//            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.moduleNo.isNull", "RMIPFramework", getLocale()));
//            return null;
        } else if (sequence < 0) {
            VCIOptionPane.showMessage(this, LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.sequence.isNull", "RMIPFramework", getLocale()));
            return null;
        }
        if(type.equals("add")){
            //给object对象赋值
            Object object = transmitTreeObject.getCurrentTreeNode().getObj();
            String parentId = "";
            if(object instanceof FunctionObject) {
                FunctionObject plFunObject = (FunctionObject)object;
                parentId = plFunObject.getId();
            }else if("business".equals(object)) {
                parentId = "business";
            }else if("system".equals(object)) {
                parentId = "system";
            }
            obj.setParentId(parentId);
        }else{
            obj.setId(objForTree.getId());
            obj.setParentId(objForTree.getParentId());
        }
        obj.setName(modelName);
        obj.setResourceC(csIdentity);
        obj.setDesc(description);
        obj.setResourceB(bsIdentity);
        obj.setSuffixC("");
        obj.setSuffixB("");
        obj.setSequence(sequence);
        //obj.setModuleNo(moduleNo);
        obj.setImage(imageTxt.getText());
        obj.setIsValid(isValid.isSelected());//1有效0无效
        obj.setAliasName(aliasName);
        obj.setResourceDotNet(resDotNet);
        obj.setResourceMobile(resMobile);
        return obj;
    }
    
    private int transferStringToNum(String input) {
        int output = -1;
        try {
            output = Integer.parseInt(input);
        } catch (Throwable e) {
            output = -1;
        }
        return output;
    }
    
    private void addOperateTypeButton_actionPerformed(TransmitTreeObject transmitTreeObject) {
        OperationTypeTreeDialog operationDialog = new OperationTypeTreeDialog(transmitTreeObject);
        operationDialog.setVisible(true);
    }
 
    private JPanel getThis(){
        return this;
    }
}