ludc
2024-09-14 36c2449aec5b51e5ed4e5c6841154b746060e09a
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
package com.vci.client.portal.Formdesign;
 
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
 
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import javax.swing.text.JTextComponent;
 
import com.vci.client.LogonApplication;
import com.vci.client.bof.ClientBusinessObjectOperation;
import com.vci.client.portal.utility.PRM;
import com.vci.client.portal.utility.PRMItem;
import com.vci.client.portal.utility.UITools;
import com.vci.client.ui.swing.components.VCIJComboBox;
import com.vci.client.ui.swing.components.VCIJLabel;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.VCIJScrollPane;
import com.vci.client.ui.swing.components.VCIJTextField;
import com.vci.client.uif.engine.client.UIHelper;
import com.vci.client.uif.engine.client.controls.ControlFactory;
import com.vci.client.uif.engine.client.controls.ICustomControl;
import com.vci.client.uif.engine.client.controls.RefObjChooseControl;
import com.vci.client.uif.engine.client.controls.VCIJComboBoxModelValueObject;
import com.vci.client.uif.engine.client.objopt.ObjectAddEditDialog.OperateType;
import com.vci.common.portal.enums.ControlType;
import com.vci.common.portal.enums.PortalVITypeFlag;
import com.vci.corba.common.VCIError;
import com.vci.corba.omd.data.AttributeValue;
import com.vci.corba.portal.data.PortalVI;
 
public class PreviewDialog extends JDialog {
 
    private final JPanel contentPanel = new JPanel();
    /**
     * 将界面元素属性集合设置成全局变量 在保存时用于判断属性是否为空
     */
    private Map<String, PRMItem> itemMap = new HashMap<String, PRMItem>();
    /**
     * 全部的Label
     */
    private HashMap<String, VCIJLabel> ctrlLabelMap = new HashMap<String, VCIJLabel>();
    /**
     * 全部的Component 控件
     */
    private HashMap<String, Component> ctrlComptMap = new HashMap<String, Component>();
    /**
     * 控件之间有显示控制 KEY:被控属性字段 VALUE:主控属性字段 受控件控件的显示与否,受主控属性的部分取值的影响
     */
    private HashMap<String, List<String>> hiddenControlsMap = new HashMap<String, List<String>>();
    private HashMap<String, String> SELECT_ATTRIBUTE = new HashMap<String, String>();
    private HashMap<String, String> SELECT_ATTRIBUTE_VALUE = new HashMap<String, String>();
    /**
     * 控件的数据之间有级联数据控制的控件 KEY:主控属性字段 VALUE:受控(数据级联影响)属性字段
     * 受控控件的数据受主控属性控件的数据影响,一般是主控数据作为受控数据的查询条件
     */
    private HashMap<String, List<String>> cascadeControlsMap = new HashMap<String, List<String>>();
 
    /**
     * 被控属性与主控属性之间在关联关联 key:被控属性 value:主控属性
     */
    private HashMap<String, String> fieldToMasterFieldMap = new HashMap<String, String>();
    private OperateType operateType = OperateType.ADD;
    private HashMap<String, VCIJComboBox> ctrlComboBoxMap = new HashMap<String, VCIJComboBox>();
    /**
     * 当前窗口的表单类型 0:业务类型,1:链接类型 对于不同类型的表单,窗口中属性的命名规则不同
     */
    private PortalVITypeFlag typeFlag = PortalVITypeFlag.BtmType;
    /**
     * 判断是正向还是反响向
     */
    private boolean direction = true;
 
