nx_metadata_sdk 1.0 Metadata SDK

settings_model.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <string>
6
7 namespace nx {
8 namespace vms_server_plugins {
9 namespace analytics {
10 namespace stub {
11 namespace settings {
12
13 static const std::string kRegularSettingsModelOption = "regular";
14 static const std::string kAlternativeSettingsModelOption = "alternative";
15
16 static const std::string kSettingsModelSettings = "settingsModelComboBox";
17
18 static const std::string kCitySelector = "languageSelectorSettings";
19 static const std::string kEnglishOption = "English";
20 static const std::string kGermanOption = "German";
21
22 static const std::string kAlternativeSettingsModel =
23 /*suppress newline*/ 1 + (const char*) R"json("
24 {
25 "type": "Settings",
26 "items":
27 [
28 {
29 "type": "ComboBox",
30 "name": ")json" + kSettingsModelSettings + R"json(",
31 "caption": "Settings model",
32 "defaultValue": ")json" + kRegularSettingsModelOption + R"json(",
33 "range":
34 [
35 ")json" + kRegularSettingsModelOption + R"json(",
36 ")json" + kAlternativeSettingsModelOption + R"json("
37 ]
38 },
39 {
40 "type": "GroupBox",
41 "caption": "Alternative GroupBox",
42 "items":
43 [
44 {
45 "type": "CheckBox",
46 "name": "alternativeCheckBox",
47 "caption": "Alternative CheckBox",
48 "defaultValue": true
49 },
50 {
51 "type": "TextField",
52 "name": "alternativeTextField",
53 "caption": "Alternative TextField",
54 "defaultValue": "alternative text"
55 }
56 ]
57 }
58 ]
59 }
60 )json";
61
62 static const std::string kRegularSettingsModelPart1 = /*suppress newline*/ 1 + R"json(
63 {
64 "type": "Settings",
65 "items":
66 [
67 {
68 "type": "ComboBox",
69 "name": ")json" + kSettingsModelSettings + R"json(",
70 "caption": "Settings model",
71 "defaultValue": ")json" + kRegularSettingsModelOption + R"json(",
72 "range":
73 [
74 ")json" + kRegularSettingsModelOption + R"json(",
75 ")json" + kAlternativeSettingsModelOption + R"json("
76 ]
77 },
78 {
79 "type": "GroupBox",
80 "caption": "Example Stub DeviceAgent settings",
81 "items":
82 [
83 {
84 "type": "TextField",
85 "name": "testTextField",
86 "caption": "Device Agent Text Field",
87 "description": "A text field",
88 "defaultValue": "a text"
89 },
90 {
91 "type": "ComboBox",
92 "name": ")json" + kCitySelector + R"json(",
93 "caption": "Cities",
94 "defaultValue": "English",
95 "range": [
96 ")json" + kEnglishOption + R"json(",
97 ")json" + kGermanOption + R"json("
98 ]
99 },
100 )json";
101
102 static const std::string kEnglishCitiesSettingsModelPart = /*suppress newline*/ 1 + R"json(
103 {
104 "type": "RadioButtonGroup",
105 "name": "testEnglishRadioButtonGroup",
106 "caption": "Choose one",
107 "description": "Choose one option",
108 "defaultValue": "London",
109 "range":
110 [
111 "London",
112 "Liverpool"
113 ]
114 },
115 )json";
116
117 static const std::string kGermanCitiesSettingsModelPart = /*suppress newline*/ 1 + R"json(
118 {
119 "type": "RadioButtonGroup",
120 "name": "testGermanRadioButtonGroup",
121 "caption": "Choose one",
122 "description": "Choose one option",
123 "defaultValue": "Berlin",
124 "range":
125 [
126 "Berlin",
127 "Nuremberg",
128 "Leipzig"
129 ]
130 },
131 )json";
132
133 static const std::string kRegularSettingsModelPart2 = /*suppress newline*/ 1 + R"json("
134 {
135 "type": "RadioButtonGroup",
136 "name": "testRadioButtonGroup",
137 "caption": "RadioButton Group",
138 "description": "Choose one option",
139 "defaultValue": "Cs_enodatum",
140 "range":
141 [
142 "K_gowerianus",
143 "K_galilaeii",
144 "S_calloviense",
145 "S_micans",
146 "Cs_enodatum",
147 "K_medea",
148 "K_jason",
149 "K_obductum",
150 "K_posterior"
151 ],
152 "itemCaptions":
153 {
154 "K_gowerianus": "Kepplerites gowerianus",
155 "K_galilaeii": "Kepplerites galilaeii",
156 "S_calloviense": "Sigaloceras calloviense",
157 "S_micans": "Sigaloceras micans",
158 "Cs_enodatum": "Catasigaloceras enodatum",
159 "K_medea": "Kosmoceras medea",
160 "K_jason": "Kosmoceras jason",
161 "K_obductum": "Kosmoceras obductum",
162 "K_posterior": "Kosmoceras posterior"
163 }
164 },
165 {
166 "type": "CheckBoxGroup",
167 "name": "testCheckBoxGroup",
168 "caption": "CheckBox Group",
169 "description": "Choose one or several options",
170 "defaultValue": ["Coleoidea", "Nautiloidea"],
171 "range":
172 [
173 "Coleoidea",
174 "Ammonoidea",
175 "Nautiloidea",
176 "Orthoceratoidea"
177 ],
178 "itemCaptions":
179 {
180 "Coleoidea": "Coleoidea (Bather, 1888)",
181 "Ammonoidea": "Ammonoidea (Zittel, 1884)",
182 "Nautiloidea": "Nautiloidea (Agassiz, 1847)",
183 "Orthoceratoidea": "Orthoceratoidea (M'Coy 1844)"
184 }
185 },
186 {
187 "type": "SpinBox",
188 "caption": "Device Agent SpinBox (plugin side)",
189 "name": "pluginSideTestSpinBox",
190 "defaultValue": 42,
191 "minValue": 0,
192 "maxValue": 100
193 },
194 {
195 "type": "DoubleSpinBox",
196 "caption": "Device Agent DoubleSpinBox",
197 "name": "testDoubleSpinBox",
198 "defaultValue": 3.1415,
199 "minValue": 0.0,
200 "maxValue": 100.0
201 },
202 {
203 "type": "ComboBox",
204 "name": "testComboBox",
205 "caption": "Device Agent ComboBox",
206 "defaultValue": "value2",
207 "range": ["value1", "value2", "value3"],
208 "itemCaptions":
209 {
210 "value1": "Device Agent Value #1",
211 "value2": "Device Agent Value #2",
212 "value3": "Device Agent Value #3"
213 }
214 },
215 {
216 "type": "Separator"
217 },
218 {
219 "type": "CheckBox",
220 "caption": "Device Agent CheckBox",
221 "name": "testCheckBox",
222 "defaultValue": true
223 },
224 {
225 "type": "CheckBox",
226 "caption": "Disabled Device Agent CheckBox",
227 "name": "disabledTestCheckBox",
228 "defaultValue": false,
229 "enabled": false
230 },
231 {
232 "type": "CheckBox",
233 "caption": "Hidden Device Agent CheckBox",
234 "name": "hiddenTestCheckBox",
235 "defaultValue": false,
236 "visible": false
237 }
238 ]
239 }
240 ],
241 "sections":
242 [
243 {
244 "type": "Section",
245 "caption": "Example section",
246 "items":
247 [
248 {
249 "type": "GroupBox",
250 "caption": "Example Stub DeviceAgent settings section",
251 "items":
252 [
253 {
254 "type": "TextField",
255 "name": "testTextFieldWithValidation",
256 "caption": "Hexadecimal number text field",
257 "defaultValue": "12ab34cd",
258 "validationRegex": "^[a-f0-9]+$",
259 "validationRegexFlags": "i",
260 "validationErrorMessage":
261 "Text must contain only digits and characters a-f, e.g. 12ab34cd."
262 },
263 {
264 "type": "SpinBox",
265 "caption": "Device Agent SpinBox (plugin side)",
266 "name": "pluginSideTestSpinBox2",
267 "defaultValue": 42,
268 "minValue": 0,
269 "maxValue": 100
270 },
271 {
272 "type": "DoubleSpinBox",
273 "caption": "Device Agent DoubleSpinBox",
274 "name": "testDoubleSpinBox2",
275 "defaultValue": 3.1415,
276 "minValue": 0.0,
277 "maxValue": 100.0
278 },
279 {
280 "type": "ComboBox",
281 "name": "testComboBox2",
282 "caption": "Device Agent ComboBox",
283 "defaultValue": "value2",
284 "range": ["value1", "value2", "value3"]
285 },
286 {
287 "type": "CheckBox",
288 "caption": "Device Agent CheckBox",
289 "name": "testCheckBox2",
290 "defaultValue": true
291 }
292 ]
293 }
294 ],
295 "sections":
296 [
297 {
298 "type": "Section",
299 "caption": "Nested section",
300 "items":
301 [
302 {
303 "type": "GroupBox",
304 "caption": "Example Stub DeviceAgent settings nested section",
305 "items":
306 [
307 {
308 "type": "SwitchButton",
309 "caption": "Switch Button",
310 "name": "testSwitch",
311 "description": "Tooltip for the switch button",
312 "defaultValue": false
313 },
314 {
315 "type": "SpinBox",
316 "caption": "SpinBox Parameter",
317 "name": "testSpinBox3",
318 "defaultValue": 42,
319 "minValue": 0,
320 "maxValue": 100
321 },
322 {
323 "type": "DoubleSpinBox",
324 "caption": "DoubleSpinBox Parameter",
325 "name": "testDoubleSpinBox3",
326 "defaultValue": 3.1415,
327 "minValue": 0.0,
328 "maxValue": 100.0
329 },
330 {
331 "type": "ComboBox",
332 "name": "testComboBox3",
333 "caption": "ComboBox Parameter",
334 "defaultValue": "value2",
335 "range": ["value1", "value2", "value3"]
336 },
337 {
338 "type": "CheckBox",
339 "caption": "CheckBox Parameter",
340 "name": "testCheckBox3",
341 "defaultValue": true
342 }
343 ]
344 }
345 ]
346 }
347 ]
348 }
349 ]
350 }
351 )json";
352
353 } // namespace settings
354 } // namespace stub
355 } // namespace analytics
356 } // namespace vms_server_plugins
357 } // namespace nx
nx
Definition: apple_utils.h:6