wangting
2024-09-27 a3e87f78ee262ca9bb7d9b0c997639d5f3295890
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
package com.vci.client.uif.engine.client.tableArea.editable;
 
import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
 
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.text.JTextComponent;
 
import com.vci.client.bof.ClientBusinessObject;
import com.vci.client.bof.ClientBusinessObjectOperation;
import com.vci.client.bof.ClientLinkObject;
import com.vci.client.bof.ClientLinkObjectOperation;
import com.vci.client.common.FreeMarkerCommon;
import com.vci.client.common.FreemarkerParamObject;
import com.vci.client.omd.provider.EnumProvider;
import com.vci.client.portal.utility.PRMItem;
import com.vci.client.ui.date.PopupCalendarPanel;
import com.vci.client.ui.swing.components.VCIJCalendarPanel;
import com.vci.client.ui.swing.components.VCIJComboBox;
import com.vci.client.ui.swing.components.VCIJOptionPane;
import com.vci.client.ui.swing.components.VCIJTable;
import com.vci.client.ui.swing.components.VCIJTextField;
import com.vci.client.ui.swing.components.table.VCIJTableModel;
import com.vci.client.uif.actions.client.PostActionEvent;
import com.vci.client.uif.actions.client.PostActionListener;
import com.vci.client.uif.actions.client.UIFUtils;
import com.vci.client.uif.engine.client.controls.BaseCustomControl;
import com.vci.client.uif.engine.client.controls.ControlFactory;
import com.vci.client.uif.engine.client.controls.DateTimeControl;
import com.vci.client.uif.engine.client.controls.VCIJComboBoxModelValueObject;
import com.vci.client.uif.engine.client.tableArea.TablePanel;
import com.vci.client.uif.engine.client.tableArea.editable.editor.BaseCellEditor;
import com.vci.client.uif.engine.client.tableArea.editable.editor.CustomControlEditor;
import com.vci.client.uif.engine.client.tableArea.editable.editor.TextFieldAndComboBoxEditor;
import com.vci.client.uif.engine.common.IDataNode;
import com.vci.corba.common.VCIError;
import com.vci.corba.omd.data.AttributeValue;
import com.vci.corba.omd.etm.EnumItem;
import com.vci.mw.ClientContextVariable;
 
/**
 * 支持编辑的TablePanel
 */
public class EditableTablePanel extends TablePanel {
 
    private static final long serialVersionUID = 8635218479503006813L;
    private final HashMap<String, List<String>> cascadeControlsMap = new LinkedHashMap<String, List<String>>();
    private final HashMap<String, List<String>> cascadeValueAndKey = new LinkedHashMap<String, List<String>>();
    private final HashMap<String, JComboBox> ctrlComboBoxMap = new LinkedHashMap<String, JComboBox>();
    private HashMap<String, Component> ctrlComptMap = new LinkedHashMap<String, Component>();
    private String sql = null;
 
    public HashMap<String, Component> getCtrlComptMap() {
        return ctrlComptMap;
    }
 
    public void setCtrlComptMap(HashMap<String, Component> ctrlComptMap) {
        this.ctrlComptMap = ctrlComptMap;
    }
    
    public boolean isSupportEditTableCell(){
        return true;
    }
    
    @Override
    protected void initTableListDetailArea(){
        super.initTableListDetailArea();
        setTableCellEditor();
    }
    
    private void setTableCellEditor(){
        // 根据此Table中是否需要支持编辑,设置各列的编辑器
        if(!getButtonAreaPanel().isEditable()) return;
        List<Integer> editableColumnList = getDataProvider().getEditableColumnList();
        TableColumnModel tcm =  getDataTablePanel().getTable().getColumnModel();
        for(int columnIndex : editableColumnList){
            TableColumn tc = tcm.getColumn(columnIndex);
            setTableColumnCellEditor(tc);
        }
    }
    
