OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 156
Line 28... Line 28...
28
import net.minidev.json.JSONObject;
28
import net.minidev.json.JSONObject;
29
 
29
 
30
public class Row implements Externalizable, JSONAble {
30
public class Row implements Externalizable, JSONAble {
31
 
31
 
32
    private Number id;
32
    private Number id;
33
    private String extendId;
33
    private String extendId = "";// writeExternal crash if not set
34
    private List<Object> values;
34
    private List<Object> values;
35
 
35
 
36
    private Boolean fillWidth = false;
36
    private Boolean fillWidth = false;
37
    private Boolean toggleable = false;
37
    private Boolean toggleable = false;
38
    private Boolean visible = true;
38
    private Boolean visible = true;
Line 45... Line 45...
45
        this.fromJSON(json);
45
        this.fromJSON(json);
46
    }
46
    }
47
 
47
 
48
    public Row(final Number id, int valueCount) {
48
    public Row(final Number id, int valueCount) {
49
        this.id = id;
49
        this.id = id;
50
        this.values = new ArrayList<Object>();
50
        this.values = new ArrayList<>(valueCount);
51
        if (valueCount > 0) {
51
        if (valueCount > 0) {
52
            for (int i = 0; i < valueCount; i++) {
52
            for (int i = 0; i < valueCount; i++) {
53
                this.values.add(null);
53
                this.values.add(null);
54
            }
54
            }
55
        }
55
        }
56
    }
56
    }
57
 
57
 
58
    public Row(final Number id) {
58
    public Row(final Number id) {
59
        this.id = id;
59
        this.id = id;
-
 
60
        this.values = new ArrayList<>();
60
    }
61
    }
61
 
62
 
62
    public final void setValues(List<Object> values) {
63
    public final void setValues(List<Object> values) {
63
        this.values = values;
64
        this.values = values;
64
    }
65
    }
Line 74... Line 75...
74
    public final String getExtendId() {
75
    public final String getExtendId() {
75
        return this.extendId;
76
        return this.extendId;
76
    }
77
    }
77
 
78
 
78
    public final void setExtendId(final String extendId) {
79
    public final void setExtendId(final String extendId) {
-
 
80
        if (extendId == null) {
-
 
81
            throw new IllegalArgumentException("extendId cannot be null");
-
 
82
        }
79
        this.extendId = extendId;
83
        this.extendId = extendId;
80
    }
84
    }
81
 
85
 
82
    public final void addValue(Object v) {
86
    public final void addValue(Object v) {
83
        this.values.add(v);
87
        this.values.add(v);
Line 180... Line 184...
180
                        objValue = JSONConverter.getObjectFromJSON(objValue, Integer.class);
184
                        objValue = JSONConverter.getObjectFromJSON(objValue, Integer.class);
181
                    } else if (objValue instanceof Long) {
185
                    } else if (objValue instanceof Long) {
182
                        objValue = JSONConverter.getObjectFromJSON(objValue, Long.class);
186
                        objValue = JSONConverter.getObjectFromJSON(objValue, Long.class);
183
                    } else if (objValue instanceof Boolean) {
187
                    } else if (objValue instanceof Boolean) {
184
                        objValue = JSONConverter.getObjectFromJSON(objValue, Boolean.class);
188
                        objValue = JSONConverter.getObjectFromJSON(objValue, Boolean.class);
-
 
189
                    } else if (objValue instanceof Double) {
-
 
190
                        objValue = JSONConverter.getObjectFromJSON(objValue, Double.class);
185
                    } else if (objValue != null) {
191
                    } else if (objValue != null) {
186
                        throw new IllegalArgumentException("unknow type: " + objValue.getClass().getName());
192
                        throw new IllegalArgumentException("unknow type: " + objValue.getClass().getName());
187
                    }
193
                    }
188
                }
194
                }
189
                this.values.add(objValue);
195
                this.values.add(objValue);