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
package com.vci.client.workflow.commom;
 
import javax.swing.JTable;
 
import com.vci.client.ui.table.VCIBaseTableModel;
import com.vci.client.ui.table.VCIBaseTableNode;
 
/**
 * <p>Title:RightDistributionTableModel</p>
 * <p>Description:数据操作授权共同类,用于excel创建</p>
 *  <p>Copyright: Copyright (C) 2011 </p>
 *  <p>Company: VCI </p>
 *  
 *  @author wangxl
 *  @time 2011-6-21
 *  @version 1.0
 */
public class RightDistributionTableModel  extends VCIBaseTableModel {
    
    private static final long serialVersionUID = 1L;
    private String[] columns= null;
    private Class[] classes = null;
    
    public RightDistributionTableModel(String[] columns , Class[] classes) {
        super(columns, classes);
        this.columns = columns;
        this.classes = classes;
    }
 
    public boolean isCellEditable(int row, int col) {
//        if(col != 0) return true;
//        else return false;
        return true;
    }
    
    public void setValueAt(Object value, int rowIndex, int colIndex) {
        VCIBaseTableNode node = list.get(rowIndex);
        if(!node.equals(null)&&value!=null){
            node.setPropertyValueByName(columns[colIndex], value);
        }
    }
 
    public String[] getColumns() {
        return columns;
    }
    
    public void saveTableEditData(JTable table) {
        if (table.isEditing()) {
            table.getCellEditor(table.getEditingRow(), table.getEditingColumn()).stopCellEditing();
        }
    }
}