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;
|
}
|
|
}
|