View Javadoc

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