| 1 |
package org.guha.rcdk.view.table; |
| 2 |
|
| 3 |
import javax.swing.table.AbstractTableModel; |
| 4 |
|
| 5 |
/** |
| 6 |
* @author Rajarshi Guha |
| 7 |
*/ |
| 8 |
|
| 9 |
public class StructureTableModel extends AbstractTableModel { |
| 10 |
private Object[][] rows; |
| 11 |
private String[] columns; |
| 12 |
|
| 13 |
public StructureTableModel(Object[][] objs, String[] cols) { |
| 14 |
rows = objs; |
| 15 |
columns = cols; |
| 16 |
} |
| 17 |
|
| 18 |
public String getColumnName(int column) { |
| 19 |
return columns[column]; |
| 20 |
} |
| 21 |
|
| 22 |
public int getRowCount() { |
| 23 |
return rows.length; |
| 24 |
} |
| 25 |
|
| 26 |
public int getColumnCount() { |
| 27 |
return columns.length; |
| 28 |
} |
| 29 |
|
| 30 |
public Object getValueAt(int row, int column) { |
| 31 |
return rows[row][column]; |
| 32 |
} |
| 33 |
|
| 34 |
public boolean isCellEditable(int row, int column) { |
| 35 |
return true; |
| 36 |
} |
| 37 |
|
| 38 |
public Class getColumnClass(int column) { |
| 39 |
return getValueAt(0, column).getClass(); |
| 40 |
} |
| 41 |
} |