package com.vci.client.omd.lifecycle.ui; import java.util.Vector; import javax.swing.table.AbstractTableModel; public class TransitionEventsModel extends AbstractTableModel{ private static final long serialVersionUID = -7495940408592595397L; private Vector content = null; private String[] title_name = {"跃迁事件"}; public TransitionEventsModel() { content = new Vector(); } public TransitionEventsModel(int count) { content = new Vector(count); } public void addRow(String age) { Vector v = new Vector(); v.add(age); content.add(v); fireTableDataChanged(); } public void removeRow(int row) { content.remove(row); fireTableDataChanged(); } public void removeRows(int row, int count) { for (int i = 0; i < count; i++) { if (content.size() > row) { content.remove(row); } } fireTableDataChanged(); } /** * �ñ����ijЩֵ���޸ģ�����ҪsetValueAt(Object value, int row, int col)������ϲ���ʹ�޸���Ч */ public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == 0) { return true; } return true; } /** * ʹ�޸ĵ�������Ч */ public void setValueAt(Object value, int row, int col) { ((Vector) content.get(row)).remove(col); ((Vector) content.get(row)).add(col, value); // this.fireTableCellUpdated(row, col); } public String getColumnName(int col) { return title_name[col]; } public int getColumnCount() { return title_name.length; } public int getRowCount() { return content.size(); } public Object getValueAt(int row, int col) { return ((Vector) content.get(row)).get(col); } /** * ����������� */ public Class getColumnClass(int col) { return getValueAt(0, col).getClass(); } }