OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 149 | Rev 174 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 149 Rev 156
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
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
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
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.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.ui.light;
14
 package org.openconcerto.ui.light;
15
 
15
 
16
import org.openconcerto.utils.io.HTMLable;
16
import org.openconcerto.utils.io.HTMLable;
17
import org.openconcerto.utils.io.JSONConverter;
17
import org.openconcerto.utils.io.JSONConverter;
18
import org.openconcerto.utils.io.Transferable;
18
import org.openconcerto.utils.io.Transferable;
19
 
19
 
20
import java.awt.Color;
20
import java.awt.Color;
-
 
21
import java.io.Externalizable;
-
 
22
import java.io.IOException;
-
 
23
import java.io.ObjectInput;
-
 
24
import java.io.ObjectOutput;
21
import java.io.PrintStream;
25
import java.io.PrintStream;
22
 
26
 
23
import net.minidev.json.JSONObject;
27
import net.minidev.json.JSONObject;
24
 
28
 
25
public abstract class LightUIElement implements Transferable {
29
public abstract class LightUIElement implements Transferable, Externalizable {
26
 
30
 
27
    private static final String HORIZONTALLY_RESIZABLE = "horizontally-resizable";
31
    private static final String HORIZONTALLY_RESIZABLE = "horizontally-resizable";
28
    private static final String VERTICALLY_SCROLLABLE = "vertically-scrollable";
32
    private static final String VERTICALLY_SCROLLABLE = "vertically-scrollable";
29
    private static final String VERTICALLY_RESIZABLE = "vertically-resizable";
33
    private static final String VERTICALLY_RESIZABLE = "vertically-resizable";
30
    private static final String HORIZONTALLY_SCROLLABLE = "horizontally-scrollable";
34
    private static final String HORIZONTALLY_SCROLLABLE = "horizontally-scrollable";
31
 
35
 
32
    public enum GlyphIcon {
36
    public enum GlyphIcon {
33
        WARNING("#warning"), PLUS("#plus"), PENCIL("#pencil"), SEARCH("#search"), REMOVE("#remove"), STAR("#star"), STAR_EMPTY("#star-empty"), USER("#user"), LOCK("#lock"), UNLOCK(
37
        WARNING("#warning"), PLUS("#plus"), PENCIL("#pencil"), SEARCH("#search"), REMOVE("#remove"), STAR("#star"), STAR_EMPTY("#star-empty"), USER("#user"), LOCK("#lock"), UNLOCK(
34
                "#unlock"), DOWNLOAD("#download"), UPLOAD("#upload");
38
                "#unlock"), DOWNLOAD("#download"), UPLOAD("#upload");
35
 
39
 
36
        private final String id;
40
        private final String id;
37
 
41
 
38
        GlyphIcon(String id) {
42
        GlyphIcon(String id) {
39
            this.id = id;
43
            this.id = id;
40
        }
44
        }
41
 
45
 
42
        public String getId() {
46
        public String getId() {
43
            return this.id;
47
            return this.id;
44
        }
48
        }
45
    };
49
    };
46
 
50
 
47
    /**
51
    /**
48
     * 
52
     * 
49
     */
53
     */
50
    private static final long serialVersionUID = 3272357171610073289L;
54
    private static final long serialVersionUID = 3272357171610073289L;
51
    // type
55
    // type
52
    public static final int TYPE_LABEL = 0;
56
    public static final int TYPE_LABEL = 0;
53
    public static final int TYPE_TEXT_FIELD = 1;
57
    public static final int TYPE_TEXT_FIELD = 1;
54
    public static final int TYPE_DATE = 2;
58
    public static final int TYPE_DATE = 2;
55
    public static final int TYPE_COMBOBOX = 3;
59
    public static final int TYPE_COMBOBOX = 3;
56
    public static final int TYPE_TABLE = 4;
60
    public static final int TYPE_TABLE = 4;
57
    public static final int TYPE_CHECKBOX = 5;
61
    public static final int TYPE_CHECKBOX = 5;
58
    public static final int TYPE_TABBED_UI = 6;
62
    public static final int TYPE_TABBED_UI = 6;
59
    public static final int TYPE_COMBOBOX_ELEMENT = 7;
63
    public static final int TYPE_COMBOBOX_ELEMENT = 7;
60
    public static final int TYPE_PANEL = 8;
64
    public static final int TYPE_PANEL = 8;
61
    public static final int TYPE_TREE = 9;
65
    public static final int TYPE_TREE = 9;
62
    public static final int TYPE_TEXT = 10;
66
    public static final int TYPE_TEXT = 10;
63
    public static final int TYPE_LIST = 11;
67
    public static final int TYPE_LIST = 11;
64
    public static final int TYPE_DROPDOWN_BUTTON = 12;
68
    public static final int TYPE_DROPDOWN_BUTTON = 12;
65
    public static final int TYPE_FRAME = 13;
69
    public static final int TYPE_FRAME = 13;
66
    public static final int TYPE_IMAGE = 14;
70
    public static final int TYPE_IMAGE = 14;
67
    public static final int TYPE_FILE_UPLOAD_WITH_SELECTION = 15;
71
    public static final int TYPE_FILE_UPLOAD_WITH_SELECTION = 15;
68
    public static final int TYPE_PANEL_LINE = 16;
72
    public static final int TYPE_PANEL_LINE = 16;
69
    public static final int TYPE_TAB_ELEMENT = 17;
73
    public static final int TYPE_TAB_ELEMENT = 17;
70
    public static final int TYPE_SLIDER = 18;
74
    public static final int TYPE_SLIDER = 18;
71
    public static final int TYPE_PICTURE_UPLOAD = 19;
75
    public static final int TYPE_PICTURE_UPLOAD = 19;
72
    public static final int TYPE_BUTTON = 20;
76
    public static final int TYPE_BUTTON = 20;
73
    public static final int TYPE_BUTTON_WITH_CONTEXT = 21;
77
    public static final int TYPE_BUTTON_WITH_CONTEXT = 21;
74
    public static final int TYPE_BUTTON_CANCEL = 22;
78
    public static final int TYPE_BUTTON_CANCEL = 22;
75
    public static final int TYPE_BUTTON_UNMANAGED = 23;
79
    public static final int TYPE_BUTTON_UNMANAGED = 23;
76
    public static final int TYPE_BUTTON_WITH_SELECTION_CONTEXT = 24;
80
    public static final int TYPE_BUTTON_WITH_SELECTION_CONTEXT = 24;
77
    public static final int TYPE_BUTTON_LINK = 25;
81
    public static final int TYPE_BUTTON_LINK = 25;
78
    public static final int TYPE_RAW_HTML = 26;
82
    public static final int TYPE_RAW_HTML = 26;
79
    public static final int TYPE_TEXT_AREA = 27;
83
    public static final int TYPE_TEXT_AREA = 27;
80
    public static final int TYPE_FILE_UPLOAD = 28;
84
    public static final int TYPE_FILE_UPLOAD = 28;
81
    public static final int TYPE_LIST_ROW = 29;
85
    public static final int TYPE_LIST_ROW = 29;
82
    public static final int TYPE_BADGE = 30;
86
    public static final int TYPE_BADGE = 30;
83
    public static final int TYPE_AUTOCOMPLETE_COMBOBOX = 31;
87
    public static final int TYPE_AUTOCOMPLETE_COMBOBOX = 31;
84
    public static final int TYPE_COLOR_PICKER = 32;
88
    public static final int TYPE_COLOR_PICKER = 32;
85
    public static final int TYPE_HOUR_EDITOR = 33;
89
    public static final int TYPE_HOUR_EDITOR = 33;
86
    public static final int TYPE_RADIO_BUTTONS = 34;
90
    public static final int TYPE_RADIO_BUTTONS = 34;
-
 
91
    public static final int TYPE_PASSWORD_FIELD = 35;
-
 
92
 
87
    // valueType
93
    // valueType
88
    public static final int VALUE_TYPE_STRING = 0;
94
    public static final int VALUE_TYPE_STRING = 0;
89
    public static final int VALUE_TYPE_INTEGER = 1;
95
    public static final int VALUE_TYPE_INTEGER = 1;
90
    public static final int VALUE_TYPE_DATE = 2;
96
    public static final int VALUE_TYPE_DATE = 2;
91
    public static final int VALUE_TYPE_REF = 3;
97
    public static final int VALUE_TYPE_REF = 3;
92
    public static final int VALUE_TYPE_LIST = 4;
98
    public static final int VALUE_TYPE_LIST = 4;
93
    public static final int VALUE_TYPE_DECIMAL = 5;
99
    public static final int VALUE_TYPE_DECIMAL = 5;
94
    public static final int VALUE_TYPE_BOOLEAN = 6;
100
    public static final int VALUE_TYPE_BOOLEAN = 6;
95
    // actionType
101
    // actionType
96
    public static final int ACTION_TYPE_SELECTION = 0;
102
    public static final int ACTION_TYPE_SELECTION = 0;
97
    public static final int ACTION_TYPE_REMOVE = 1;
103
    public static final int ACTION_TYPE_REMOVE = 1;
98
    public static final int ACTION_TYPE_REFRESH = 2;
104
    public static final int ACTION_TYPE_REFRESH = 2;
99
 
105
 
100
    // commitMode
106
    // commitMode
101
    public static final int COMMIT_ONCE = 0;
107
    public static final int COMMIT_ONCE = 0;
102
    public static final int COMMIT_INTERACTIVE = 1;
108
    public static final int COMMIT_INTERACTIVE = 1;
103
    // horizontalAlignement
109
    // horizontalAlignement
104
    public static final int HALIGN_RIGHT = 0;
110
    public static final int HALIGN_RIGHT = 0;
105
    public static final int HALIGN_CENTER = 1;
111
    public static final int HALIGN_CENTER = 1;
106
    public static final int HALIGN_LEFT = 2; // Default
112
    public static final int HALIGN_LEFT = 2; // Default
107
    // verticalAlignement
113
    // verticalAlignement
108
    public static final int VALIGN_TOP = 0; // Default
114
    public static final int VALIGN_TOP = 0; // Default
109
    public static final int VALIGN_CENTER = 1;
115
    public static final int VALIGN_CENTER = 1;
110
    public static final int VALIGN_BOTTOM = 2;
116
    public static final int VALIGN_BOTTOM = 2;
111
    // font size
117
    // font size
112
    public static final int FONT_XXSMALL = 0;
118
    public static final int FONT_XXSMALL = 0;
113
    public static final int FONT_XSMALL = 1;
119
    public static final int FONT_XSMALL = 1;
114
    public static final int FONT_SMALL = 2; // Default
120
    public static final int FONT_SMALL = 2; // Default
115
    public static final int FONT_MEDIUM = 3;
121
    public static final int FONT_MEDIUM = 3;
116
    public static final int FONT_LARGE = 4;
122
    public static final int FONT_LARGE = 4;
117
    public static final int FONT_XLARGE = 5;
123
    public static final int FONT_XLARGE = 5;
118
    public static final int FONT_XXLARGE = 6;
124
    public static final int FONT_XXLARGE = 6;
119
 
125
 
120
    public static final int DEFAULT_GRID_HEIGHT = 1;
126
    public static final int DEFAULT_GRID_HEIGHT = 1;
121
    public static final int DEFAULT_GRID_WIDTH = 1;
127
    public static final int DEFAULT_GRID_WIDTH = 1;
122
    public static final int DEFAULT_WEIGHT_X = 0;
128
    public static final int DEFAULT_WEIGHT_X = 0;
123
    public static final int DEFAULT_WEIGHT_Y = 0;
129
    public static final int DEFAULT_WEIGHT_Y = 0;
124
 
130
 
125
    private int fontSize = FONT_SMALL;
131
    private int fontSize = FONT_SMALL;
126
    private int gridHeight = DEFAULT_GRID_HEIGHT;
132
    private int gridHeight = DEFAULT_GRID_HEIGHT;
127
    private int gridWidth = DEFAULT_GRID_WIDTH;
133
    private int gridWidth = DEFAULT_GRID_WIDTH;
128
    private int horizontalAlignment = HALIGN_LEFT;
134
    private int horizontalAlignment = HALIGN_LEFT;
129
    private int verticalAlignment = VALIGN_TOP;
135
    private int verticalAlignment = VALIGN_TOP;
130
    private int weightX = DEFAULT_WEIGHT_X;
136
    private int weightX = DEFAULT_WEIGHT_X;
131
    private int weightY = DEFAULT_WEIGHT_Y;
137
    private int weightY = DEFAULT_WEIGHT_Y;
132
 
138
 
133
    private Integer commitMode;
139
    private Integer commitMode;
134
    private Integer height;
140
    private Integer height;
135
    private Integer marginBottom;
141
    private Integer marginBottom;
136
    private Integer marginLeft;
142
    private Integer marginLeft;
137
    private Integer marginRight;
143
    private Integer marginRight;
138
    private Integer marginTop;
144
    private Integer marginTop;
139
    private Integer maxHeight;
145
    private Integer maxHeight;
140
    private Integer maxWidth;
146
    private Integer maxWidth;
141
    private Integer minInputSize;
147
    private Integer minInputSize;
142
    private Integer minHeight;
148
    private Integer minHeight;
143
    private Integer minWidth;
149
    private Integer minWidth;
144
    private Integer paddingBottom;
150
    private Integer paddingBottom;
145
    private Integer paddingLeft;
151
    private Integer paddingLeft;
146
    private Integer paddingRight;
152
    private Integer paddingRight;
147
    private Integer paddingTop;
153
    private Integer paddingTop;
148
    private Integer type;
154
    private Integer type;
149
    private Integer valueType;
155
    private Integer valueType;
150
    private Integer width;
156
    private Integer width;
151
 
157
 
152
    private boolean enabled = true;
158
    private boolean enabled = true;
153
    private boolean fillHeight = false;
159
    private boolean fillHeight = false;
154
    private boolean fillWidth = false;
160
    private boolean fillWidth = false;
155
    private boolean foldable = false;
161
    private boolean foldable = false;
156
    private boolean folded = false;
162
    private boolean folded = false;
157
    private boolean fontBold = false;
163
    private boolean fontBold = false;
158
    private boolean fontItalic = false;
164
    private boolean fontItalic = false;
159
    private boolean horizontallyResizable = false;
165
    private boolean horizontallyResizable = false;
160
    private boolean readOnly = false;
166
    private boolean readOnly = false;
161
    private boolean required = false;
167
    private boolean required = false;
162
    private boolean verticallyResizable = false;
168
    private boolean verticallyResizable = false;
163
    private boolean visible = true;
169
    private boolean visible = true;
164
    private boolean notSaved = false;
170
    private boolean notSaved = false;
165
    private boolean verticallyScrollable = false;
171
    private boolean verticallyScrollable = false;
166
    private boolean horizontallyScrollable = false;
172
    private boolean horizontallyScrollable = false;
167
 
173
 
168
    private String displayPrecision;// "(1,2)" means that 0.159 is shown as 0.16
174
    private String displayPrecision;// "(1,2)" means that 0.159 is shown as 0.16
169
    private String icon;
175
    private String icon;
170
    private String id;
176
    private String id;
171
    private String label;
177
    private String label;
172
    private String toolTip;
178
    private String toolTip;
173
    private String UUID;
179
    private String UUID;
174
    // Values
180
    // Values
175
    private String value;
181
    private String value;
176
    private String valuePrecision;// "(6,2)" 999999.99 is the max
182
    private String valuePrecision;// "(6,2)" 999999.99 is the max
177
    private String valueRange; // [-3.14,3.14]
183
    private String valueRange; // [-3.14,3.14]
178
 
184
 
179
    private Color backgroundColor;
185
    private Color backgroundColor;
180
    private Color borderColor;
186
    private Color borderColor;
181
    private Color cellBackgroundColor;
187
    private Color cellBackgroundColor;
182
    private Color foreColor;
188
    private Color foreColor;
183
 
189
 
184
    private LightUIElement parent;
190
    private LightUIElement parent;
-
 
191
    private boolean destroyed;
-
 
192
 
-
 
193
    public LightUIElement() {
-
 
194
        // Serialization
-
 
195
    }
185
 
196
 
186
    public LightUIElement(final String id) {
197
    public LightUIElement(final String id) {
187
        this.id = id;
198
        this.id = id;
188
        this.UUID = java.util.UUID.randomUUID().toString();
199
        this.UUID = getNextUUID();// java.util.UUID.randomUUID().toString();
-
 
200
    }
189
 
201
 
-
 
202
    private static long count = 0;
190
        JSONToLightUIConvertorManager.getInstance().put(this.getClassName(), this.getConvertor());
203
    private static Integer counterLock = new Integer(123456);
-
 
204
 
-
 
205
    private String getNextUUID() {
-
 
206
        String result;
-
 
207
        synchronized (counterLock) {
-
 
208
            count++;
-
 
209
            result = "UUID" + count;
-
 
210
        }
-
 
211
        return result;
191
    }
212
    }
192
 
213
 
193
    // Init from json constructor
214
    // Init from json constructor
194
    public LightUIElement(final JSONObject json) {
215
    public LightUIElement(final JSONObject json) {
195
        this.fromJSON(json);
216
        this.fromJSON(json);
196
    }
217
    }
197
 
218
 
198
    // Clone constructor
219
    // Clone constructor
199
    public LightUIElement(final LightUIElement element) {
220
    public LightUIElement(final LightUIElement element) {
200
        throw new IllegalAccessError("??");
221
        throw new IllegalAccessError("??");
201
        // this.id = element.id;
222
        // this.id = element.id;
202
        // this.parent = element.parent;
223
        // this.parent = element.parent;
203
        // this.UUID = element.UUID;
224
        // this.UUID = element.UUID;
204
        // this.type = element.type;
225
        // this.type = element.type;
205
        //
226
        //
206
        // this.copy(element);
227
        // this.copy(element);
207
    }
228
    }
208
 
229
 
209
    public int getFontSize() {
230
    public int getFontSize() {
210
        return this.fontSize;
231
        return this.fontSize;
211
    }
232
    }
212
 
233
 
213
    public void setFontSize(final int fontSize) {
234
    public void setFontSize(final int fontSize) {
214
        this.fontSize = fontSize;
235
        this.fontSize = fontSize;
215
    }
236
    }
216
 
237
 
217
    public int getGridWidth() {
238
    public int getGridWidth() {
218
        return this.gridWidth;
239
        return this.gridWidth;
219
    }
240
    }
220
 
241
 
221
    public void setGridWidth(int gridWidth) {
242
    public void setGridWidth(int gridWidth) {
222
        this.gridWidth = gridWidth;
243
        this.gridWidth = gridWidth;
223
    }
244
    }
224
 
245
 
225
    public Integer getHeight() {
246
    public Integer getHeight() {
226
        return this.height;
247
        return this.height;
227
    }
248
    }
228
 
249
 
229
    public void setHeight(Integer height) {
250
    public void setHeight(Integer height) {
230
        this.height = height;
251
        this.height = height;
231
    }
252
    }
232
 
253
 
233
    public final int getHorizontalAlignment() {
254
    public final int getHorizontalAlignment() {
234
        return this.horizontalAlignment;
255
        return this.horizontalAlignment;
235
    }
256
    }
236
 
257
 
237
    public final void setHorizontalAlignement(int horizontalAlignement) {
258
    public final void setHorizontalAlignement(int horizontalAlignement) {
238
        this.horizontalAlignment = horizontalAlignement;
259
        this.horizontalAlignment = horizontalAlignement;
239
    }
260
    }
240
 
261
 
241
    public int getValueType() {
262
    public int getValueType() {
242
        return this.valueType;
263
        return this.valueType;
243
    }
264
    }
244
 
265
 
245
    public void setValueType(int valueType) {
266
    public void setValueType(int valueType) {
246
        this.valueType = valueType;
267
        this.valueType = valueType;
247
    }
268
    }
248
 
269
 
249
    public final int getVerticalAlignment() {
270
    public final int getVerticalAlignment() {
250
        return this.verticalAlignment;
271
        return this.verticalAlignment;
251
    }
272
    }
252
 
273
 
253
    public void setVerticalAlignement(int verticalAlignement) {
274
    public void setVerticalAlignement(int verticalAlignement) {
254
        this.verticalAlignment = verticalAlignement;
275
        this.verticalAlignment = verticalAlignement;
255
    }
276
    }
256
 
277
 
257
    public int getWeightX() {
278
    public int getWeightX() {
258
        return this.weightX;
279
        return this.weightX;
259
    }
280
    }
260
 
281
 
261
    public void setWeightX(final int weightX) {
282
    public void setWeightX(final int weightX) {
262
        this.weightX = weightX;
283
        this.weightX = weightX;
263
    }
284
    }
264
 
285
 
265
    public int getWeightY() {
286
    public int getWeightY() {
266
        return this.weightY;
287
        return this.weightY;
267
    }
288
    }
268
 
289
 
269
    public void setWeightY(final int weightY) {
290
    public void setWeightY(final int weightY) {
270
        this.weightY = weightY;
291
        this.weightY = weightY;
271
    }
292
    }
272
 
293
 
273
    public Integer getCommitMode() {
294
    public Integer getCommitMode() {
274
        return this.commitMode;
295
        return this.commitMode;
275
    }
296
    }
276
 
297
 
277
    public void setCommitMode(int commitMode) {
298
    public void setCommitMode(int commitMode) {
278
        this.commitMode = commitMode;
299
        this.commitMode = commitMode;
279
    }
300
    }
280
 
301
 
281
    public Integer getMarginTop() {
302
    public Integer getMarginTop() {
282
        return this.marginTop;
303
        return this.marginTop;
283
    }
304
    }
284
 
305
 
285
    public void setMarginTop(Integer marginTop) {
306
    public void setMarginTop(Integer marginTop) {
286
        this.marginTop = marginTop;
307
        this.marginTop = marginTop;
287
    }
308
    }
288
 
309
 
289
    public Integer getMarginBottom() {
310
    public Integer getMarginBottom() {
290
        return this.marginBottom;
311
        return this.marginBottom;
291
    }
312
    }
292
 
313
 
293
    public void setMarginBottom(Integer marginBottom) {
314
    public void setMarginBottom(Integer marginBottom) {
294
        this.marginBottom = marginBottom;
315
        this.marginBottom = marginBottom;
295
    }
316
    }
296
 
317
 
297
    public Integer getMarginLeft() {
318
    public Integer getMarginLeft() {
298
        return this.marginLeft;
319
        return this.marginLeft;
299
    }
320
    }
300
 
321
 
301
    public void setMarginLeft(final Integer marginLeft) {
322
    public void setMarginLeft(final Integer marginLeft) {
302
        this.marginLeft = marginLeft;
323
        this.marginLeft = marginLeft;
303
    }
324
    }
304
 
325
 
305
    public Integer getMarginRight() {
326
    public Integer getMarginRight() {
306
        return this.marginRight;
327
        return this.marginRight;
307
    }
328
    }
308
 
329
 
309
    public void setMarginRight(final Integer marginRight) {
330
    public void setMarginRight(final Integer marginRight) {
310
        this.marginRight = marginRight;
331
        this.marginRight = marginRight;
311
    }
332
    }
312
 
333
 
313
    public Integer getMinInputSize() {
334
    public Integer getMinInputSize() {
314
        return this.minInputSize;
335
        return this.minInputSize;
315
    }
336
    }
316
 
337
 
317
    public Integer getMaxHeight() {
338
    public Integer getMaxHeight() {
318
        return this.maxHeight;
339
        return this.maxHeight;
319
    }
340
    }
320
 
341
 
321
    public void setMaxHeight(Integer maxHeight) {
342
    public void setMaxHeight(Integer maxHeight) {
322
        this.maxHeight = maxHeight;
343
        this.maxHeight = maxHeight;
323
    }
344
    }
324
 
345
 
325
    public Integer getMinHeight() {
346
    public Integer getMinHeight() {
326
        return this.minHeight;
347
        return this.minHeight;
327
    }
348
    }
328
 
349
 
329
    public void setMinHeight(Integer minHeight) {
350
    public void setMinHeight(Integer minHeight) {
330
        this.minHeight = minHeight;
351
        this.minHeight = minHeight;
331
    }
352
    }
332
 
353
 
333
    public Integer getMaxWidth() {
354
    public Integer getMaxWidth() {
334
        return this.maxWidth;
355
        return this.maxWidth;
335
    }
356
    }
336
 
357
 
337
    public void setMaxWidth(Integer maxWidth) {
358
    public void setMaxWidth(Integer maxWidth) {
338
        this.maxWidth = maxWidth;
359
        this.maxWidth = maxWidth;
339
    }
360
    }
340
 
361
 
341
    public Integer getMinWidth() {
362
    public Integer getMinWidth() {
342
        return this.minWidth;
363
        return this.minWidth;
343
    }
364
    }
344
 
365
 
345
    public void setMinWidth(Integer minWidth) {
366
    public void setMinWidth(Integer minWidth) {
346
        this.minWidth = minWidth;
367
        this.minWidth = minWidth;
347
    }
368
    }
348
 
369
 
349
    public void setMinInputSize(Integer minInputSize) {
370
    public void setMinInputSize(Integer minInputSize) {
350
        this.minInputSize = minInputSize;
371
        this.minInputSize = minInputSize;
351
    }
372
    }
352
 
373
 
353
    public Integer getPaddingTop() {
374
    public Integer getPaddingTop() {
354
        return this.paddingTop;
375
        return this.paddingTop;
355
    }
376
    }
356
 
377
 
357
    public void setPaddingTop(Integer paddingTop) {
378
    public void setPaddingTop(Integer paddingTop) {
358
        this.paddingTop = paddingTop;
379
        this.paddingTop = paddingTop;
359
    }
380
    }
360
 
381
 
361
    public Integer getPaddingBottom() {
382
    public Integer getPaddingBottom() {
362
        return this.paddingBottom;
383
        return this.paddingBottom;
363
    }
384
    }
364
 
385
 
365
    public void setPaddingBottom(Integer paddingBottom) {
386
    public void setPaddingBottom(Integer paddingBottom) {
366
        this.paddingBottom = paddingBottom;
387
        this.paddingBottom = paddingBottom;
367
    }
388
    }
368
 
389
 
369
    public Integer getPaddingLeft() {
390
    public Integer getPaddingLeft() {
370
        return this.paddingLeft;
391
        return this.paddingLeft;
371
    }
392
    }
372
 
393
 
373
    public void setPaddingLeft(Integer paddingLeft) {
394
    public void setPaddingLeft(Integer paddingLeft) {
374
        this.paddingLeft = paddingLeft;
395
        this.paddingLeft = paddingLeft;
375
    }
396
    }
376
 
397
 
377
    public Integer getPaddingRight() {
398
    public Integer getPaddingRight() {
378
        return this.paddingRight;
399
        return this.paddingRight;
379
    }
400
    }
380
 
401
 
381
    public void setPaddingRight(Integer paddingRight) {
402
    public void setPaddingRight(Integer paddingRight) {
382
        this.paddingRight = paddingRight;
403
        this.paddingRight = paddingRight;
383
    }
404
    }
384
 
405
 
385
    public Integer getType() {
406
    public Integer getType() {
386
        return this.type;
407
        return this.type;
387
    }
408
    }
388
 
409
 
389
    public void setType(int type) {
410
    public void setType(int type) {
390
        this.type = type;
411
        this.type = type;
391
    }
412
    }
392
 
413
 
393
    public Integer getWidth() {
414
    public Integer getWidth() {
394
        return this.width;
415
        return this.width;
395
    }
416
    }
396
 
417
 
397
    public void setWidth(Integer width) {
418
    public void setWidth(Integer width) {
398
        this.width = width;
419
        this.width = width;
399
    }
420
    }
400
 
421
 
401
    public boolean isEnabled() {
422
    public boolean isEnabled() {
402
        return this.enabled;
423
        return this.enabled;
403
    }
424
    }
404
 
425
 
405
    public void setEnabled(boolean enabled) {
426
    public void setEnabled(boolean enabled) {
406
        this.enabled = enabled;
427
        this.enabled = enabled;
407
    }
428
    }
408
 
429
 
409
    public boolean isFoldable() {
430
    public boolean isFoldable() {
410
        return this.foldable;
431
        return this.foldable;
411
    }
432
    }
412
 
433
 
413
    public void setFoldable(boolean foldable) {
434
    public void setFoldable(boolean foldable) {
414
        this.foldable = foldable;
435
        this.foldable = foldable;
415
    }
436
    }
416
 
437
 
417
    public boolean isFolded() {
438
    public boolean isFolded() {
418
        return this.folded;
439
        return this.folded;
419
    }
440
    }
420
 
441
 
421
    public void setFolded(boolean folded) {
442
    public void setFolded(boolean folded) {
422
        this.folded = folded;
443
        this.folded = folded;
423
    }
444
    }
424
 
445
 
425
    public boolean isFillHeight() {
446
    public boolean isFillHeight() {
426
        return this.fillHeight;
447
        return this.fillHeight;
427
    }
448
    }
428
 
449
 
429
    public void setFillHeight(boolean fillHeight) {
450
    public void setFillHeight(boolean fillHeight) {
430
        this.fillHeight = fillHeight;
451
        this.fillHeight = fillHeight;
431
    }
452
    }
432
 
453
 
433
    public boolean isFillWidth() {
454
    public boolean isFillWidth() {
434
        return this.fillWidth;
455
        return this.fillWidth;
435
    }
456
    }
436
 
457
 
437
    public void setFillWidth(boolean fillWidth) {
458
    public void setFillWidth(boolean fillWidth) {
438
        this.fillWidth = fillWidth;
459
        this.fillWidth = fillWidth;
439
    }
460
    }
440
 
461
 
441
    public boolean isReadOnly() {
462
    public boolean isReadOnly() {
442
        return this.readOnly;
463
        return this.readOnly;
443
    }
464
    }
444
 
465
 
445
    public void setReadOnly(boolean readOnly) {
466
    public void setReadOnly(boolean readOnly) {
446
        this.readOnly = readOnly;
467
        this.readOnly = readOnly;
447
    }
468
    }
448
 
469
 
449
    public boolean isNotSaved() {
470
    public boolean isNotSaved() {
450
        return this.notSaved;
471
        return this.notSaved;
451
    }
472
    }
452
 
473
 
453
    public void setNotSaved(boolean notSaved) {
474
    public void setNotSaved(boolean notSaved) {
454
        this.notSaved = notSaved;
475
        this.notSaved = notSaved;
455
    }
476
    }
456
 
477
 
457
    public Color getBackgroundColor() {
478
    public Color getBackgroundColor() {
458
        return this.backgroundColor;
479
        return this.backgroundColor;
459
    }
480
    }
460
 
481
 
461
    public void setBackgroundColor(Color backgroundColor) {
482
    public void setBackgroundColor(Color backgroundColor) {
462
        this.backgroundColor = backgroundColor;
483
        this.backgroundColor = backgroundColor;
463
    }
484
    }
464
 
485
 
465
    public Color getBorderColor() {
486
    public Color getBorderColor() {
466
        return this.borderColor;
487
        return this.borderColor;
467
    }
488
    }
468
 
489
 
469
    public void setBorderColor(Color borderColor) {
490
    public void setBorderColor(Color borderColor) {
470
        this.borderColor = borderColor;
491
        this.borderColor = borderColor;
471
    }
492
    }
472
 
493
 
473
    public Color getCellBackgroundColor() {
494
    public Color getCellBackgroundColor() {
474
        return this.cellBackgroundColor;
495
        return this.cellBackgroundColor;
475
    }
496
    }
476
 
497
 
477
    public void setCellBackgroundColor(Color cellBackgroundColor) {
498
    public void setCellBackgroundColor(Color cellBackgroundColor) {
478
        this.cellBackgroundColor = cellBackgroundColor;
499
        this.cellBackgroundColor = cellBackgroundColor;
479
    }
500
    }
480
 
501
 
481
    public Color getForeColor() {
502
    public Color getForeColor() {
482
        return this.foreColor;
503
        return this.foreColor;
483
    }
504
    }
484
 
505
 
485
    public void setForeColor(Color foreColor) {
506
    public void setForeColor(Color foreColor) {
486
        this.foreColor = foreColor;
507
        this.foreColor = foreColor;
487
    }
508
    }
488
 
509
 
489
    public boolean isFontItalic() {
510
    public boolean isFontItalic() {
490
        return this.fontItalic;
511
        return this.fontItalic;
491
    }
512
    }
492
 
513
 
493
    public void setFontBold(boolean fontBold) {
514
    public void setFontBold(boolean fontBold) {
494
        this.fontBold = fontBold;
515
        this.fontBold = fontBold;
495
    }
516
    }
496
 
517
 
497
    public boolean isFontBold() {
518
    public boolean isFontBold() {
498
        return this.fontBold;
519
        return this.fontBold;
499
    }
520
    }
500
 
521
 
501
    public void setFontItalic(boolean fontItalic) {
522
    public void setFontItalic(boolean fontItalic) {
502
        this.fontItalic = fontItalic;
523
        this.fontItalic = fontItalic;
503
    }
524
    }
504
 
525
 
505
    public String getIcon() {
526
    public String getIcon() {
506
        return this.icon;
527
        return this.icon;
507
    }
528
    }
508
 
529
 
509
    public void setIcon(String icon) {
530
    public void setIcon(String icon) {
510
        this.icon = icon;
531
        this.icon = icon;
511
    }
532
    }
512
 
533
 
513
    public String getId() {
534
    public String getId() {
514
        return this.id;
535
        return this.id;
515
    }
536
    }
516
 
537
 
517
    public void setId(final String id) {
538
    public void setId(final String id) {
518
        this.id = id;
539
        this.id = id;
519
    }
540
    }
520
 
541
 
521
    public String getUUID() {
542
    public String getUUID() {
522
        return this.UUID;
543
        return this.UUID;
523
    }
544
    }
524
 
545
 
525
    public void changeUUID() {
-
 
526
        this.UUID = java.util.UUID.randomUUID().toString();
-
 
527
    }
-
 
528
 
-
 
529
    public String getLabel() {
546
    public String getLabel() {
530
        return this.label;
547
        return this.label;
531
    }
548
    }
532
 
549
 
533
    public void setLabel(String label) {
550
    public void setLabel(String label) {
534
        this.label = label;
551
        this.label = label;
535
    }
552
    }
536
 
553
 
537
    public String getValue() {
554
    public String getValue() {
538
        return this.value;
555
        return this.value;
539
    }
556
    }
540
 
557
 
541
    public String getDisplayPrecision() {
558
    public String getDisplayPrecision() {
542
        return this.displayPrecision;
559
        return this.displayPrecision;
543
    }
560
    }
544
 
561
 
545
    public void setDisplayPrecision(String displayPrecision) {
562
    public void setDisplayPrecision(String displayPrecision) {
546
        this.displayPrecision = displayPrecision;
563
        this.displayPrecision = displayPrecision;
547
    }
564
    }
548
 
565
 
549
    public String getValuePrecision() {
566
    public String getValuePrecision() {
550
        return this.valuePrecision;
567
        return this.valuePrecision;
551
    }
568
    }
552
 
569
 
553
    public void setValuePrecision(String valuePrecision) {
570
    public void setValuePrecision(String valuePrecision) {
554
        this.valuePrecision = valuePrecision;
571
        this.valuePrecision = valuePrecision;
555
    }
572
    }
556
 
573
 
557
    public String getValueRange() {
574
    public String getValueRange() {
558
        return this.valueRange;
575
        return this.valueRange;
559
    }
576
    }
560
 
577
 
561
    public void setValueRange(String valueRange) {
578
    public void setValueRange(String valueRange) {
562
        this.valueRange = valueRange;
579
        this.valueRange = valueRange;
563
    }
580
    }
564
 
581
 
565
    public void setValue(String value) {
582
    public void setValue(String value) {
566
        this.value = value;
583
        this.value = value;
567
    }
584
    }
568
 
585
 
569
    public boolean isRequired() {
586
    public boolean isRequired() {
570
        return this.required;
587
        return this.required;
571
    }
588
    }
572
 
589
 
573
    public void setRequired(boolean required) {
590
    public void setRequired(boolean required) {
574
        this.required = required;
591
        this.required = required;
575
    }
592
    }
576
 
593
 
577
    public String getToolTip() {
594
    public String getToolTip() {
578
        return this.toolTip;
595
        return this.toolTip;
579
    }
596
    }
580
 
597
 
581
    public void setToolTip(String toolTip) {
598
    public void setToolTip(String toolTip) {
582
        this.toolTip = toolTip;
599
        this.toolTip = toolTip;
583
    }
600
    }
584
 
601
 
585
    public final boolean isVerticallyResizable() {
602
    public final boolean isVerticallyResizable() {
586
        return this.verticallyResizable;
603
        return this.verticallyResizable;
587
    }
604
    }
588
 
605
 
589
    public final void setVerticallyResizable(boolean verticallyResizable) {
606
    public final void setVerticallyResizable(boolean verticallyResizable) {
590
        this.verticallyResizable = verticallyResizable;
607
        this.verticallyResizable = verticallyResizable;
591
    }
608
    }
592
 
609
 
593
    public final boolean isHorizontallyResizable() {
610
    public final boolean isHorizontallyResizable() {
594
        return this.horizontallyResizable;
611
        return this.horizontallyResizable;
595
    }
612
    }
596
 
613
 
597
    public final void setHorizontallyResizable(boolean horizontallyResizable) {
614
    public final void setHorizontallyResizable(boolean horizontallyResizable) {
598
        this.horizontallyResizable = horizontallyResizable;
615
        this.horizontallyResizable = horizontallyResizable;
599
    }
616
    }
600
 
617
 
601
    public final boolean isHorizontallyScrollable() {
618
    public final boolean isHorizontallyScrollable() {
602
        return this.horizontallyScrollable;
619
        return this.horizontallyScrollable;
603
    }
620
    }
604
 
621
 
605
    public final void setHorizontallyScrollable(boolean horizontallyScrollable) {
622
    public final void setHorizontallyScrollable(boolean horizontallyScrollable) {
606
        this.horizontallyScrollable = horizontallyScrollable;
623
        this.horizontallyScrollable = horizontallyScrollable;
607
    }
624
    }
608
 
625
 
609
    public final boolean isVerticallyScrollable() {
626
    public final boolean isVerticallyScrollable() {
610
        return this.verticallyScrollable;
627
        return this.verticallyScrollable;
611
    }
628
    }
612
 
629
 
613
    public final void setVerticallyScrollable(boolean verticallyScrollable) {
630
    public final void setVerticallyScrollable(boolean verticallyScrollable) {
614
        this.verticallyScrollable = verticallyScrollable;
631
        this.verticallyScrollable = verticallyScrollable;
615
    }
632
    }
616
 
633
 
617
    public final LightUIElement getParent() {
634
    public final LightUIElement getParent() {
618
        return this.parent;
635
        return this.parent;
619
    }
636
    }
620
 
637
 
621
    public final <T extends LightUIElement> T getParent(final Class<T> expectedClass) {
638
    public final <T extends LightUIElement> T getParent(final Class<T> expectedClass) {
622
        LightUIElement parent = this.parent;
639
        LightUIElement parent = this.parent;
623
        while (parent != null && !expectedClass.isAssignableFrom(parent.getClass())) {
640
        while (parent != null && !expectedClass.isAssignableFrom(parent.getClass())) {
624
            parent = parent.getParent();
641
            parent = parent.getParent();
625
        }
642
        }
626
        return expectedClass.cast(parent);
643
        return expectedClass.cast(parent);
627
    }
644
    }
628
 
645
 
629
    public void setParent(LightUIElement parent) {
646
    public void setParent(LightUIElement parent) {
630
        this.parent = parent;
647
        this.parent = parent;
631
    }
648
    }
632
 
649
 
633
    public void dump(PrintStream out, final int depth) {
650
    public void dump(PrintStream out, final int depth) {
634
        final String typeAsString = this.getTypeAsString();
651
        final String typeAsString = this.getTypeAsString();
635
        String valueTypeAsString = "?";
652
        String valueTypeAsString = "?";
636
        if (this.valueType != null) {
653
        if (this.valueType != null) {
637
            if (this.valueType == VALUE_TYPE_STRING) {
654
            if (this.valueType == VALUE_TYPE_STRING) {
638
                valueTypeAsString = "string";
655
                valueTypeAsString = "string";
639
            } else if (this.valueType == VALUE_TYPE_INTEGER) {
656
            } else if (this.valueType == VALUE_TYPE_INTEGER) {
640
                valueTypeAsString = "int";
657
                valueTypeAsString = "int";
641
            } else if (this.valueType == VALUE_TYPE_REF) {
658
            } else if (this.valueType == VALUE_TYPE_REF) {
642
                valueTypeAsString = "ref";
659
                valueTypeAsString = "ref";
643
            } else if (this.valueType == VALUE_TYPE_LIST) {
660
            } else if (this.valueType == VALUE_TYPE_LIST) {
644
                valueTypeAsString = "list";
661
                valueTypeAsString = "list";
645
            } else if (this.valueType == VALUE_TYPE_DECIMAL) {
662
            } else if (this.valueType == VALUE_TYPE_DECIMAL) {
646
                valueTypeAsString = "decimal";
663
                valueTypeAsString = "decimal";
647
            }
664
            }
648
        }
665
        }
649
 
666
 
650
        String str = "LightUIElement" + "class:" + this.getClassName() + " type:" + typeAsString + " id:" + this.id + " uuid:" + this.UUID + " w:" + this.gridWidth + " fill:" + this.fillWidth;
667
        String str = "LightUIElement" + "class:" + this.getClassName() + " type:" + typeAsString + " id:" + this.id + " uuid:" + this.UUID + " w:" + this.gridWidth + " fill:" + this.fillWidth;
651
        str += " value:" + this.value + "(" + valueTypeAsString + ")";
668
        str += " value:" + this.value + "(" + valueTypeAsString + ")";
652
        if (this.valueRange != null) {
669
        if (this.valueRange != null) {
653
            str += "range: " + this.valueRange;
670
            str += "range: " + this.valueRange;
654
        }
671
        }
655
        if (this.valuePrecision != null) {
672
        if (this.valuePrecision != null) {
656
            str += "precision: " + this.valuePrecision;
673
            str += "precision: " + this.valuePrecision;
657
        }
674
        }
658
        if (this.displayPrecision != null) {
675
        if (this.displayPrecision != null) {
659
            str += "display prec.: " + this.displayPrecision;
676
            str += "display prec.: " + this.displayPrecision;
660
        }
677
        }
661
        if (this.label != null) {
678
        if (this.label != null) {
662
            str += " label:" + this.label;
679
            str += " label:" + this.label;
663
        }
680
        }
664
        if (this.horizontallyResizable) {
681
        if (this.horizontallyResizable) {
665
            str += "|- H ->";
682
            str += "|- H ->";
666
        }
683
        }
667
        if (this.verticallyResizable) {
684
        if (this.verticallyResizable) {
668
            str += "|- V ->";
685
            str += "|- V ->";
669
        }
686
        }
670
 
687
 
671
        switch (this.fontSize) {
688
        switch (this.fontSize) {
672
        case FONT_XXSMALL:
689
        case FONT_XXSMALL:
673
            str += " font: xx-small";
690
            str += " font: xx-small";
674
            break;
691
            break;
675
        case FONT_XSMALL:
692
        case FONT_XSMALL:
676
            str += " font: x-small";
693
            str += " font: x-small";
677
            break;
694
            break;
678
        case FONT_SMALL:
695
        case FONT_SMALL:
679
            str += " font: small";
696
            str += " font: small";
680
            break;
697
            break;
681
        case FONT_MEDIUM:
698
        case FONT_MEDIUM:
682
            str += " font: medium";
699
            str += " font: medium";
683
            break;
700
            break;
684
        case FONT_LARGE:
701
        case FONT_LARGE:
685
            str += " font: large";
702
            str += " font: large";
686
            break;
703
            break;
687
        case FONT_XLARGE:
704
        case FONT_XLARGE:
688
            str += " font: x-large";
705
            str += " font: x-large";
689
            break;
706
            break;
690
        case FONT_XXLARGE:
707
        case FONT_XXLARGE:
691
            str += " font: xx-large";
708
            str += " font: xx-large";
692
            break;
709
            break;
693
        }
710
        }
694
 
711
 
695
        switch (this.horizontalAlignment) {
712
        switch (this.horizontalAlignment) {
696
        case HALIGN_RIGHT:
713
        case HALIGN_RIGHT:
697
            str += " horiz-align: right";
714
            str += " horiz-align: right";
698
            break;
715
            break;
699
        case HALIGN_CENTER:
716
        case HALIGN_CENTER:
700
            str += " horiz-align: center";
717
            str += " horiz-align: center";
701
            break;
718
            break;
702
        case HALIGN_LEFT:
719
        case HALIGN_LEFT:
703
            str += " horiz-align: left";
720
            str += " horiz-align: left";
704
            break;
721
            break;
705
        }
722
        }
706
 
723
 
707
        switch (this.verticalAlignment) {
724
        switch (this.verticalAlignment) {
708
        case HALIGN_RIGHT:
725
        case HALIGN_RIGHT:
709
            str += " vert-align: top";
726
            str += " vert-align: top";
710
            break;
727
            break;
711
        case HALIGN_CENTER:
728
        case HALIGN_CENTER:
712
            str += " vert-align: center";
729
            str += " vert-align: center";
713
            break;
730
            break;
714
        case HALIGN_LEFT:
731
        case HALIGN_LEFT:
715
            str += " vert-align: bottom";
732
            str += " vert-align: bottom";
716
            break;
733
            break;
717
        }
734
        }
718
        addSpacer(out, depth);
735
        addSpacer(out, depth);
719
        out.println(str);
736
        out.println(str);
720
 
737
 
721
    }
738
    }
722
 
739
 
723
    protected final void addSpacer(PrintStream out, int depth) {
740
    protected final void addSpacer(PrintStream out, int depth) {
724
        for (int i = 0; i < depth; i++) {
741
        for (int i = 0; i < depth; i++) {
725
            out.print("  ");
742
            out.print("  ");
726
        }
743
        }
727
    }
744
    }
728
 
745
 
729
    public final String getTypeAsString() {
746
    public final String getTypeAsString() {
730
        String type = "?";
747
        String result = "?";
731
        if (this.type == TYPE_CHECKBOX) {
748
        if (this.type == TYPE_CHECKBOX) {
732
            type = "checkbox";
749
            result = "checkbox";
733
        } else if (this.type == TYPE_COMBOBOX) {
750
        } else if (this.type == TYPE_COMBOBOX) {
734
            type = "combobox";
751
            result = "combobox";
735
        } else if (this.type == TYPE_LABEL) {
752
        } else if (this.type == TYPE_LABEL) {
736
            type = "label";
753
            result = "label";
737
        } else if (this.type == TYPE_TEXT_AREA) {
754
        } else if (this.type == TYPE_TEXT_AREA) {
738
            type = "textarea";
755
            result = "textarea";
739
        } else if (this.type == TYPE_TEXT_FIELD) {
756
        } else if (this.type == TYPE_TEXT_FIELD) {
740
            type = "textfield";
757
            result = "textfield";
741
        } else if (this.type == TYPE_TABLE) {
758
        } else if (this.type == TYPE_TABLE) {
742
            type = "table";
759
            result = "table";
743
        } else if (this.type == TYPE_TABBED_UI) {
760
        } else if (this.type == TYPE_TABBED_UI) {
744
            type = "tabs";
761
            result = "tabs";
745
        } else if (this.type == TYPE_TREE) {
762
        } else if (this.type == TYPE_TREE) {
746
            type = "tree";
763
            result = "tree";
747
        } else if (this.type == TYPE_BUTTON) {
764
        } else if (this.type == TYPE_BUTTON) {
748
            type = "button";
765
            result = "button";
749
        } else if (this.type == TYPE_BUTTON_WITH_CONTEXT) {
766
        } else if (this.type == TYPE_BUTTON_WITH_CONTEXT) {
750
            type = "button with context";
767
            result = "button with context";
751
        } else if (this.type == TYPE_BUTTON_CANCEL) {
768
        } else if (this.type == TYPE_BUTTON_CANCEL) {
752
            type = "cancel button";
769
            result = "cancel button";
753
        } else if (this.type == TYPE_COMBOBOX_ELEMENT) {
770
        } else if (this.type == TYPE_COMBOBOX_ELEMENT) {
754
            type = "combo element";
771
            result = "combo element";
755
        } else if (this.type == TYPE_BUTTON_WITH_SELECTION_CONTEXT) {
772
        } else if (this.type == TYPE_BUTTON_WITH_SELECTION_CONTEXT) {
756
            type = "button with selection context";
773
            result = "button with selection context";
757
        } else if (this.type == TYPE_FILE_UPLOAD_WITH_SELECTION) {
774
        } else if (this.type == TYPE_FILE_UPLOAD_WITH_SELECTION) {
758
            type = "file upload with selection";
775
            result = "file upload with selection";
759
        } else if (this.type == TYPE_FRAME) {
776
        } else if (this.type == TYPE_FRAME) {
760
            type = "frame";
777
            result = "frame";
761
        } else if (this.type == TYPE_DROPDOWN_BUTTON) {
778
        } else if (this.type == TYPE_DROPDOWN_BUTTON) {
762
            type = "drop down button";
779
            result = "drop down button";
763
        } else if (this.type == TYPE_IMAGE) {
780
        } else if (this.type == TYPE_IMAGE) {
764
            type = "image";
781
            result = "image";
765
        } else if (this.type == TYPE_LIST) {
782
        } else if (this.type == TYPE_LIST) {
766
            type = "list";
783
            result = "list";
767
        } else if (this.type == TYPE_RAW_HTML) {
784
        } else if (this.type == TYPE_RAW_HTML) {
768
            type = "raw html";
785
            result = "raw html";
769
        } else if (this.type == TYPE_SLIDER) {
786
        } else if (this.type == TYPE_SLIDER) {
770
            type = "slider";
787
            result = "slider";
771
        } else if (this.type == TYPE_PICTURE_UPLOAD) {
788
        } else if (this.type == TYPE_PICTURE_UPLOAD) {
772
            type = "picture upload";
789
            result = "picture upload";
773
        } else if (this.type == TYPE_FILE_UPLOAD) {
790
        } else if (this.type == TYPE_FILE_UPLOAD) {
774
            type = "file upload";
791
            result = "file upload";
775
        }
792
        }
776
 
793
 
777
        return type;
794
        return result;
778
    }
795
    }
779
 
796
 
780
    public String getClassName() {
797
    public String getClassName() {
781
        return this.getClass().getName();
798
        return this.getClass().getName();
782
    }
799
    }
783
 
800
 
784
    public abstract JSONToLightUIConvertor getConvertor();
-
 
785
 
-
 
786
    /**
801
    /**
787
     * { return new JSONToLightUIConvertor() {
802
     * { return new JSONToLightUIConvertor() {
788
     * 
803
     * 
789
     * @Override public LightUIElement convert(final JSONObject json) { return new
804
     * @Override public LightUIElement convert(final JSONObject json) { return new
790
     *           LightUIElement(json); } }; }
805
     *           LightUIElement(json); } }; }
791
     */
806
     */
792
 
807
 
793
    protected void copy(final LightUIElement element) {
808
    protected void copy(final LightUIElement element) {
794
        if (element == null) {
809
        if (element == null) {
795
            throw new IllegalArgumentException("Try to copy attributes of null element in " + this.getId());
810
            throw new IllegalArgumentException("Try to copy attributes of null element in " + this.getId());
796
        }
811
        }
797
        this.fontSize = element.fontSize;
812
        this.fontSize = element.fontSize;
798
        this.gridHeight = element.gridHeight;
813
        this.gridHeight = element.gridHeight;
799
        this.gridWidth = element.gridWidth;
814
        this.gridWidth = element.gridWidth;
800
        this.horizontalAlignment = element.horizontalAlignment;
815
        this.horizontalAlignment = element.horizontalAlignment;
801
        this.verticalAlignment = element.verticalAlignment;
816
        this.verticalAlignment = element.verticalAlignment;
802
        this.weightX = element.weightX;
817
        this.weightX = element.weightX;
803
 
818
 
804
        this.commitMode = element.commitMode;
819
        this.commitMode = element.commitMode;
805
        this.height = element.height;
820
        this.height = element.height;
806
        this.marginBottom = element.marginBottom;
821
        this.marginBottom = element.marginBottom;
807
        this.marginLeft = element.marginLeft;
822
        this.marginLeft = element.marginLeft;
808
        this.marginRight = element.marginRight;
823
        this.marginRight = element.marginRight;
809
        this.marginTop = element.marginTop;
824
        this.marginTop = element.marginTop;
810
        this.maxHeight = element.maxHeight;
825
        this.maxHeight = element.maxHeight;
811
        this.maxWidth = element.maxWidth;
826
        this.maxWidth = element.maxWidth;
812
        this.minInputSize = element.minInputSize;
827
        this.minInputSize = element.minInputSize;
813
        this.minHeight = element.minHeight;
828
        this.minHeight = element.minHeight;
814
        this.minWidth = element.minWidth;
829
        this.minWidth = element.minWidth;
815
        this.paddingBottom = element.paddingBottom;
830
        this.paddingBottom = element.paddingBottom;
816
        this.paddingLeft = element.paddingLeft;
831
        this.paddingLeft = element.paddingLeft;
817
        this.paddingRight = element.paddingRight;
832
        this.paddingRight = element.paddingRight;
818
        this.paddingTop = element.paddingTop;
833
        this.paddingTop = element.paddingTop;
819
        this.valueType = element.valueType;
834
        this.valueType = element.valueType;
820
        this.width = element.width;
835
        this.width = element.width;
821
 
836
 
822
        this.enabled = element.enabled;
837
        this.enabled = element.enabled;
823
        this.fillWidth = element.fillWidth;
838
        this.fillWidth = element.fillWidth;
824
        this.fillHeight = element.fillHeight;
839
        this.fillHeight = element.fillHeight;
825
        this.foldable = element.foldable;
840
        this.foldable = element.foldable;
826
        this.folded = element.folded;
841
        this.folded = element.folded;
827
        this.fontBold = element.fontBold;
842
        this.fontBold = element.fontBold;
828
        this.fontItalic = element.fontItalic;
843
        this.fontItalic = element.fontItalic;
829
        this.horizontallyResizable = element.horizontallyResizable;
844
        this.horizontallyResizable = element.horizontallyResizable;
830
        this.horizontallyScrollable = element.horizontallyScrollable;
845
        this.horizontallyScrollable = element.horizontallyScrollable;
831
        this.required = element.required;
846
        this.required = element.required;
832
        this.readOnly = element.readOnly;
847
        this.readOnly = element.readOnly;
833
        this.verticallyResizable = element.verticallyResizable;
848
        this.verticallyResizable = element.verticallyResizable;
834
        this.verticallyScrollable = element.verticallyScrollable;
849
        this.verticallyScrollable = element.verticallyScrollable;
835
        this.visible = element.visible;
850
        this.visible = element.visible;
836
        this.notSaved = element.notSaved;
851
        this.notSaved = element.notSaved;
837
 
852
 
838
        this.displayPrecision = element.displayPrecision;
853
        this.displayPrecision = element.displayPrecision;
839
        this.icon = element.icon;
854
        this.icon = element.icon;
840
        this.label = element.label;
855
        this.label = element.label;
841
        this.toolTip = element.toolTip;
856
        this.toolTip = element.toolTip;
842
        this.value = element.value;
857
        this.value = element.value;
843
        this.valuePrecision = element.valuePrecision;
858
        this.valuePrecision = element.valuePrecision;
844
        this.valueRange = element.valueRange;
859
        this.valueRange = element.valueRange;
845
 
860
 
846
        this.backgroundColor = element.backgroundColor;
861
        this.backgroundColor = element.backgroundColor;
847
        this.borderColor = element.borderColor;
862
        this.borderColor = element.borderColor;
848
        this.cellBackgroundColor = element.cellBackgroundColor;
863
        this.cellBackgroundColor = element.cellBackgroundColor;
849
        this.foreColor = element.foreColor;
864
        this.foreColor = element.foreColor;
850
    }
865
    }
851
 
866
 
852
    @Override
867
    @Override
853
    public String toString() {
868
    public String toString() {
-
 
869
        if (!destroyed) {
854
        return super.toString() + " " + this.id;
870
            return super.toString() + " " + this.id;
-
 
871
        } else {
-
 
872
            return super.toString() + " " + this.id + " DESTROYED";
-
 
873
        }
855
    }
874
    }
856
 
875
 
857
    @Override
876
    @Override
858
    public JSONObject toJSON() {
877
    public JSONObject toJSON() {
859
        final JSONObject result = new JSONObject();
878
        final JSONObject result = new JSONObject();
860
 
879
 
861
        result.put("class-name", this.getClassName());
880
        result.put("class-name", this.getClassName());
862
 
881
 
863
        if (this.fontSize != FONT_SMALL) {
882
        if (this.fontSize != FONT_SMALL) {
864
            result.put("font-size", this.fontSize);
883
            result.put("font-size", this.fontSize);
865
        }
884
        }
866
        if (this.gridWidth != DEFAULT_GRID_WIDTH) {
885
        if (this.gridWidth != DEFAULT_GRID_WIDTH) {
867
            result.put("grid-width", this.gridWidth);
886
            result.put("grid-width", this.gridWidth);
868
        }
887
        }
869
        if (this.gridHeight != DEFAULT_GRID_HEIGHT) {
888
        if (this.gridHeight != DEFAULT_GRID_HEIGHT) {
870
            result.put("grid-height", this.gridHeight);
889
            result.put("grid-height", this.gridHeight);
871
        }
890
        }
872
        if (this.horizontalAlignment != HALIGN_LEFT) {
891
        if (this.horizontalAlignment != HALIGN_LEFT) {
873
            result.put("horizontal-alignment", this.horizontalAlignment);
892
            result.put("horizontal-alignment", this.horizontalAlignment);
874
        }
893
        }
875
        if (this.verticalAlignment != VALIGN_TOP) {
894
        if (this.verticalAlignment != VALIGN_TOP) {
876
            result.put("vertical-alignment", this.verticalAlignment);
895
            result.put("vertical-alignment", this.verticalAlignment);
877
        }
896
        }
878
        if (this.weightX != DEFAULT_WEIGHT_X) {
897
        if (this.weightX != DEFAULT_WEIGHT_X) {
879
            result.put("weight-x", this.weightX);
898
            result.put("weight-x", this.weightX);
880
        }
899
        }
-
 
900
        if (this.weightY != DEFAULT_WEIGHT_Y) {
-
 
901
            result.put("weight-y", this.weightY);
881
 
902
        }
882
        if (this.commitMode != null) {
903
        if (this.commitMode != null) {
883
            result.put("commit-mode", this.commitMode);
904
            result.put("commit-mode", this.commitMode);
884
        }
905
        }
-
 
906
        if (this.width != null) {
-
 
907
            result.put("width", this.width);
-
 
908
        }
885
        if (this.height != null) {
909
        if (this.height != null) {
886
            result.put("height", this.height);
910
            result.put("height", this.height);
887
        }
911
        }
888
        if (this.marginBottom != null) {
912
        if (this.marginBottom != null) {
889
            result.put("m-bottom", this.marginBottom);
913
            result.put("m-bottom", this.marginBottom);
890
        }
914
        }
891
        if (this.marginLeft != null) {
915
        if (this.marginLeft != null) {
892
            result.put("m-left", this.marginLeft);
916
            result.put("m-left", this.marginLeft);
893
        }
917
        }
894
        if (this.marginRight != null) {
918
        if (this.marginRight != null) {
895
            result.put("m-right", this.marginRight);
919
            result.put("m-right", this.marginRight);
896
        }
920
        }
897
        if (this.marginTop != null) {
921
        if (this.marginTop != null) {
898
            result.put("m-top", this.marginTop);
922
            result.put("m-top", this.marginTop);
899
        }
923
        }
900
        if (this.maxHeight != null) {
924
        if (this.maxHeight != null) {
901
            result.put("max-height", this.maxHeight);
925
            result.put("max-height", this.maxHeight);
902
        }
926
        }
903
        if (this.maxWidth != null) {
927
        if (this.maxWidth != null) {
904
            result.put("max-width", this.maxWidth);
928
            result.put("max-width", this.maxWidth);
905
        }
929
        }
906
        if (this.minInputSize != null) {
930
        if (this.minInputSize != null) {
907
            result.put("min-input-size", this.minInputSize);
931
            result.put("min-input-size", this.minInputSize);
908
        }
932
        }
909
        if (this.minHeight != null) {
933
        if (this.minHeight != null) {
910
            result.put("min-height", this.minHeight);
934
            result.put("min-height", this.minHeight);
911
        }
935
        }
912
        if (this.minWidth != null) {
936
        if (this.minWidth != null) {
913
            result.put("min-width", this.minWidth);
937
            result.put("min-width", this.minWidth);
914
        }
938
        }
915
        if (this.paddingBottom != null) {
939
        if (this.paddingBottom != null) {
916
            result.put("p-bottom", this.paddingBottom);
940
            result.put("p-bottom", this.paddingBottom);
917
        }
941
        }
918
        if (this.paddingLeft != null) {
942
        if (this.paddingLeft != null) {
919
            result.put("p-left", this.paddingLeft);
943
            result.put("p-left", this.paddingLeft);
920
        }
944
        }
921
        if (this.paddingRight != null) {
945
        if (this.paddingRight != null) {
922
            result.put("p-right", this.paddingRight);
946
            result.put("p-right", this.paddingRight);
923
        }
947
        }
924
        if (this.paddingTop != null) {
948
        if (this.paddingTop != null) {
925
            result.put("p-top", this.paddingTop);
949
            result.put("p-top", this.paddingTop);
926
        }
950
        }
927
        result.put("type", this.type);
951
        result.put("type", this.type);
928
        if (this.valueType != null) {
952
        if (this.valueType != null) {
929
            result.put("value-type", this.valueType);
953
            result.put("value-type", this.valueType);
930
        }
954
        }
931
        if (this.width != null) {
-
 
932
            result.put("width", this.width);
-
 
933
        }
-
 
934
 
955
 
935
        if (!this.enabled) {
956
        if (!this.enabled) {
936
            result.put("enabled", false);
957
            result.put("enabled", false);
937
        }
958
        }
938
        if (this.fillWidth) {
959
        if (this.fillWidth) {
939
            result.put("fill-width", true);
960
            result.put("fill-width", true);
940
        }
961
        }
941
        if (this.fillHeight) {
962
        if (this.fillHeight) {
942
            result.put("fill-height", true);
963
            result.put("fill-height", true);
943
        }
964
        }
944
        if (this.foldable) {
965
        if (this.foldable) {
945
            result.put("foldable", true);
966
            result.put("foldable", true);
946
        }
967
        }
947
        if (this.folded) {
968
        if (this.folded) {
948
            result.put("folded", true);
969
            result.put("folded", true);
949
        }
970
        }
950
        if (this.fontBold) {
971
        if (this.fontBold) {
951
            result.put("bold", true);
972
            result.put("bold", true);
952
        }
973
        }
953
        if (this.fontItalic) {
974
        if (this.fontItalic) {
954
            result.put("italic", true);
975
            result.put("italic", true);
955
        }
976
        }
956
        if (this.horizontallyResizable) {
977
        if (this.horizontallyResizable) {
957
            result.put(HORIZONTALLY_RESIZABLE, true);
978
            result.put(HORIZONTALLY_RESIZABLE, true);
958
        }
979
        }
959
        if (this.horizontallyScrollable) {
980
        if (this.horizontallyScrollable) {
960
            result.put(HORIZONTALLY_SCROLLABLE, true);
981
            result.put(HORIZONTALLY_SCROLLABLE, true);
961
        }
982
        }
962
        if (this.required) {
983
        if (this.required) {
963
            result.put("required", true);
984
            result.put("required", true);
964
        }
985
        }
965
        if (this.readOnly) {
986
        if (this.readOnly) {
966
            result.put("read-only", true);
987
            result.put("read-only", true);
967
        }
988
        }
968
        if (this.verticallyResizable) {
989
        if (this.verticallyResizable) {
969
            result.put(VERTICALLY_RESIZABLE, true);
990
            result.put(VERTICALLY_RESIZABLE, true);
970
        }
991
        }
971
        if (this.verticallyScrollable) {
992
        if (this.verticallyScrollable) {
972
            result.put(VERTICALLY_SCROLLABLE, true);
993
            result.put(VERTICALLY_SCROLLABLE, true);
973
        }
994
        }
974
        if (!this.visible) {
995
        if (!this.visible) {
975
            result.put("visible", false);
996
            result.put("visible", false);
976
        }
997
        }
977
        if (this.notSaved) {
998
        if (this.notSaved) {
978
            result.put("not-saved", true);
999
            result.put("not-saved", true);
979
        }
1000
        }
980
 
1001
 
981
        if (this.displayPrecision != null) {
1002
        if (this.displayPrecision != null) {
982
            result.put("display-precision", this.displayPrecision);
1003
            result.put("display-precision", this.displayPrecision);
983
        }
1004
        }
984
        if (this.icon != null) {
1005
        if (this.icon != null) {
985
            result.put("icon", this.icon);
1006
            result.put("icon", this.icon);
986
        }
1007
        }
987
        result.put("id", this.id);
1008
        result.put("id", this.id);
988
        if (this.label != null) {
1009
        if (this.label != null) {
989
            result.put("label", this.label);
1010
            result.put("label", this.label);
990
        }
1011
        }
991
        if (this.toolTip != null) {
1012
        if (this.toolTip != null) {
992
            result.put("tool-tip", this.toolTip);
1013
            result.put("tool-tip", this.toolTip);
993
        }
1014
        }
994
        result.put("uuid", this.UUID);
1015
        result.put("uuid", this.UUID);
995
        if (this.value != null) {
1016
        if (this.value != null) {
996
            result.put("value", this.value);
1017
            result.put("value", this.value);
997
        }
1018
        }
998
        if (this.valuePrecision != null) {
1019
        if (this.valuePrecision != null) {
999
            result.put("value-precision", this.valuePrecision);
1020
            result.put("value-precision", this.valuePrecision);
1000
        }
1021
        }
1001
        if (this.valueRange != null) {
1022
        if (this.valueRange != null) {
1002
            result.put("value-range", this.valueRange);
1023
            result.put("value-range", this.valueRange);
1003
        }
1024
        }
1004
 
1025
 
1005
        if (this.backgroundColor != null) {
1026
        if (this.backgroundColor != null) {
1006
            result.put("background-color", JSONConverter.getJSON(this.backgroundColor));
1027
            result.put("background-color", JSONConverter.getJSON(this.backgroundColor));
1007
        }
1028
        }
1008
        if (this.borderColor != null) {
1029
        if (this.borderColor != null) {
1009
            result.put("border-color", JSONConverter.getJSON(this.borderColor));
1030
            result.put("border-color", JSONConverter.getJSON(this.borderColor));
1010
        }
1031
        }
1011
        if (this.cellBackgroundColor != null) {
1032
        if (this.cellBackgroundColor != null) {
1012
            result.put("cell-background-color", JSONConverter.getJSON(this.cellBackgroundColor));
1033
            result.put("cell-background-color", JSONConverter.getJSON(this.cellBackgroundColor));
1013
        }
1034
        }
1014
        if (this.foreColor != null) {
1035
        if (this.foreColor != null) {
1015
            result.put("fore-color", JSONConverter.getJSON(this.foreColor));
1036
            result.put("fore-color", JSONConverter.getJSON(this.foreColor));
1016
        }
1037
        }
1017
        if (this instanceof HTMLable) {
1038
        if (this instanceof HTMLable) {
1018
            result.put("html", ((HTMLable) this).getHTML());
1039
            result.put("html", ((HTMLable) this).getHTML());
1019
        }
1040
        }
1020
        return result;
1041
        return result;
1021
    }
1042
    }
1022
 
1043
 
1023
    @Override
1044
    @Override
1024
    public void fromJSON(final JSONObject json) {
1045
    public void fromJSON(final JSONObject json) {
1025
        this.id = JSONConverter.getParameterFromJSON(json, "id", String.class);
1046
        this.id = JSONConverter.getParameterFromJSON(json, "id", String.class);
1026
        this.UUID = JSONConverter.getParameterFromJSON(json, "uuid", String.class);
1047
        this.UUID = JSONConverter.getParameterFromJSON(json, "uuid", String.class);
1027
        this.displayPrecision = JSONConverter.getParameterFromJSON(json, "display-precision", String.class);
1048
        this.displayPrecision = JSONConverter.getParameterFromJSON(json, "display-precision", String.class);
1028
        this.icon = JSONConverter.getParameterFromJSON(json, "icon", String.class);
1049
        this.icon = JSONConverter.getParameterFromJSON(json, "icon", String.class);
1029
        this.label = JSONConverter.getParameterFromJSON(json, "label", String.class);
1050
        this.label = JSONConverter.getParameterFromJSON(json, "label", String.class);
1030
 
1051
 
1031
        this.toolTip = JSONConverter.getParameterFromJSON(json, "tool-tip", String.class);
1052
        this.toolTip = JSONConverter.getParameterFromJSON(json, "tool-tip", String.class);
1032
        this.value = JSONConverter.getParameterFromJSON(json, "value", String.class);
1053
        this.value = JSONConverter.getParameterFromJSON(json, "value", String.class);
1033
        this.valuePrecision = JSONConverter.getParameterFromJSON(json, "value-precision", String.class);
1054
        this.valuePrecision = JSONConverter.getParameterFromJSON(json, "value-precision", String.class);
1034
        this.valueRange = JSONConverter.getParameterFromJSON(json, "value-range", String.class);
1055
        this.valueRange = JSONConverter.getParameterFromJSON(json, "value-range", String.class);
1035
 
1056
 
1036
        this.commitMode = JSONConverter.getParameterFromJSON(json, "commit-mode", Integer.class);
1057
        this.commitMode = JSONConverter.getParameterFromJSON(json, "commit-mode", Integer.class);
1037
        this.fontSize = JSONConverter.getParameterFromJSON(json, "font-size", Integer.class, FONT_SMALL);
1058
        this.fontSize = JSONConverter.getParameterFromJSON(json, "font-size", Integer.class, FONT_SMALL);
1038
        this.gridWidth = JSONConverter.getParameterFromJSON(json, "grid-width", Integer.class, DEFAULT_GRID_WIDTH);
1059
        this.gridWidth = JSONConverter.getParameterFromJSON(json, "grid-width", Integer.class, DEFAULT_GRID_WIDTH);
1039
        this.gridHeight = JSONConverter.getParameterFromJSON(json, "grid-height", Integer.class, DEFAULT_GRID_HEIGHT);
1060
        this.gridHeight = JSONConverter.getParameterFromJSON(json, "grid-height", Integer.class, DEFAULT_GRID_HEIGHT);
1040
        this.horizontalAlignment = JSONConverter.getParameterFromJSON(json, "horizontal-alignment", Integer.class, HALIGN_LEFT);
1061
        this.horizontalAlignment = JSONConverter.getParameterFromJSON(json, "horizontal-alignment", Integer.class, HALIGN_LEFT);
1041
        this.verticalAlignment = JSONConverter.getParameterFromJSON(json, "vertical-alignment", Integer.class, VALIGN_TOP);
1062
        this.verticalAlignment = JSONConverter.getParameterFromJSON(json, "vertical-alignment", Integer.class, VALIGN_TOP);
1042
        this.weightX = JSONConverter.getParameterFromJSON(json, "weight-x", Integer.class, DEFAULT_WEIGHT_X);
1063
        this.weightX = JSONConverter.getParameterFromJSON(json, "weight-x", Integer.class, DEFAULT_WEIGHT_X);
-
 
1064
        this.weightY = JSONConverter.getParameterFromJSON(json, "weight-y", Integer.class, DEFAULT_WEIGHT_Y);
1043
        this.minInputSize = JSONConverter.getParameterFromJSON(json, "min-input-size", Integer.class);
1065
        this.minInputSize = JSONConverter.getParameterFromJSON(json, "min-input-size", Integer.class);
1044
        this.type = JSONConverter.getParameterFromJSON(json, "type", Integer.class);
1066
        this.type = JSONConverter.getParameterFromJSON(json, "type", Integer.class);
1045
        this.valueType = JSONConverter.getParameterFromJSON(json, "value-type", Integer.class);
1067
        this.valueType = JSONConverter.getParameterFromJSON(json, "value-type", Integer.class);
1046
        this.width = JSONConverter.getParameterFromJSON(json, "width", Integer.class);
1068
        this.width = JSONConverter.getParameterFromJSON(json, "width", Integer.class);
-
 
1069
        this.height = JSONConverter.getParameterFromJSON(json, "height", Integer.class);
1047
        this.marginTop = JSONConverter.getParameterFromJSON(json, "m-top", Integer.class);
1070
        this.marginTop = JSONConverter.getParameterFromJSON(json, "m-top", Integer.class);
1048
        this.marginBottom = JSONConverter.getParameterFromJSON(json, "m-bottom", Integer.class);
1071
        this.marginBottom = JSONConverter.getParameterFromJSON(json, "m-bottom", Integer.class);
1049
        this.marginLeft = JSONConverter.getParameterFromJSON(json, "m-left", Integer.class);
1072
        this.marginLeft = JSONConverter.getParameterFromJSON(json, "m-left", Integer.class);
1050
        this.marginRight = JSONConverter.getParameterFromJSON(json, "m-right", Integer.class);
1073
        this.marginRight = JSONConverter.getParameterFromJSON(json, "m-right", Integer.class);
1051
        this.maxWidth = JSONConverter.getParameterFromJSON(json, "max-width", Integer.class);
1074
        this.maxWidth = JSONConverter.getParameterFromJSON(json, "max-width", Integer.class);
1052
        this.minWidth = JSONConverter.getParameterFromJSON(json, "min-width", Integer.class);
1075
        this.minWidth = JSONConverter.getParameterFromJSON(json, "min-width", Integer.class);
1053
        this.height = JSONConverter.getParameterFromJSON(json, "height", Integer.class);
-
 
-
 
1076
 
1054
        this.maxHeight = JSONConverter.getParameterFromJSON(json, "max-height", Integer.class);
1077
        this.maxHeight = JSONConverter.getParameterFromJSON(json, "max-height", Integer.class);
1055
        this.minHeight = JSONConverter.getParameterFromJSON(json, "min-height", Integer.class);
1078
        this.minHeight = JSONConverter.getParameterFromJSON(json, "min-height", Integer.class);
1056
        this.paddingTop = JSONConverter.getParameterFromJSON(json, "p-top", Integer.class);
1079
        this.paddingTop = JSONConverter.getParameterFromJSON(json, "p-top", Integer.class);
1057
        this.paddingBottom = JSONConverter.getParameterFromJSON(json, "p-bottom", Integer.class);
1080
        this.paddingBottom = JSONConverter.getParameterFromJSON(json, "p-bottom", Integer.class);
1058
        this.paddingLeft = JSONConverter.getParameterFromJSON(json, "p-left", Integer.class);
1081
        this.paddingLeft = JSONConverter.getParameterFromJSON(json, "p-left", Integer.class);
1059
        this.paddingRight = JSONConverter.getParameterFromJSON(json, "p-right", Integer.class);
1082
        this.paddingRight = JSONConverter.getParameterFromJSON(json, "p-right", Integer.class);
1060
 
1083
 
1061
        this.enabled = JSONConverter.getParameterFromJSON(json, "enabled", Boolean.class, true);
1084
        this.enabled = JSONConverter.getParameterFromJSON(json, "enabled", Boolean.class, true);
1062
        this.foldable = JSONConverter.getParameterFromJSON(json, "foldable", Boolean.class, false);
1085
        this.foldable = JSONConverter.getParameterFromJSON(json, "foldable", Boolean.class, false);
1063
        this.folded = JSONConverter.getParameterFromJSON(json, "folded", Boolean.class, false);
1086
        this.folded = JSONConverter.getParameterFromJSON(json, "folded", Boolean.class, false);
1064
        this.fillWidth = JSONConverter.getParameterFromJSON(json, "fill-width", Boolean.class, false);
1087
        this.fillWidth = JSONConverter.getParameterFromJSON(json, "fill-width", Boolean.class, false);
1065
        this.fontBold = JSONConverter.getParameterFromJSON(json, "bold", Boolean.class, false);
1088
        this.fontBold = JSONConverter.getParameterFromJSON(json, "bold", Boolean.class, false);
1066
        this.fontItalic = JSONConverter.getParameterFromJSON(json, "italic", Boolean.class, false);
1089
        this.fontItalic = JSONConverter.getParameterFromJSON(json, "italic", Boolean.class, false);
1067
        this.horizontallyResizable = JSONConverter.getParameterFromJSON(json, HORIZONTALLY_RESIZABLE, Boolean.class, false);
1090
        this.horizontallyResizable = JSONConverter.getParameterFromJSON(json, HORIZONTALLY_RESIZABLE, Boolean.class, false);
1068
        this.horizontallyScrollable = JSONConverter.getParameterFromJSON(json, HORIZONTALLY_SCROLLABLE, Boolean.class, false);
1091
        this.horizontallyScrollable = JSONConverter.getParameterFromJSON(json, HORIZONTALLY_SCROLLABLE, Boolean.class, false);
1069
        this.verticallyResizable = JSONConverter.getParameterFromJSON(json, VERTICALLY_RESIZABLE, Boolean.class, false);
1092
        this.verticallyResizable = JSONConverter.getParameterFromJSON(json, VERTICALLY_RESIZABLE, Boolean.class, false);
1070
        this.verticallyScrollable = JSONConverter.getParameterFromJSON(json, VERTICALLY_SCROLLABLE, Boolean.class, false);
1093
        this.verticallyScrollable = JSONConverter.getParameterFromJSON(json, VERTICALLY_SCROLLABLE, Boolean.class, false);
1071
        this.required = JSONConverter.getParameterFromJSON(json, "required", Boolean.class, false);
1094
        this.required = JSONConverter.getParameterFromJSON(json, "required", Boolean.class, false);
1072
        this.readOnly = JSONConverter.getParameterFromJSON(json, "read-only", Boolean.class, false);
1095
        this.readOnly = JSONConverter.getParameterFromJSON(json, "read-only", Boolean.class, false);
1073
        this.visible = JSONConverter.getParameterFromJSON(json, "visible", Boolean.class, true);
1096
        this.visible = JSONConverter.getParameterFromJSON(json, "visible", Boolean.class, true);
1074
        this.notSaved = JSONConverter.getParameterFromJSON(json, "not-saved", Boolean.class, false);
1097
        this.notSaved = JSONConverter.getParameterFromJSON(json, "not-saved", Boolean.class, false);
1075
 
1098
 
1076
        this.backgroundColor = JSONConverter.getParameterFromJSON(json, "background-color", Color.class);
1099
        this.backgroundColor = JSONConverter.getParameterFromJSON(json, "background-color", Color.class);
1077
        this.borderColor = JSONConverter.getParameterFromJSON(json, "border-color", Color.class);
1100
        this.borderColor = JSONConverter.getParameterFromJSON(json, "border-color", Color.class);
1078
        this.cellBackgroundColor = JSONConverter.getParameterFromJSON(json, "cell-background-color", Color.class);
1101
        this.cellBackgroundColor = JSONConverter.getParameterFromJSON(json, "cell-background-color", Color.class);
1079
        this.foreColor = JSONConverter.getParameterFromJSON(json, "fore-color", Color.class);
1102
        this.foreColor = JSONConverter.getParameterFromJSON(json, "fore-color", Color.class);
1080
    }
1103
    }
1081
 
1104
 
1082
    public void destroy() {
1105
    public void destroy() {
1083
        this.setValue(null);
1106
        this.setValue(null);
-
 
1107
        this.parent = null;
-
 
1108
        this.destroyed = true;
-
 
1109
    }
-
 
1110
 
-
 
1111
    public boolean isDestroyed() {
-
 
1112
        return destroyed;
-
 
1113
    }
-
 
1114
 
-
 
1115
    @Override
-
 
1116
    public void writeExternal(ObjectOutput out) throws IOException {
-
 
1117
        out.writeInt(this.type);
-
 
1118
        if (this.id == null) {
-
 
1119
            throw new IllegalStateException("null id");
-
 
1120
        }
-
 
1121
        out.writeUTF(this.id);
-
 
1122
        if (this.UUID == null) {
-
 
1123
            throw new IllegalStateException("UUID");
-
 
1124
        }
-
 
1125
        out.writeUTF(this.UUID);
-
 
1126
 
-
 
1127
        writeIfNotNull(out, this.label);
-
 
1128
        writeIfNotNull(out, this.value);
-
 
1129
 
-
 
1130
        out.writeInt(this.fontSize);
-
 
1131
        out.writeInt(this.gridWidth);
-
 
1132
        out.writeInt(this.gridHeight);
-
 
1133
 
-
 
1134
        out.writeByte(this.horizontalAlignment);
-
 
1135
        out.writeByte(this.verticalAlignment);
-
 
1136
        out.writeByte(this.weightX);
-
 
1137
        out.writeByte(this.weightY);
-
 
1138
 
-
 
1139
        writeIfNotNull(out, this.commitMode);
-
 
1140
        writeIfNotNull(out, this.width);
-
 
1141
        writeIfNotNull(out, this.height);
-
 
1142
 
-
 
1143
        // Margins
-
 
1144
        writeIfNotNull(out, this.marginBottom);
-
 
1145
        writeIfNotNull(out, this.marginLeft);
-
 
1146
        writeIfNotNull(out, this.marginRight);
-
 
1147
        writeIfNotNull(out, this.marginTop);
-
 
1148
        //
-
 
1149
        writeIfNotNull(out, this.maxHeight);
-
 
1150
        writeIfNotNull(out, this.maxWidth);
-
 
1151
 
-
 
1152
        writeIfNotNull(out, this.minInputSize);
-
 
1153
        writeIfNotNull(out, this.minHeight);
-
 
1154
        writeIfNotNull(out, this.minWidth);
-
 
1155
 
-
 
1156
        // Paddings
-
 
1157
        writeIfNotNull(out, this.paddingBottom);
-
 
1158
        writeIfNotNull(out, this.paddingLeft);
-
 
1159
        writeIfNotNull(out, this.paddingRight);
-
 
1160
        writeIfNotNull(out, this.paddingTop);
-
 
1161
 
-
 
1162
        writeIfNotNull(out, this.valueType);
-
 
1163
 
-
 
1164
        out.writeBoolean(this.enabled);
-
 
1165
        out.writeBoolean(this.fillWidth);
-
 
1166
        out.writeBoolean(this.fillHeight);
-
 
1167
        out.writeBoolean(this.foldable);
-
 
1168
        out.writeBoolean(this.folded);
-
 
1169
        out.writeBoolean(this.fontBold);
-
 
1170
        out.writeBoolean(this.fontItalic);
-
 
1171
        out.writeBoolean(this.horizontallyResizable);
-
 
1172
        out.writeBoolean(this.horizontallyScrollable);
-
 
1173
        out.writeBoolean(this.required);
-
 
1174
        out.writeBoolean(this.readOnly);
-
 
1175
        out.writeBoolean(this.verticallyResizable);
-
 
1176
        out.writeBoolean(this.verticallyScrollable);
-
 
1177
 
-
 
1178
        out.writeBoolean(this.visible);
-
 
1179
        out.writeBoolean(this.notSaved);
-
 
1180
 
-
 
1181
        writeIfNotNull(out, this.displayPrecision);
-
 
1182
        writeIfNotNull(out, this.icon);
-
 
1183
        writeIfNotNull(out, this.toolTip);
-
 
1184
        writeIfNotNull(out, this.valuePrecision);
-
 
1185
        writeIfNotNull(out, this.valueRange);
-
 
1186
 
-
 
1187
        // Colors
-
 
1188
        writeIfNotNull(out, this.backgroundColor);
-
 
1189
        writeIfNotNull(out, this.borderColor);
-
 
1190
        writeIfNotNull(out, this.cellBackgroundColor);
-
 
1191
        writeIfNotNull(out, this.foreColor);
-
 
1192
    }
-
 
1193
 
-
 
1194
    void writeIfNotNull(ObjectOutput out, String s) throws IOException {
-
 
1195
        if (s != null) {
-
 
1196
            out.writeBoolean(true);
-
 
1197
            out.writeUTF(s);
-
 
1198
        } else {
-
 
1199
            out.writeBoolean(false);
-
 
1200
        }
-
 
1201
    }
-
 
1202
 
-
 
1203
    void writeIfNotNull(ObjectOutput out, Integer s) throws IOException {
-
 
1204
        if (s != null) {
-
 
1205
            out.writeBoolean(true);
-
 
1206
            out.writeInt(s);
-
 
1207
        } else {
-
 
1208
            out.writeBoolean(false);
-
 
1209
        }
-
 
1210
    }
-
 
1211
 
-
 
1212
    void writeIfNotNull(ObjectOutput out, Color s) throws IOException {
-
 
1213
        if (s != null) {
-
 
1214
            out.writeBoolean(true);
-
 
1215
            out.writeInt(s.getRGB());
-
 
1216
        } else {
-
 
1217
            out.writeBoolean(false);
-
 
1218
        }
-
 
1219
    }
-
 
1220
 
-
 
1221
    @Override
-
 
1222
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-
 
1223
        this.type = in.readInt();
-
 
1224
        this.id = in.readUTF();
-
 
1225
        this.UUID = in.readUTF();
-
 
1226
        if (in.readBoolean()) {
-
 
1227
            this.label = in.readUTF();
-
 
1228
        }
-
 
1229
        if (in.readBoolean()) {
-
 
1230
            this.value = in.readUTF();
-
 
1231
        }
-
 
1232
        this.fontSize = in.readInt();
-
 
1233
        this.gridWidth = in.readInt();
-
 
1234
        this.gridHeight = in.readInt();
-
 
1235
        this.horizontalAlignment = in.readByte();
-
 
1236
        this.verticalAlignment = in.readByte();
-
 
1237
        this.weightX = in.readByte();
-
 
1238
        this.weightY = in.readByte();
-
 
1239
 
-
 
1240
        if (in.readBoolean()) {
-
 
1241
            this.commitMode = in.readInt();
-
 
1242
        }
-
 
1243
        if (in.readBoolean()) {
-
 
1244
            this.width = in.readInt();
-
 
1245
        }
-
 
1246
        if (in.readBoolean()) {
-
 
1247
            this.height = in.readInt();
-
 
1248
        }
-
 
1249
        // Margins
-
 
1250
        if (in.readBoolean()) {
-
 
1251
            this.marginBottom = in.readInt();
-
 
1252
        }
-
 
1253
        if (in.readBoolean()) {
-
 
1254
            this.marginLeft = in.readInt();
-
 
1255
        }
-
 
1256
        if (in.readBoolean()) {
-
 
1257
            this.marginRight = in.readInt();
-
 
1258
        }
-
 
1259
        if (in.readBoolean()) {
-
 
1260
            this.marginTop = in.readInt();
-
 
1261
        }
-
 
1262
 
-
 
1263
        //
-
 
1264
        if (in.readBoolean()) {
-
 
1265
            this.maxHeight = in.readInt();
-
 
1266
        }
-
 
1267
        if (in.readBoolean()) {
-
 
1268
            this.maxWidth = in.readInt();
-
 
1269
        }
-
 
1270
 
-
 
1271
        if (in.readBoolean()) {
-
 
1272
            this.minInputSize = in.readInt();
-
 
1273
        }
-
 
1274
        if (in.readBoolean()) {
-
 
1275
            this.minHeight = in.readInt();
-
 
1276
        }
-
 
1277
        if (in.readBoolean()) {
-
 
1278
            this.minWidth = in.readInt();
-
 
1279
        }
-
 
1280
 
-
 
1281
        // Paddings
-
 
1282
        if (in.readBoolean()) {
-
 
1283
            this.paddingBottom = in.readInt();
-
 
1284
        }
-
 
1285
        if (in.readBoolean()) {
-
 
1286
            this.paddingLeft = in.readInt();
-
 
1287
        }
-
 
1288
        if (in.readBoolean()) {
-
 
1289
            this.paddingRight = in.readInt();
-
 
1290
        }
-
 
1291
        if (in.readBoolean()) {
-
 
1292
            this.paddingTop = in.readInt();
-
 
1293
        }
-
 
1294
        if (in.readBoolean()) {
-
 
1295
            this.valueType = in.readInt();
-
 
1296
        }
-
 
1297
 
-
 
1298
        this.enabled = in.readBoolean();
-
 
1299
        this.fillWidth = in.readBoolean();
-
 
1300
        this.fillHeight = in.readBoolean();
-
 
1301
        this.foldable = in.readBoolean();
-
 
1302
        this.folded = in.readBoolean();
-
 
1303
        this.fontBold = in.readBoolean();
-
 
1304
        this.fontItalic = in.readBoolean();
-
 
1305
        this.horizontallyResizable = in.readBoolean();
-
 
1306
        this.horizontallyScrollable = in.readBoolean();
-
 
1307
        this.required = in.readBoolean();
-
 
1308
        this.readOnly = in.readBoolean();
-
 
1309
        this.verticallyResizable = in.readBoolean();
-
 
1310
        this.verticallyScrollable = in.readBoolean();
-
 
1311
 
-
 
1312
        //
-
 
1313
        this.visible = in.readBoolean();
-
 
1314
        this.notSaved = in.readBoolean();
-
 
1315
        if (in.readBoolean()) {
-
 
1316
            this.displayPrecision = in.readUTF();
-
 
1317
        }
-
 
1318
        if (in.readBoolean()) {
-
 
1319
            this.icon = in.readUTF();
-
 
1320
        }
-
 
1321
        if (in.readBoolean()) {
-
 
1322
            this.toolTip = in.readUTF();
-
 
1323
        }
-
 
1324
        if (in.readBoolean()) {
-
 
1325
            this.valuePrecision = in.readUTF();
-
 
1326
        }
-
 
1327
        if (in.readBoolean()) {
-
 
1328
            this.valueRange = in.readUTF();
-
 
1329
        }
-
 
1330
        // Colors
-
 
1331
        if (in.readBoolean()) {
-
 
1332
            this.backgroundColor = new Color(in.readInt());
-
 
1333
        }
-
 
1334
        if (in.readBoolean()) {
-
 
1335
            this.borderColor = new Color(in.readInt());
-
 
1336
        }
-
 
1337
        if (in.readBoolean()) {
-
 
1338
            this.cellBackgroundColor = new Color(in.readInt());
-
 
1339
        }
-
 
1340
        if (in.readBoolean()) {
-
 
1341
            this.foreColor = new Color(in.readInt());
-
 
1342
        }
1084
    }
1343
    }
1085
}
1344
}