1 | |
package org.kuali.student.common.ui.client.widgets.table.scroll; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
|
5 | |
public abstract class AbstractTableModel implements TableModel{ |
6 | 0 | ArrayList<TableModelListener> tableModelListenerList = new ArrayList<TableModelListener>(); |
7 | |
|
8 | 0 | public AbstractTableModel(){ |
9 | |
|
10 | 0 | } |
11 | |
|
12 | |
|
13 | |
public void addTableModelListener(TableModelListener lis) { |
14 | 0 | tableModelListenerList.add(lis); |
15 | 0 | } |
16 | |
|
17 | |
public void removeTableModelListener(TableModelListener l) { |
18 | 0 | tableModelListenerList.remove(l); |
19 | 0 | } |
20 | |
|
21 | |
public void fireTableStructureChanged() { |
22 | 0 | TableModelEvent event = new TableModelEvent(); |
23 | 0 | event.setType(TableModelEvent.TableStructure); |
24 | 0 | fireTableChanged(event); |
25 | 0 | } |
26 | |
|
27 | |
public void fireTableDataChanged() { |
28 | 0 | TableModelEvent event = new TableModelEvent(); |
29 | 0 | event.setType(TableModelEvent.TableData); |
30 | 0 | fireTableChanged(event); |
31 | 0 | } |
32 | |
|
33 | |
public void fireTableRowsDeleted(int firstRow, int lastRow) { |
34 | 0 | TableModelEvent event = new TableModelEvent(); |
35 | 0 | event.setFirstRow(firstRow); |
36 | 0 | event.setLastRow(lastRow); |
37 | 0 | event.setType(TableModelEvent.RowDelete); |
38 | 0 | fireTableChanged(event); |
39 | 0 | } |
40 | |
|
41 | |
public void fireTableRowsUpdated(int firstRow, int lastRow) { |
42 | 0 | TableModelEvent event = new TableModelEvent(); |
43 | 0 | event.setFirstRow(firstRow); |
44 | 0 | event.setLastRow(lastRow); |
45 | 0 | event.setType(TableModelEvent.RowUpdate); |
46 | 0 | fireTableChanged(event); |
47 | 0 | } |
48 | |
|
49 | |
public void fireTableRowsInsert(int firstRow, int lastRow) { |
50 | 0 | TableModelEvent event = new TableModelEvent(); |
51 | 0 | event.setFirstRow(firstRow); |
52 | 0 | event.setLastRow(lastRow); |
53 | 0 | event.setType(TableModelEvent.RowInsert); |
54 | 0 | fireTableChanged(event); |
55 | 0 | } |
56 | |
|
57 | |
public void fireTableCellUpdated(int row, int column) { |
58 | 0 | TableModelEvent event = new TableModelEvent(); |
59 | 0 | event.setColumn(column); |
60 | 0 | event.setFirstRow(row); |
61 | 0 | event.setLastRow(row); |
62 | 0 | event.setType(TableModelEvent.CellUpdate); |
63 | 0 | fireTableChanged(event); |
64 | 0 | } |
65 | |
|
66 | |
public void fireTableChanged(TableModelEvent e) { |
67 | 0 | for (TableModelListener lis : tableModelListenerList) { |
68 | 0 | lis.tableChanged(e); |
69 | |
} |
70 | 0 | } |
71 | |
|
72 | |
} |