    private PortalVI pvi;
    private VCIJPanel previewPanel;
    public static void main(String[] args) {
//        try {
//            PreviewDialog dialog = new PreviewDialog(pvi);
//            dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
//            dialog.setVisible(true);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }
 
    /**
     * Create the dialog.
     */
    public PreviewDialog(PortalVI pvi, PortalVITypeFlag typeFlag) {
        super(LogonApplication.frame,true);
        this.pvi = pvi;
        this.typeFlag = typeFlag;
        previewPanel = createControlsPanel(pvi);
        init();
        this.setLocationRelativeTo(null);
    }
 
    private void init() {
        this.setTitle(pvi.viName);
        
        setBounds(100, 100, 854, 636);
        getContentPane().setLayout(new BorderLayout());
        contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
        getContentPane().add(contentPanel, BorderLayout.CENTER);
        {
            JPanel buttonPane = new JPanel();
            buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            getContentPane().add(buttonPane, BorderLayout.SOUTH);
            {
                JButton cancelButton = new JButton("关闭");
                cancelButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent paramActionEvent) {
                        dispose();
                    }
                });
                cancelButton.setActionCommand("Cancel");
                buttonPane.add(cancelButton);
            }
        }
        contentPanel.setLayout(new BorderLayout(0, 0));
        contentPanel.add(previewPanel);
    }
 
    private void addItemToMap(List<PRMItem> items) {
        for (PRMItem item : items) {
            this.itemMap.put(item.getItemField(), item);
        }
    }
 
    private VCIJPanel createControlsPanel(PortalVI sheet) {
        VCIJPanel pal = new VCIJPanel(new GridBagLayout());
        PRM sheetPrm = UITools.getPRM(sheet.prm);
        List<PRMItem> itemList = sheetPrm.getPrmItemList();
 
        // 缓存PRMItem
        addItemToMap(itemList);
 
        int showColumns = 2;
        if (!"".equals(sheetPrm.getShowCols())) {
            showColumns = Integer.valueOf(sheetPrm.getShowCols());
        }
 
        int gridx = 0;
        int gridy = 0;
        int gridwidth = 1;
        int gridheight = 1;
        double weightx = 1.0;
        double weighty = 0.0;
        int padxy = 3;
        int latestGridx = 0;
        boolean latestIsTextArea = false;
 
        VCIJLabel lbl = null;
        Component compt = null;
        Component comptToAdd = null;
 
        for (int i = 0; i < itemList.size(); i++) {
 
            PRMItem item = itemList.get(i);
            String field = item.getItemField();
            String itemCols = item.getItemCols();
 
            if (itemCols == null || itemCols.trim().equals("")
                    || itemCols.equals("0")) {
                continue;
            }
 
            lbl = new VCIJLabel(item.getItemName() + ":");
            compt = ControlFactory.createControl(item);
            comptToAdd = compt;
            if (comptToAdd instanceof ICustomControl) {
                ((ICustomControl) comptToAdd).setParentComponent(this);
            }
            if (compt instanceof JTextArea) {
                comptToAdd = new VCIJScrollPane(compt);
            }
 
            // 缓存控件
            ctrlLabelMap.put(field, lbl);
            ctrlComptMap.put(field, compt);
 
            // TextArea 占整行显示
            if (item.getItemType().toLowerCase()
                    .equals(ControlType.TextArea.name().toLowerCase())) {
                gridx = 0;
                gridy += 1;
                gridwidth = showColumns * 2 - 1;
                gridheight = 30;
                weightx = 1.0;
                weighty = 5.0;
 
                pal.add(lbl,
                        getGBC(gridx, gridy, 1, gridheight, 0.0, 0.0,
                                GridBagConstraints.NORTHEAST,
                                GridBagConstraints.NONE, padxy));
 
                gridx += 1;
                pal.add(comptToAdd,
                        getGBC(gridx, gridy, gridwidth, gridheight, weightx,
                                weighty, GridBagConstraints.NORTHWEST,
                                GridBagConstraints.BOTH, padxy));
 
                latestIsTextArea = true;
 
                // 重置一行位置信息
                gridx = 0;
                gridy += gridheight;
                gridwidth = 1;
                gridheight = 1;
                weightx = 1.0;
                weighty = 0.0;
                latestGridx = 0;
 
            } else {
                if (latestIsTextArea) {
                    // 如果最近的一个控件是TextArea,则位置信息已经是设置好了的,此时直接使用
                    pal.add(lbl,
                            getGBC(gridx, gridy, 1, gridheight, 0.0, 0.0,
                                    GridBagConstraints.NORTHEAST,
                                    GridBagConstraints.NONE, padxy));
 
                    gridx += 1;
                    pal.add(comptToAdd,
                            getGBC(gridx, gridy, gridwidth, gridheight,
                                    weightx, weighty,
                                    GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.BOTH, padxy));
                    latestIsTextArea = false;
                } else {
                    if (latestGridx == showColumns) { // 本行已经到达最大,此时也需要换行,设置下一
                        // 重置一行位置信息
                        gridx = 0;
                        gridy += 1;
                        gridwidth = 1;
                        gridheight = 1;
                        weightx = 1.0;
                        weighty = 0.0;
                        latestGridx = 0;
                    } else {
                        // 重置一行位置信息
                        if (gridx != 0) {
                            gridx += 1;
                        }
                    }
                    // 普通单行内追加
                    pal.add(lbl,
                            getGBC(gridx, gridy, 1, gridheight, 0.0, 0.0,
                                    GridBagConstraints.NORTHEAST,
                                    GridBagConstraints.NONE, padxy));
 
                    gridx += 1;
                    pal.add(comptToAdd,
                            getGBC(gridx, gridy, gridwidth, gridheight,
                                    weightx, weighty,
                                    GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.BOTH, padxy));
 
                }
 
                latestGridx++;
                latestIsTextArea = false;
                String itemAndFilter = item.getItemAddFilter();
                if (itemAndFilter != null && !"".equals(itemAndFilter)) {
                    SELECT_ATTRIBUTE.put(field, itemAndFilter);
                }
 
                // 处理属性与属性之间的关联控制数据
                cascadeControlsMapConfig(item);
 
                // 处理属性与属性之间的 显示 控制数据
                parseFieldRefHideAndShowData(item);
 
                if (compt instanceof VCIJComboBox) {
                    VCIJComboBox cbx = (VCIJComboBox) compt;
                    // 主控属性,需要加入数据选择后的事件处理
                    if (cascadeControlsMap.containsKey(field)) {
                        cbx.addActionListener(new CascadeComboBoxActionListener(
                                item));
                    }
                    if (hiddenControlsMap.containsKey(field)) {
                        cbx.addActionListener(new HiddenOrShowComboBoxActionListener(
                                item));
                    }
                    ctrlComboBoxMap.put(field, cbx);
                } else if (compt instanceof RefObjChooseControl) {
                    // 参照类型的控件,需要注册数据选择后的处理逻辑
                    RefObjChooseControl rocc = (RefObjChooseControl) compt;
                    if (!"".equals(item.getItemListTable())
                            && !"".equals(item.getItemListVal())
                            && !"1".equals(item.getItemIsEditable())) {
 
                        registeRefObjChooseListener(rocc);
                    }
                }
            }
 
            // 当为浏览时设置空间不可编辑
            if (operateType.equals(OperateType.BROWSER)) {
                // add by xchao 2014.04.21 begin
                // 浏览模式下的txt控件为只读
                if (JTextComponent.class.isAssignableFrom(compt.getClass())) {
                    compt.setEnabled(true);
                    ((JTextComponent) compt).setEditable(false);
                } else {
                    compt.setEnabled(false);
                }
                // add by xchao 2014.04.21 end
            } else if (operateType.equals(OperateType.SELECT)) {
                // 如果为选择窗口时,需要判断form的类型来禁用相关的控件
                // 如果是业务类型,禁用所有控件,如果是link类型,禁用t_oid控件
                if (typeFlag == PortalVITypeFlag.BtmType) {
                    compt.setEnabled(false);
                } else {
                    String head = "";
                    if (direction) {
                        head = "t_oid";
                    } else {
                        head = "f_oid";
                    }
                    if (field.toLowerCase().startsWith(head)) {
                        compt.setEnabled(false);
                    }
                }
            }
            VCIJLabel lblFill = new VCIJLabel("");
            pal.add(lblFill,
                    getGBC(0, gridy + 10, showColumns * 2, 1, 1.0, 1.0,
                            GridBagConstraints.NORTHEAST,
                            GridBagConstraints.BOTH, padxy));
        }
 
        // 根据显示控制,隐藏控件显示
        for (Iterator<String> it = hiddenControlsMap.keySet().iterator(); it
                .hasNext();) {
            String masterField = it.next();
            List<String> list = hiddenControlsMap.get(masterField);
            for (String filedToControl : list) {
                if (ctrlLabelMap.containsKey(filedToControl))
                    ctrlLabelMap.get(filedToControl).setEnabled(false);
                if (ctrlComptMap.containsKey(filedToControl))
                    ctrlComptMap.get(filedToControl).setEnabled(false);
            }
        }
 
        loadComboboxDatas();
 
        return pal;
    }
 
    private void loadComboboxDatas() {
        for (Iterator<String> it = ctrlComboBoxMap.keySet().iterator(); it
                .hasNext();) {
            String field = it.next();
            if (fieldToMasterFieldMap.containsKey(field))
                continue;
            loadComboBoxData(field);
        }
    }
 
    private void loadComboBoxData(String field) {
        VCIJComboBox cbx = ctrlComboBoxMap.get(field);
        String sql = SELECT_ATTRIBUTE.get(field);
        if (sql == null)
            return;
        ComboBoxModel model = new DefaultComboBoxModel();
 
        if (sql.indexOf(":") < 0) { // 纯SQL,直接执行查询
            model = convertSQLDataToDataModel(getSQLData(sql,
                    new AttributeValue[0]));
        } else {
            for (Iterator<String> it = SELECT_ATTRIBUTE_VALUE.keySet()
                    .iterator(); it.hasNext();) {
                String akey = it.next();
                String[] ckeys = akey.split("-");
                String ckey = ckeys[ckeys.length - 1];
                if (ckey.indexOf("\\.") >= 0) {
                    ckey = ckey.split("\\.")[0];
                }
                if (sql.indexOf(":" + ckey) >= 0) {
                    AttributeValue attrVal = new AttributeValue();
                    attrVal.attrName = ckey;
                    attrVal.attrVal = SELECT_ATTRIBUTE_VALUE.get(ckey);
 
                    model = convertSQLDataToDataModel(getSQLData(sql,
                            new AttributeValue[] { attrVal }));
                    break;
                }
            }
        }
        cbx.setModel(model);
        if (model.getSize() > 0) {
            VCIJComboBoxModelValueObject obj = (VCIJComboBoxModelValueObject) model
                    .getElementAt(0);
            String key = field;
            if (field.indexOf(".") >= 0) {
                String[] keys = field.split("\\.");
                key = keys[keys.length - 1];
            }
            SELECT_ATTRIBUTE_VALUE.put(key, obj.getValue());
 
            cbx.setSelectedItem(obj);
        }
        if (operateType == OperateType.BROWSER) {
            cbx.setEnabled(false);
        }
    }
 
    private String[] getSQLData(String sql, AttributeValue[] attrVals) {
        String[] clsfVals = new String[0];
        ClientBusinessObjectOperation bofactory = new ClientBusinessObjectOperation();
        try {
            clsfVals = bofactory.getClassficationValue(sql, attrVals);
        } catch (VCIError e) {
            e.printStackTrace();
        }
        return clsfVals;
    }
 
    private ComboBoxModel convertSQLDataToDataModel(String[] results) {
        DefaultComboBoxModel model = new DefaultComboBoxModel();
        for (String res : results) {
            VCIJComboBoxModelValueObject obj = new VCIJComboBoxModelValueObject(
                    res, res);
            model.addElement(obj);
        }
        return model;
    }
 
    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);
    }
 
    /**
     * 处理属性之间的关联查询控制
     * 
     * @param item
     */
    private void cascadeControlsMapConfig(PRMItem item) {
        String field = item.getItemField();
        String itemQueryRefFields = item.getItemQueryRefFields();
        if (itemQueryRefFields != null && !"".equals(itemQueryRefFields)) {
            // 一个属性能够关联 多个属性,被关联的属性名称之间用逗号,分隔
            String[] itemQueryRefFieldsArray = itemQueryRefFields.split(",");
            List<String> list = new ArrayList<String>();
            if (cascadeControlsMap.containsKey(field)) {
                list = cascadeControlsMap.get(field);
            }
            for (String refField : itemQueryRefFieldsArray) {
                // 建立 主控属性与被属性之间关联关系,以控制被控属性的取值
                list.add(refField);
 
                // 建立被控属性 与 主控属性 之间的映射关联
                fieldToMasterFieldMap.put(refField, field);
            }
            cascadeControlsMap.remove(field);
            cascadeControlsMap.put(field, list);
        }
    }
 
    private void parseFieldRefHideAndShowData(PRMItem item) {
        String field = item.getItemField();
        String itemCtrlDisplayCol = item.getItemCtrlDisplyCol();
        if (itemCtrlDisplayCol != null && !"".equals(itemCtrlDisplayCol)) {
            String[] itemCtrlDisplayCols = itemCtrlDisplayCol.split(",");
            List<String> list = new ArrayList<String>();
            if (hiddenControlsMap.containsKey(field)) {
                list = hiddenControlsMap.get(field);
            }
            for (String refField : itemCtrlDisplayCols) {
                list.add(refField);
            }
            hiddenControlsMap.remove(field);
            hiddenControlsMap.put(field, list);
        }
    }
 
    private class CascadeComboBoxActionListener implements ActionListener {
        private PRMItem fromItem = null;
 
        public CascadeComboBoxActionListener(PRMItem fromItem) {
            this.fromItem = fromItem;
        }
 
        @Override
        public void actionPerformed(ActionEvent e) {
            VCIJComboBox cbx = (VCIJComboBox) e.getSource();
            VCIJComboBoxModelValueObject valObj = (VCIJComboBoxModelValueObject) cbx
                    .getSelectedItem();
            if (fromItem.getItemQueryRefFields() != null
                    && !"".equals(fromItem.getItemQueryRefFields())) {
                refFieldHandler(fromItem, valObj);
            }
        }
    }
 
    private void refFieldHandler(PRMItem item,
            VCIJComboBoxModelValueObject valObj) {
        String fromField = item.getItemField();
        if (fromField.indexOf(".") >= 0) {
            String[] keys = fromField.split("\\.");
            String key = keys[keys.length - 1];
            SELECT_ATTRIBUTE_VALUE.put(key, valObj.getValue());
        } else {
            SELECT_ATTRIBUTE_VALUE.put(fromField, valObj.getValue());
        }
        String toField = item.getItemQueryRefFields();
        String[] toFields = toField.split(",");
        for (String field : toFields) {
            loadComboBoxData(field);
        }
    }
 
    private class HiddenOrShowComboBoxActionListener implements ActionListener {
        private PRMItem fromItem = null;
 
        public HiddenOrShowComboBoxActionListener(PRMItem fromItem) {
            this.fromItem = fromItem;
        }
 
        @Override
        public void actionPerformed(ActionEvent e) {
            VCIJComboBox cbx = (VCIJComboBox) e.getSource();
            VCIJComboBoxModelValueObject valObj = (VCIJComboBoxModelValueObject) cbx
                    .getSelectedItem();
 
            String[] displayConditions = fromItem.getItemCtrlDisplyCondition()
                    .split(";");
            List<String> controlToFiels = hiddenControlsMap.get(fromItem
                    .getItemField());
            for (int i = 0; i < controlToFiels.size(); i++) {
                // 被控制属性字段
                String toField = controlToFiels.get(i);
 
                String condition = displayConditions[i];
                // 允许显示出该属性的取值
                String[] diplayShows = condition.split(",");
                boolean enable = false;
                for (String display : diplayShows) {
                    enable |= valObj.getName().equals(display);
                }
                Component compt = ctrlLabelMap.get(toField);
                if (compt != null)
                    compt.setEnabled(enable
                            && operateType != OperateType.BROWSER);
 
                compt = ctrlComptMap.get(toField);
                if (compt != null)
                    compt.setEnabled(enable
                            && operateType != OperateType.BROWSER);
            }
        }
    }
 
    /**
     * 为参照属性注册数据选择&更换后的事件处理程序
     * 
     * @param rocc
     */
    private void registeRefObjChooseListener(RefObjChooseControl rocc) {
        rocc.addPropertyChangeListener(RefObjChooseControl.REF_OBJECT_CHANGED,
                new PropertyChangeListener() {
                    @SuppressWarnings("unchecked")
                    @Override
                    public void propertyChange(PropertyChangeEvent evt) {
                        Map<String, String> newValMap = (Map<String, String>) evt
                                .getNewValue();
                        RefObjChooseControl source = (RefObjChooseControl) evt
                                .getSource();
                        refreshOtherRefObjChooseControlData(source, newValMap);
                    }
                });
    }
 
    /**
     * 刷新参照对象引用数据
     * 
     * @param rocc
     * @param newVal
     */
    private void refreshOtherRefObjChooseControlData(RefObjChooseControl rocc,
            Map<String, String> newVal) {
        PRMItem item = rocc.getPRMItem();
        String itemField = item.getItemField();
        String oid = newVal.get(UIHelper.OID);
        if (oid == null || "".equals(oid))
            return;
 
        // 查询关联列,数据处理
        if (item.getItemQueryRefFields() != null
                && !"".equals(item.getItemQueryRefFields())) {
            // 被关联的属性列表
            String[] toFields = item.getItemQueryRefFields().split(",");
            for (String toField : toFields) {
                PRMItem toItem = itemMap.get(toField);
                if (toItem == null)
                    continue;
                String toFilter = toItem.getItemAddFilter();
                if (toFilter == null || "".equals(toFilter))
                    continue;
                if (!ctrlComboBoxMap.containsKey(toField))
                    continue;
                SELECT_ATTRIBUTE.put(toField, toFilter);
                SELECT_ATTRIBUTE_VALUE.put(itemField, oid);
                loadComboBoxData(toField);
            }
        }
 
        // 相同参照对象的数据处理
        for (Iterator<String> it = ctrlComptMap.keySet().iterator(); it
                .hasNext();) {
            String key = it.next();
            Component compt = ctrlComptMap.get(key);
            // 规约:参照对象的其它参照只能是文本框。
            if (compt instanceof VCIJTextField) {
                VCIJTextField txt = (VCIJTextField) compt;
                PRMItem itemOther = (PRMItem) txt.getObj();
                String fieldOther = itemOther.getItemField();
                if (fieldOther.indexOf(itemField) >= 0) {
                    String[] fields = fieldOther.split("\\.");
                    fieldOther = fields[fields.length - 1];
                    String valueOther = newVal.get(fieldOther);
                    txt.setText(valueOther);
                }
            }
        }
    }
 
}