OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Rev 94 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
80 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.ui.light;
15
 
93 ilm 16
import org.openconcerto.utils.io.JSONconverter;
17
import org.openconcerto.utils.io.Transferable;
18
 
80 ilm 19
import java.util.ArrayList;
20
import java.util.Arrays;
21
import java.util.List;
22
 
93 ilm 23
public class TableContent implements Transferable {
80 ilm 24
    private static final long serialVersionUID = 3648381615123520834L;
25
    private List<Row> rows;
26
    private RowSpec spec;
27
 
28
    public TableContent() {
29
        // Serialization
30
    }
31
 
32
    public List<Row> getRows() {
93 ilm 33
        return this.rows;
80 ilm 34
    }
35
 
36
    public void setRows(List<Row> rows) {
37
        this.rows = rows;
38
    }
39
 
40
    public RowSpec getSpec() {
93 ilm 41
        return this.spec;
80 ilm 42
    }
43
 
44
    public void setSpec(RowSpec spec) {
45
        this.spec = spec;
46
    }
47
 
48
    @Override
49
    public String toString() {
93 ilm 50
        return "TableContent of " + this.spec.getTableId() + " columns: " + new ArrayList<String>(Arrays.asList(this.spec.getIds())) + " : " + getRows().size() + " lines";
80 ilm 51
    }
93 ilm 52
 
53
    @Override
54
    public String toJSON() {
55
        final StringBuilder result = new StringBuilder("{");
56
 
57
        result.append("\"rows\":" + JSONconverter.getJSON(this.rows) + ",");
58
        result.append("\"spec\":" + JSONconverter.getJSON(this.spec));
59
 
60
        result.append("}");
61
        return result.toString();
62
    }
80 ilm 63
}