1 7 package org.ejtools.swing.table; 8 9 import javax.swing.event.TableModelEvent ; 10 import javax.swing.event.TableModelListener ; 11 import javax.swing.table.AbstractTableModel ; 12 import javax.swing.table.TableModel ; 13 14 18 public abstract class TableModelDecorator extends AbstractTableModel implements TableModelListener 19 { 20 21 protected TableModel model = null; 22 23 24 29 public TableModelDecorator(TableModel model) 30 { 31 this.model = model; 32 this.model.addTableModelListener(this); 33 } 34 35 36 37 protected TableModelDecorator() 38 { 39 super(); 40 } 41 42 43 47 public Class getColumnClass(int column) 48 { 49 return this.model.getColumnClass(column); 50 } 51 52 53 56 public int getColumnCount() 57 { 58 return this.model.getColumnCount(); 59 } 60 61 62 66 public String getColumnName(int column) 67 { 68 return this.model.getColumnName(column); 69 } 70 71 72 77 public TableModel getModel() 78 { 79 return this.model; 80 } 81 82 83 86 public int getRowCount() 87 { 88 return this.model.getRowCount(); 89 } 90 91 92 97 public Object getValueAt(int row, int column) 98 { 99 return this.model.getValueAt(row, column); 100 } 101 102 103 108 public boolean isCellEditable(int row, int column) 109 { 110 return this.model.isCellEditable(row, column); 111 } 112 113 114 119 public void setModel(TableModel model) 120 { 121 this.model = model; 122 } 123 124 125 130 public void setValueAt(Object o, int row, int column) 131 { 132 this.model.setValueAt(o, row, column); 133 } 134 135 136 139 public void tableChanged(TableModelEvent event) 140 { 141 this.fireTableChanged(event); 142 } 143 } 144 | Popular Tags |