00001 package clientswing.UI; 00002 import java.awt.*; 00003 import javax.swing.*; 00004 import javax.swing.table.*; 00005 import clientswing.model.*; 00007 public class TableResponseModel extends AbstractTableModel{ 00008 XResponseRowSet rowSet; 00009 public TableResponseModel( XResponseRowSet rowSet) { 00010 this.rowSet=rowSet; 00011 } 00012 00018 public int getRowCount() { 00019 return rowSet.getRowsSize() +1; 00020 } 00021 00022 00030 public Object getValueAt(int rowIndex, int columnIndex) { 00031 00032 Row row; 00033 Column column; 00034 00035 if (rowIndex == 0){ 00036 row = (Row)rowSet.getRows().get(0); 00037 column = (Column)row.getColumns().get(columnIndex); 00038 //System.out.println("column.getName()"+column.getName()+"\n"); 00039 00040 if (column!=null) 00041 return column.getName(); 00042 else 00043 return ""; 00044 } 00045 00046 row = (Row)rowSet.getRows().get(rowIndex - 1); 00047 column = (Column)row.getColumns().get(columnIndex); 00048 System.out.println("column.getValue()"+column.getValue()+"\n"); 00049 return column.getValue() ; 00050 00051 } 00052 00058 public int getColumnCount() { 00059 return ((Row)rowSet.getRows().get(0)).getColumns().size(); 00060 } 00061 }