Statistics
| Revision:

svn-document-layout / trunk / org.gvsig.layout / org.gvsig.layout.app / org.gvsig.layout.app.table / src / main / java / org / gvsig / layout / table / lib / impl / DefaultTable.java @ 825

History | View | Annotate | Download (1.97 KB)

1
package org.gvsig.layout.table.lib.impl;
2

    
3
import java.awt.geom.Point2D;
4
import java.util.List;
5
import org.gvsig.layout.table.lib.Cell;
6
import org.gvsig.layout.table.lib.Table;
7

    
8
/**
9
 *
10
 * @author jjdelcerro
11
 */
12
public class DefaultTable implements Table {
13

    
14
    private final Cell[][] cells;
15
    private final int rows;
16
    private final int cols;
17
    private final List<String>columnNames;
18
    private final List<Class>columnClass;
19
    
20
    public DefaultTable(int rows, int cols, List<String>columnNames, List<Class>columnClass) {
21
        this.rows = rows;
22
        this.cols = cols;
23
        this.columnNames = columnNames;
24
        this.columnClass = columnClass;
25
        this.cells = new Cell[rows][cols];
26
    }
27
    
28
    @Override
29
    public int getRowCount() {
30
        return this.rows;
31
    }
32

    
33
    @Override
34
    public int getColumnCount() {
35
        return this.cols;
36
    }
37

    
38
    @Override
39
    public String getColumnName(int columnIndex) {
40
        return this.columnNames.get(columnIndex);
41
    }
42

    
43
    @Override
44
    public Class<?> getColumnClass(int columnIndex) {
45
        return this.columnClass.get(columnIndex);
46
    }
47

    
48
    @Override
49
    public Cell getCellAt(int rowIndex, int columnIndex) {
50
        Cell cell = this.cells[rowIndex][columnIndex];
51
        if( cell == null ) {
52
            cell = new DefaultCell();
53
            this.cells[rowIndex][columnIndex] = cell;
54
        }
55
        return cell;
56
    }
57

    
58
    @Override
59
    public void setPosition(int x, int y) {
60
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
61
    }
62

    
63
    @Override
64
    public void setPosition(Point2D position) {
65
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
66
    }
67

    
68
    @Override
69
    public Point2D getPosition() {
70
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
71
    }
72
    
73
}