/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

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