1 7 package org.ejtools.swing.table; 8 9 import javax.swing.table.TableModel ; 10 11 15 public abstract class TableModelIndexed extends TableModelDecorator 16 { 17 18 protected int[] indexes = new int[0]; 19 20 21 26 public TableModelIndexed(TableModel model) 27 { 28 super(model); 29 } 30 31 32 37 public int getRowCount() 38 { 39 return this.indexes.length; 40 } 41 42 43 50 public Object getValueAt(int row, int column) 51 { 52 return this.model.getValueAt(this.indexes[row], column); 53 } 54 55 56 59 public void setModel(TableModel model) 60 { 61 super.setModel(model); 62 } 63 64 65 72 public void setValueAt(Object newValue, int row, int column) 73 { 74 this.model.setValueAt(newValue, this.indexes[row], column); 75 } 76 77 78 84 protected void swap(int i, int j) 85 { 86 int tmp = indexes[i]; 87 indexes[i] = indexes[j]; 88 indexes[j] = tmp; 89 } 90 } 91 | Popular Tags |