initial quantum version
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / sql / TableRow.java
1 package com.quantum.sql;
2
3 import com.quantum.model.Bookmark;
4 import com.quantum.model.Entity;
5 import com.quantum.util.StringMatrix;
6
7 public class TableRow {
8         private String[] columnNames;
9         private Bookmark bookmark;
10         private String table;
11     private Entity entity;
12     private StringMatrix fullTableData;
13     
14     public TableRow(Entity entity, Bookmark bookmark, String table, StringMatrix tableData) {
15         this.entity = entity;
16         this.table = table;
17         // tableData will contain the first row of the tableData, for compatibility reasons with older code
18         // TODO: refactor the older code to allow for multiple selections
19         this.columnNames = tableData.getHeader();
20         this.bookmark = bookmark;
21         this.fullTableData = tableData;
22     }
23         
24         public int getColumnCount() {
25                 return columnNames.length;
26         }
27         
28         public String[] getColumnNames() {
29                 return columnNames;
30         }
31
32         public String getTable() {
33                 return table;
34         }
35
36         public Bookmark getBookmark() {
37                 return this.bookmark;
38         }
39
40     public Entity getEntity() {
41         return this.entity;
42     }
43
44         public void setColumnNames(String[] columnNames) {
45                 this.columnNames = columnNames;
46         }
47
48         public String[] getTableData() {
49                 return getTableRow(0);
50         }
51         
52         public String[] getTableRow(int i) {
53                 return fullTableData.getRow(i);
54         }
55         
56         public StringMatrix getRowTableData() {
57                 return fullTableData;
58         }
59
60 }