    private void setTableColumnCellEditor(TableColumn tc){
        int columnIndex = tc.getModelIndex();
        String field = getDataProvider().getIndexToFieldMap().get(columnIndex);
        PRMItem item = getDataProvider().getTableFormPRMItemMap().get(field);
        
        // 列不支持编辑,不处理
        boolean editable = ControlFactory.isEditable(item);
        if(!editable) return;
        Component compt = ControlFactory.createControl(item);
        ctrlComptMap.put(field, compt);
        cascadeControlsMapConfig(item);
        BaseCellEditor editor = null;
        if(compt instanceof JTextField){
            JTextField textField = (JTextField)compt;
            textField.setEditable(true);
            textField.setEnabled(true);
            editor = new TextFieldAndComboBoxEditor(textField);
        } else if(compt instanceof JComboBox){
            final JComboBox cbx = (JComboBox) compt;
            cbx.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    // TODO Auto-generated method stub
                    if(e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.SELECTED+1){
                        itemChanged(e);
                    } 
                }
            });
            cbx.addFocusListener(new FocusListener() {
                @Override
                public void focusLost(FocusEvent e) {
                    // TODO Auto-generated method stub
                }
                @Override
                public void focusGained(FocusEvent e) {
                    focusGain(e);
                }
            });
            loadComboBoxData(cbx, item, null);
            ctrlComboBoxMap.put(field, cbx);
            cbx.setEnabled(true);
            editor = new TextFieldAndComboBoxEditor(cbx);
        } else if(compt instanceof DateTimeControl){
            final VCIJComboBox VCIcbx = new VCIJComboBox();
            VCIcbx.addFocusListener(new FocusListener() {
                @Override
                public void focusGained(FocusEvent e) {
                    new PopupCalendarPanel(VCIcbx, true, true, true,"").show();//add by caill 2016.2.24 PopupCalendarPanel.java中增加了参数个数,此处用""来填充
                }
                @Override
                public void focusLost(FocusEvent e) {
                    
                }
            });
            editor = new TextFieldAndComboBoxEditor(VCIcbx);
        } else if(compt instanceof BaseCustomControl){
            editor = new CustomControlEditor(new VCIJTextField(""));
        }
        if(editor == null){
            editor = new TextFieldAndComboBoxEditor(new VCIJTextField(""));
        }
        editor.setTablePanel(this);
        editor.setPrmItem(item);
        tc.setCellEditor(editor);
    }
    
    //下拉框的选项改变之后,把关联的属性值显示设置为空
    private void itemChanged(ItemEvent e){
        VCIJTable tab = ((VCIJTable)((VCIJComboBox)e.getSource()).getParent());
        int row = tab.getSelectedRow();
        int col = tab.getSelectedColumn();
        List<Integer> refcols = new ArrayList<Integer>();
        String field = getDataProvider().getIndexToFieldMap().get(col);
        if(cascadeControlsMap.containsKey(field)){
            List<String> refFields = cascadeControlsMap.get(field);
            for( String refField : refFields){
                //查找相关联的可以编辑的列
                TableColumnModel tcm =  getDataTablePanel().getTable().getColumnModel();
                List<Integer> editableColumnList = getDataProvider().getEditableColumnList();
                for(int columnIndex : editableColumnList){
                    TableColumn tc = tcm.getColumn(columnIndex);
                    columnIndex = tc.getModelIndex();
                    String fields = getDataProvider().getIndexToFieldMap().get(columnIndex);
                    if(fields.equalsIgnoreCase(refField)){
                        refcols.add(columnIndex);
                    }
                }
                //关联数据显示为空
                VCIJTableModel<IDataNode> model = getDataTablePanel().getTableModel();
                for(int refcol:refcols){
                    model.setValueAt("", row, refcol);
                    model.fireTableCellUpdated(row, refcol);
                    getDataTablePanel().setTableModel(model);
                }
            }
        }
    }
    //获得鼠标焦点事件,刷新下拉框数据
    private void focusGain(FocusEvent e){
        // TODO Auto-generated method stub
        VCIJTable tab = ((VCIJTable)((VCIJComboBox)e.getSource()).getParent());
        int row = tab.getSelectedRow();
        int col = tab.getSelectedColumn();
        String field = getDataProvider().getIndexToFieldMap().get(col);
        int refcols = -1;
        JComboBox com = ctrlComboBoxMap.get(field);
        PRMItem itemto = getDataProvider().getTableFormPRMItemMap().get(field);
        //获得与属性相关联的属性
        if (cascadeValueAndKey.containsKey(field)){
            List<String> refFields = cascadeValueAndKey.get(field);
            if(refFields == null || refFields.size() == 0) {
                return;
            }
            for(String refField: refFields){
                PRMItem item = getDataProvider().getTableFormPRMItemMap().get(refField);
                JComboBox comb = ctrlComboBoxMap.get(refField);
                TableColumnModel tcm =  getDataTablePanel().getTable().getColumnModel();
                List<Integer> editableColumnList = getDataProvider().getEditableColumnList();
                for(int columnIndex : editableColumnList) {
                    TableColumn tc = tcm.getColumn(columnIndex);
                    columnIndex = tc.getModelIndex();
                    String fields = getDataProvider().getIndexToFieldMap().get(columnIndex);
                    if(!fields.equalsIgnoreCase(refField)) {
                        continue;
                    }
                    refcols = columnIndex;
                    String name = tab.getValueAt(row, refcols).toString();
                    int length = comb.getModel().getSize();
                    for(int i= 0; i<length; i++){
                        String modelName = comb.getModel().getElementAt(i).toString();
                        if(name.equals(modelName)){
                            //把关联的属性的默认值设置为显示的值,以便加载属性
                            loadComboBoxData(comb, item , name);
                            //加载属性
                            loadComboBoxData(com, itemto , null);
                        }
                    }
                }
                
            }
        }
    }
 
    //处理属性之间的关联查询控制
    private List<String> cascadeControlsMapConfig(PRMItem item) {
        String field = item.getItemField();
        List<String> list = new ArrayList<String>();
        List<String> refList = new ArrayList<String>();
        String itemQueryRefFields = item.getItemQueryRefFields();
        if (itemQueryRefFields != null && !"".equals(itemQueryRefFields)) {
            // 一个属性能够关联 多个属性,被关联的属性名称之间用逗号,分隔
            String[] itemQueryRefFieldsArray = itemQueryRefFields.split(",");
            for (String refField : itemQueryRefFieldsArray) {
                list.add(refField);
                if (cascadeValueAndKey.get(refField) == null) {
                    refList = new ArrayList<String>();
                } else {
                    refList = cascadeValueAndKey.get(refField);
                }
                if (!refList.contains(field)) {
                    refList.add(field);
                }
                cascadeValueAndKey.put(refField, refList);
            }
        }
        cascadeControlsMap.put(field, list);
        return list;
    }
 
    private String getReplacedSql(String sql){    
        String res = sql;
        Map<String, String> valueMap = new HashMap<String, String>();
        appendToValueMap(sql, valueMap);
        Iterator<String> its = valueMap.keySet().iterator();
        while(its.hasNext()){
            String key = its.next();
            sql = sql.replaceAll(key, key.replace(".", "_"));
        }
        Map<String, FreemarkerParamObject> rootMap = convertValueMapToFPOMap(valueMap);
        res = FreeMarkerCommon.getValueByTempRule(rootMap, sql);
        return res;
    }
    private Map<String, String> appendToValueMap(String replaceField, Map<String, String> valueMap){
        String field = replaceField;
        int begin = field.indexOf("${");
        int end = field.indexOf("}");
        int len = field.length();
        String key = "";
        while(!"".equals(field) && begin >= 0 && end < len){
            key = field.substring(begin + 2, end);
            if(!valueMap.containsKey(key)){
                valueMap.put(key, key);
            }
            field = field.substring(end + 1);
            begin = field.indexOf("${");
            end = field.indexOf("}");
            len = field.length();
        }
        return valueMap;
    }
    public Map<String, FreemarkerParamObject> convertValueMapToFPOMap(
            Map<String, String> map) {
        Map<String, FreemarkerParamObject> rootMap = new LinkedHashMap<String, FreemarkerParamObject>();
        Iterator<String> it = map.keySet().iterator();
        while(it.hasNext()){
            String key = it.next();
            String value = map.get(key);
            if(value.equals(key)){
                value = getValueFromUIControl(key);
            }
            if(value == null){
                value = "";
            }
            String newKey = key.replace(".", "_");
            FreemarkerParamObject fpo = new FreemarkerParamObject(newKey, value);
            rootMap.put(newKey, fpo);
        }
        return rootMap;
    }
    private String getValueFromUIControl(String field){    
        String res = "";
        String key = field;
        Component compt = ctrlComptMap.get(key);
        if(compt instanceof VCIJComboBox){
            VCIJComboBox cbx = (VCIJComboBox)compt;
            Object obj = cbx.getModel().getSelectedItem();
            if(obj != null && obj instanceof VCIJComboBoxModelValueObject){
                VCIJComboBoxModelValueObject val = (VCIJComboBoxModelValueObject)obj;
                if(val != null && !val.getValue().trim().equalsIgnoreCase("")){
                    res = val.getValue();
                }
            }
        } else if(compt instanceof JTextComponent){
            res = ((JTextComponent)compt).getText();
        } else if(compt instanceof VCIJCalendarPanel){
            res = ((VCIJCalendarPanel)compt).getDateString();
        }
        return res;
    }
    private void loadComboBoxData(JComboBox cbx, PRMItem item, String itemName){
        String itemAddFilter = item.getItemAddFilter().toString();
        if(itemAddFilter != null && !"".equals(itemAddFilter)){
            DefaultComboBoxModel model = new DefaultComboBoxModel();
            sql = item.getItemAddFilter();
            sql = getReplacedSql(sql);
            if (sql == null)
                return;
            model = convertSQLDataToDataModel(getMulColSQLData(sql,
                        new AttributeValue[0]), itemName);
            model.insertElementAt(new VCIJComboBoxModelValueObject("",""), 0);
            cbx.setModel(model);
        }
        int length = cbx.getModel().getSize();
        if(cbx.getItemCount() < 1){
            for(int i = 0; i < length; i++ ){
                Object items = cbx.getModel().getElementAt(i);
                if(items != " " && items != null){
                    cbx.addItem(items);
                }
            }
        }
    }
    private DefaultComboBoxModel convertSQLDataToDataModel(String[][] results, String itemName) {
        DefaultComboBoxModel model = new DefaultComboBoxModel();
        for (String[] res : results) {
            VCIJComboBoxModelValueObject obj = new VCIJComboBoxModelValueObject(res[0], res[1]);
            if(obj.toString().equals(itemName)){
                model.setSelectedItem(obj);            
            }
            model.addElement(obj);
            
        }
        return model;
    }
            
    private String[][] getMulColSQLData(String sql, AttributeValue[] attrVals) {
        String[][] vals = new String[0][0];
        ClientBusinessObjectOperation bofactory = new ClientBusinessObjectOperation();
        try {
            vals = bofactory.getSqlQueryResult(sql, attrVals);
        } catch (VCIError e) {
            e.printStackTrace();
        }
        return vals;
    }
    //add by guo end
    
    public void saveChange(Map<String, String> params) throws Exception {
        if(!isChanged()) return;
        if (VCIJOptionPane.showConfirm(this, "您需要保存更改吗?") == VCIJOptionPane.OK_OPTION) {
            executeEvent("preevent", params);
            notifyServerEvent(params);
            if(getDataProvider().getLinkType() == null 
                    || getDataProvider().getLinkType().equals("")){
                saveChangeToBO();        
            } else {        
                saveChangeToLO();
            }
            executeEvent("postevent", params);
            getDataTablePanel().refreshTableData();
        } else {
            getDataTablePanel().refreshTableData();
        }
        setChanged(false);
        setEditingRowIndex(-1);
        setEditingColumnIndex(-1);
    }
    
    /**
     * 把参数值放入全局变量中,以便服务端判断是否执行前后置事件
     */
    private void notifyServerEvent(Map<String, String> params) {
        ClientContextVariable.cleanOtherGlobalVariable();
        if(params != null && params.size() > 0) {
            for(Map.Entry<String, String> entry : params.entrySet()) {
                ClientContextVariable.putGlobalVariable(entry.getKey(), entry.getValue());
            }
        }
    }
    
    /**
     * 执行客户端前后置事件,为Tab编辑功能专用
     * @param eventName 事件key
     * @throws Exception
     */
    private void executeEvent(String eventName, Map<String, String> params) throws Exception {
        if(params.containsKey(eventName)) {
            String className = params.get(eventName);
            if(className != null && className.length() > 0) {
                String[] classNames = className.split(";");
                for(String name : classNames) {                    
                    Object obj = Class.forName(name).getConstructor().newInstance();
                    if(obj instanceof PostActionListener){
                        PostActionListener pal = (PostActionListener)obj;
                        PostActionEvent e = new PostActionEvent();
                        e.setSource(this);
                        pal.actionPerformed(e);
                    }
                }    
            }
        }
    }
    
    /**
     * 保存数据变更
     */
    private void saveChangeToBO(){
        List<ClientBusinessObject> changedCBOs = new LinkedList<ClientBusinessObject>();
        Iterator<Integer> its = changedRowColumnMap.keySet().iterator();
        // 循环发生变量的行
        while(its.hasNext()){
            int rowIndex = its.next();
            ClientBusinessObject cbo = null;
            IDataNode dataNode = getDataNode(rowIndex);
            Map<String, String> valueMap = dataNode.getValueMap();
            String oid = valueMap.get("oid");
            Object masterObject = dataNode.getMaterObject();
            if(masterObject != null && masterObject instanceof ClientBusinessObject){
                cbo = (ClientBusinessObject)masterObject;
            } else {
                cbo = getCBOById(oid, getDataProvider().getShowType());
            }
            List<Integer> columnIndexList = changedRowColumnMap.get(rowIndex);
            // 循环发生变量的列
            for(int columnIndex : columnIndexList){
                String field = getDataProvider().getIndexToFieldMap().get(columnIndex);
                Object valObj = getDataTablePanel().getTableModel().getValueAt(rowIndex, columnIndex);
                String value = getCellValue(valObj);
                try {
                    cbo.setAttributeValue(field, value);
                } catch (VCIError e) {
                    UIFUtils.showErrorMessage(this, e);
                    return;
                }
            }
            changedCBOs.add(cbo);
        }
        try {
            ClientBusinessObject[] cbos = changedCBOs.toArray(new ClientBusinessObject[]{});
            cboOperation.batchUpdateBuinessObject(cbos);
            UIFUtils.showMessage(this, "uifmodel.plm.uif.actions.editsuccessmsg", "");
        } catch (VCIError e) {
            UIFUtils.showErrorMessage(this, e);
        }
    }
    private String getCellValue(Object valObj){
        String res = valObj.toString();
        if(valObj instanceof VCIJComboBoxModelValueObject){
            res = ((VCIJComboBoxModelValueObject)valObj).getValue();
        }
        return res;
    }
    
    private ClientBusinessObjectOperation cboOperation = new ClientBusinessObjectOperation();
    private ClientBusinessObject getCBOById(String oid, String boName){
        ClientBusinessObject cbo = null;
        try {
            cbo = cboOperation.readBusinessObjectById(oid, boName);
        } catch (VCIError e) {
            e.printStackTrace();
        }
        return cbo;
    }
    private ClientLinkObjectOperation cloOperation = new ClientLinkObjectOperation();
    private ClientLinkObject getCLOById(String oid, String linkType){
        ClientLinkObject clo = null;
        try {
            clo = cloOperation.readLinkObjectById(oid, linkType);
        } catch (VCIError e) {
            e.printStackTrace();
        }
        return clo;
    }
    private IDataNode getDataNode(int rowIndex){
        return getDataTablePanel().getSpecialObjectByRowIndex(rowIndex);
    }
    
    private void saveChangeToLO(){
        //TODO 当 Table 显示的是Link 关联出来的数据时,暂时只支持保存LINK的TO端的属性
        Iterator<Integer> its = changedRowColumnMap.keySet().iterator();
        List<ClientBusinessObject> changedCBOs_F = new LinkedList<ClientBusinessObject>();
        List<ClientBusinessObject> changedCBOs_T = new LinkedList<ClientBusinessObject>();
        LinkedList<ClientLinkObject> changedCLOs = new LinkedList<ClientLinkObject>();
        
        try{
            // 循环发生变量的行
            while(its.hasNext()){
                int rowIndex = its.next();
                IDataNode dataNode = getDataNode(rowIndex);
                Map<String, String> valueMap = dataNode.getValueMap();
                String oid = valueMap.get("oid");
                String f_oid = valueMap.get("f_oid");
                String t_oid = valueMap.get("t_oid");
                String btnName_f = valueMap.get("f_btwname");
                String btmName_t = valueMap.get("t_btwname");
                Object masterObject = dataNode.getMaterObject();
                ClientLinkObject clo = null;
                if(masterObject != null && masterObject instanceof ClientLinkObject){
                    clo = (ClientLinkObject)masterObject;
                } else {
                    clo = getCLOById(oid, getDataProvider().getLinkType());
                }
                List<Integer> columnIndexList = changedRowColumnMap.get(rowIndex);
                ClientBusinessObject cbo_f = getCBOById(f_oid, btnName_f);
                ClientBusinessObject cbo_t = getCBOById(t_oid, btmName_t);
                // 循环发生变量的列
                for(int columnIndex : columnIndexList){
                    Object valObj = null;
                    if (getDataTablePanel().isEnableSorter()) {
                        valObj = getDataTablePanel().getTableSorter().getValueAt(rowIndex, columnIndex);
                    } else {
                        valObj = getDataTablePanel().getTableModel().getValueAt(rowIndex, columnIndex);
                    }
                    String field = getDataProvider().getIndexToFieldMap().get(columnIndex);
                    String value = getCellValue(valObj);
                    if(field.contains(".")){
                        String fieldName = field.split("\\.")[1];
                        EnumItem enumName = EnumProvider.getInstance().getEnumByName(fieldName);
                        if(enumName != null){
                            String key = EnumProvider.getInstance().getEnumItemValue(fieldName, (String) valObj);
                            if(key != null && key != ""){
                                value = key;
                            }
                        }
                    } 
                    if(field.startsWith("f_oid.")){
                        field = field.replace("f_oid.", "");    //f_oid.name
                        if(field.contains("\\.")){                //f_oid.usedbypart.name
                            // from 参照属性处理
                        } else {
                            cbo_f.setAttributeValue(field, value);
                        }
                    } else if(field.startsWith("t_oid.")){
                        field = field.replace("t_oid.", "");
                        if(field.contains("\\.")){
                            // to 端参照属性处理
                        } else {
                            cbo_t.setAttributeValue(field, value);
                        }
                    } else {
                        clo.setAttributeValue(field, value);
                    }
                }
                if(cbo_f.getBusinessObject().newAttrValList.length > 0){
                    changedCBOs_F.add(cbo_f);
                }
                if(cbo_t.getBusinessObject().newAttrValList.length > 0){
                    changedCBOs_T.add(cbo_t);
                }
                if(clo.getLinkObject().newAttrValList.length > 0){
                    changedCLOs.add(clo);
                }
            }
            LinkedList<ClientBusinessObject> cbos = new LinkedList<ClientBusinessObject>();
            if(changedCBOs_F.size() > 0){
                cbos.addAll(changedCBOs_F);
            }
            if(changedCBOs_T.size() > 0){
                cbos.addAll(changedCBOs_T);
            }
            ClientBusinessObject[] emptyCBOs = new ClientBusinessObject[0];
            ClientLinkObject[] emptyCLOs = new ClientLinkObject[0];
            cboOperation.batchCUDBOLO(
                    emptyCBOs, emptyCLOs, 
                    cbos.toArray(new ClientBusinessObject[]{}), 
                    changedCLOs.toArray(new ClientLinkObject[]{}), 
                    emptyCBOs, emptyCLOs);
            UIFUtils.showMessage(this, "uifmodel.plm.uif.actions.editsuccessmsg", "");
        }catch(VCIError e){
            UIFUtils.showErrorMessage(this, e);
        }
    }
    
    
    /**
     * 数据是否发生了变更
     */
    private boolean changed = false;
    /**
     * 当前牌编辑单元格,编辑前的值
     */
    private Object oldValue = null;
    /**
     * 当前处于编辑中的行(索引)
     */
    private int editingRowIndex = -1;
    /**
     * 当前处于编辑中的列(索引)
     */
    private int editingColumnIndex = -1;
    /**
     * 变更后的数据行、列
     */
    private Map<Integer, List<Integer>> changedRowColumnMap = new HashMap<Integer, List<Integer>>();
    public boolean isEditing(){
        return editingRowIndex >= 0 && editingColumnIndex >= 0;
    }
    public boolean isChanged() {
        return changed;
    }
    public void setChanged(boolean changed) {
        this.changed = changed;
    }
 
    public Object getOldValue() {
        return oldValue;
    }
    public void setOldValue(Object oldValue) {
        this.oldValue = oldValue;
    }
 
    public int getEditingRowIndex() {
        return editingRowIndex;
    }
 
    public void setEditingRowIndex(int editingRowIndex) {
        this.editingRowIndex = editingRowIndex;
    }
 
    public int getEditingColumnIndex() {
        return editingColumnIndex;
    }
 
    public void setEditingColumnIndex(int editingColumnIndex) {
        this.editingColumnIndex = editingColumnIndex;
    }
 
    public Map<Integer, List<Integer>> getChangedRowColumnMap() {
        return changedRowColumnMap;
    }
 
    public void setChangedRowColumnMap(
            Map<Integer, List<Integer>> changedRowColumnMap) {
        this.changedRowColumnMap = changedRowColumnMap;
    }
 
}