OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 132 Rev 156
Line 14... Line 14...
14
 package org.openconcerto.ui.light;
14
 package org.openconcerto.ui.light;
15
 
15
 
16
import org.openconcerto.utils.io.JSONConverter;
16
import org.openconcerto.utils.io.JSONConverter;
17
import org.openconcerto.utils.io.Transferable;
17
import org.openconcerto.utils.io.Transferable;
18
 
18
 
-
 
19
import java.io.Externalizable;
-
 
20
import java.io.IOException;
-
 
21
import java.io.ObjectInput;
-
 
22
import java.io.ObjectOutput;
-
 
23
 
19
import net.minidev.json.JSONObject;
24
import net.minidev.json.JSONObject;
20
 
25
 
21
public class TableSpec implements Transferable {
26
public class TableSpec implements Transferable, Externalizable {
22
    private String id;
27
    private String id;
23
    private ColumnsSpec columns;
28
    private ColumnsSpec columns;
24
    private TableContent content;
29
    private TableContent content;
25
    private RowSelectionSpec selection;
30
    private RowSelectionSpec selection;
26
    private SearchSpec search;
31
    private SearchSpec search;
27
    private Boolean variableColumnsCount = false;
32
    private Boolean variableColumnsCount = false;
28
 
33
 
-
 
34
    public TableSpec() {
-
 
35
        // Serialization
-
 
36
    }
-
 
37
 
29
    public TableSpec(final String tableId, final RowSelectionSpec selection, final ColumnsSpec columns) {
38
    public TableSpec(final String tableId, final RowSelectionSpec selection, final ColumnsSpec columns) {
30
        this.id = tableId + ".spec";
39
        this.id = tableId + ".spec";
31
        if (selection == null) {
40
        if (selection == null) {
32
            throw new IllegalArgumentException("null RowSelectionSpec");
41
            throw new IllegalArgumentException("null RowSelectionSpec");
33
        }
42
        }
Line 140... Line 149...
140
            this.search = new SearchSpec(jsonSearch);
149
            this.search = new SearchSpec(jsonSearch);
141
        }
150
        }
142
 
151
 
143
        this.variableColumnsCount = (Boolean) JSONConverter.getParameterFromJSON(json, "variable-columns-count", Boolean.class);
152
        this.variableColumnsCount = (Boolean) JSONConverter.getParameterFromJSON(json, "variable-columns-count", Boolean.class);
144
    }
153
    }
-
 
154
 
-
 
155
    @Override
-
 
156
    public void writeExternal(ObjectOutput out) throws IOException {
-
 
157
        out.writeUTF(id);
-
 
158
        this.columns.writeExternal(out);
-
 
159
        this.content.writeExternal(out);
-
 
160
 
-
 
161
        this.selection.writeExternal(out);
-
 
162
        this.search.writeExternal(out);
-
 
163
 
-
 
164
        out.writeBoolean(this.variableColumnsCount);
-
 
165
 
-
 
166
    }
-
 
167
 
-
 
168
    @Override
-
 
169
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-
 
170
        this.id = in.readUTF();
-
 
171
        this.columns = new ColumnsSpec();
-
 
172
        this.columns.readExternal(in);
-
 
173
        this.content = new TableContent();
-
 
174
        this.content.readExternal(in);
-
 
175
        this.selection = new RowSelectionSpec();
-
 
176
        this.selection.readExternal(in);
-
 
177
        this.search = new SearchSpec();
-
 
178
        this.search.readExternal(in);
-
 
179
        this.variableColumnsCount = in.readBoolean();
-
 
180
    }
-
 
181
 
145
}
182
}