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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package com.vci.client.omd.lifecycle.ui;
 
import java.util.Vector;
 
import javax.swing.table.AbstractTableModel;
 
 class LifeCycleTableModel extends AbstractTableModel {
 
        private static final long serialVersionUID = -7495940408592595397L;
 
        private Vector content = null;
 
        private String[] title_name = {"跃迁事件"};
 
        public LifeCycleTableModel() {
            content = new Vector();
        }
 
        public LifeCycleTableModel(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) {
            if (content.size() <= row)
                return "";
            
            Vector var = (Vector) content.get(row);
            if (var.size() <= col)
                return "";
            
            return var.get(col);
            //return ((Vector) content.get(row)).get(col);
            
        }
 
        /**
         * �����������
         */
        public Class getColumnClass(int col) {
            return getValueAt(0, col).getClass();
        }
 
}