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