132 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
182 |
ilm |
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
132 |
ilm |
5 |
*
|
|
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
|
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
|
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
|
|
9 |
* language governing permissions and limitations under the License.
|
|
|
10 |
*
|
|
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
package org.openconcerto.ui.light;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.utils.io.JSONConverter;
|
|
|
17 |
|
|
|
18 |
import net.minidev.json.JSONObject;
|
|
|
19 |
|
|
|
20 |
public class LightUITab extends LightUIPanel {
|
|
|
21 |
private boolean load = false;
|
|
|
22 |
private boolean forceReload = false;
|
|
|
23 |
|
|
|
24 |
public LightUITab(final String tabId, final String title) {
|
|
|
25 |
super(tabId);
|
|
|
26 |
this.setTitle(title);
|
|
|
27 |
this.setType(TYPE_TAB_ELEMENT);
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public LightUITab(final JSONObject json) {
|
|
|
31 |
super(json);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public LightUITab(final LightUITab tab) {
|
|
|
35 |
super(tab);
|
|
|
36 |
this.load = tab.load;
|
|
|
37 |
this.forceReload = tab.forceReload;
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
public boolean isForceReload() {
|
|
|
41 |
return this.forceReload;
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
public void setForceReload(final boolean forceReload) {
|
|
|
45 |
this.forceReload = forceReload;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
public boolean isLoad() {
|
|
|
49 |
return this.load;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
public void setLoad(final boolean load) {
|
|
|
53 |
this.load = load;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
@Override
|
|
|
57 |
public void copy(final LightUIElement element) {
|
|
|
58 |
if (!(element instanceof LightUITab)) {
|
|
|
59 |
throw new InvalidClassException(LightUITab.class.getName(), element.getClassName(), element.getId());
|
|
|
60 |
}
|
|
|
61 |
super.copy(element);
|
|
|
62 |
final LightUITab tab = (LightUITab) element;
|
|
|
63 |
this.forceReload = tab.forceReload;
|
|
|
64 |
this.load = tab.load;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
@Override
|
|
|
68 |
public JSONObject toJSON() {
|
|
|
69 |
final JSONObject json = super.toJSON();
|
|
|
70 |
if (this.load) {
|
|
|
71 |
json.put("load", true);
|
|
|
72 |
}
|
|
|
73 |
if (this.forceReload) {
|
|
|
74 |
json.put("force-reload", true);
|
|
|
75 |
}
|
|
|
76 |
return json;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
@Override
|
|
|
80 |
public void fromJSON(JSONObject json) {
|
|
|
81 |
super.fromJSON(json);
|
|
|
82 |
this.load = (Boolean) JSONConverter.getParameterFromJSON(json, "load", Boolean.class, false);
|
|
|
83 |
this.forceReload = (Boolean) JSONConverter.getParameterFromJSON(json, "force-reload", Boolean.class, false);
|
|
|
84 |
}
|
|
|
85 |
}
|