wangting
2024-12-26 fa261e8c1220b31af54e8167e4de9c3320b1af27
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
package com.vci.client.framework.specialrole;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.vci.client.ui.table.VCIBaseTableModel;
/**
 * <p>Title: VCIBaseTableExtend</p>
 * <p>Description: table页model </p>
 * <p>Copyright: Copyright (c) 2012</p>
 * <p>Company: VCI</p>
 * @author wangxl
 * @time 2012-5-9
 * @version 1.0
 */
public class VCIBaseTableExtend extends VCIBaseTableModel {
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    protected Map<String, String> secTypes = new HashMap<String, String>(); 
    protected List<String> editableColumns = new ArrayList<String>();
    public VCIBaseTableExtend(String[] columns, Class[] classes){
        super(columns, classes);
    }
    
    public boolean isCellEditable(int rowIndex, int columnIndex){
        boolean edit = false;
        Object obj = getValueAt(rowIndex, columnIndex);
        String text = obj == null ? "" : obj.toString();
        if(columnIndex == 0 && (text.equals("true") || text.equals("false"))) {
            edit = true;
        }
        String col = String.valueOf(columnIndex);
        if(editableColumns.contains(col)){
            edit = true;
        }
        return edit;
    }
 
    
    /**
     * 添加可编辑的列索引
     * @param columns
     */
    public void setEditableColumn(int... columns){
        for(int col : columns){
            editableColumns.add(String.valueOf(col));
        }
    }
}