田源
2025-01-09 8a166a60cfd1a2e593ffa103d10c0dc224fc8628
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
package com.vci.client.auth2.model;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.swing.table.DefaultTableModel;
 
import com.vci.corba.framework.data.GrandValue;
 
 
public class BooleanTableModel extends DefaultTableModel {
    /**
     * 
     */
    private static final long serialVersionUID = 3807575578815547148L;
    private static String[] tableHeader = new String[] { "规则名称", "规则类型" };
    // 规则信息缓存
    private Map<Integer, List<GrandValue>> Datas = new HashMap<Integer, List<GrandValue>>();
 
    // ID,USERS,USERGROUPS,USERROLES,IDENTIFIER,EXPRESSIONTOSQL,ISGRANT,RULETEXT,SENIORRULETEXT
 
    // private String[] tableIdentifiers = new String[] { "RULENAME",
    // "RULETYPE"};
    public BooleanTableModel() {
        setColumnCount(tableHeader.length);
        setColumnIdentifiers(tableHeader);
    }
 
    public void RemoveAllConditionValue() {
        Datas.clear();
    }
 
    public void setConditionValue(int row, List<GrandValue> value) {
 
        Datas.put(row, value);
    }
 
    public List<GrandValue> getConditionValueAt(int row) {
        List<GrandValue> conditonValue = Datas.get(row);
        return conditonValue;
    }
 
    public void removeRow(int row) {
        super.removeRow(row);
        // 规则信息缓存
        Datas.remove(row);
    }
 
    public Class<?> getColumnClass(int columnIndex) {
        
        //没有规则信息,即页面初始化时
        //getRowCount() == 0
        if (getRowCount() == 0 || getColumnCount() < columnIndex
                || getValueAt(0, columnIndex) == null)
            return Object.class;
        return getValueAt(0, columnIndex).getClass();
    }
 
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return false;
    }
    
}