PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/rcdkjar/src/org/guha/rcdk/view/table/StructureTableModel.java

http://github.com/rajarshi/cdkr
Java | 41 lines | 28 code | 10 blank | 3 comment | 0 complexity | 0f5833a1eb7ffe4af3848243c705711b MD5 | raw file
 1package org.guha.rcdk.view.table;
 2
 3import javax.swing.table.AbstractTableModel;
 4
 5/**
 6 * @author Rajarshi Guha
 7 */
 8
 9public 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}