-
Notifications
You must be signed in to change notification settings - Fork 0
/
form_callback.go
441 lines (360 loc) · 13.4 KB
/
form_callback.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
// generated code - do not edit
package probe
import (
"log"
"slices"
"time"
table "github.com/fullstack-lang/gongtable/go/models"
"github.com/fullstack-lang/gongsim/go/models"
"github.com/fullstack-lang/gongsim/go/orm"
)
const __dummmy__time = time.Nanosecond
var __dummmy__letters = slices.Delete([]string{"a"}, 0, 1)
var __dummy_orm = orm.BackRepoStruct{}
// insertion point
func __gong__New__DummyAgentFormCallback(
dummyagent *models.DummyAgent,
probe *Probe,
formGroup *table.FormGroup,
) (dummyagentFormCallback *DummyAgentFormCallback) {
dummyagentFormCallback = new(DummyAgentFormCallback)
dummyagentFormCallback.probe = probe
dummyagentFormCallback.dummyagent = dummyagent
dummyagentFormCallback.formGroup = formGroup
dummyagentFormCallback.CreationMode = (dummyagent == nil)
return
}
type DummyAgentFormCallback struct {
dummyagent *models.DummyAgent
// If the form call is called on the creation of a new instnace
CreationMode bool
probe *Probe
formGroup *table.FormGroup
}
func (dummyagentFormCallback *DummyAgentFormCallback) OnSave() {
log.Println("DummyAgentFormCallback, OnSave")
// checkout formStage to have the form group on the stage synchronized with the
// back repo (and front repo)
dummyagentFormCallback.probe.formStage.Checkout()
if dummyagentFormCallback.dummyagent == nil {
dummyagentFormCallback.dummyagent = new(models.DummyAgent).Stage(dummyagentFormCallback.probe.stageOfInterest)
}
dummyagent_ := dummyagentFormCallback.dummyagent
_ = dummyagent_
for _, formDiv := range dummyagentFormCallback.formGroup.FormDivs {
switch formDiv.Name {
// insertion point per field
case "TechName":
FormDivBasicFieldToField(&(dummyagent_.TechName), formDiv)
case "Name":
FormDivBasicFieldToField(&(dummyagent_.Name), formDiv)
}
}
// manage the suppress operation
if dummyagentFormCallback.formGroup.HasSuppressButtonBeenPressed {
dummyagent_.Unstage(dummyagentFormCallback.probe.stageOfInterest)
}
dummyagentFormCallback.probe.stageOfInterest.Commit()
fillUpTable[models.DummyAgent](
dummyagentFormCallback.probe,
)
dummyagentFormCallback.probe.tableStage.Commit()
// display a new form by reset the form stage
if dummyagentFormCallback.CreationMode || dummyagentFormCallback.formGroup.HasSuppressButtonBeenPressed {
dummyagentFormCallback.probe.formStage.Reset()
newFormGroup := (&table.FormGroup{
Name: table.FormGroupDefaultName.ToString(),
}).Stage(dummyagentFormCallback.probe.formStage)
newFormGroup.OnSave = __gong__New__DummyAgentFormCallback(
nil,
dummyagentFormCallback.probe,
newFormGroup,
)
dummyagent := new(models.DummyAgent)
FillUpForm(dummyagent, newFormGroup, dummyagentFormCallback.probe)
dummyagentFormCallback.probe.formStage.Commit()
}
fillUpTree(dummyagentFormCallback.probe)
}
func __gong__New__EngineFormCallback(
engine *models.Engine,
probe *Probe,
formGroup *table.FormGroup,
) (engineFormCallback *EngineFormCallback) {
engineFormCallback = new(EngineFormCallback)
engineFormCallback.probe = probe
engineFormCallback.engine = engine
engineFormCallback.formGroup = formGroup
engineFormCallback.CreationMode = (engine == nil)
return
}
type EngineFormCallback struct {
engine *models.Engine
// If the form call is called on the creation of a new instnace
CreationMode bool
probe *Probe
formGroup *table.FormGroup
}
func (engineFormCallback *EngineFormCallback) OnSave() {
log.Println("EngineFormCallback, OnSave")
// checkout formStage to have the form group on the stage synchronized with the
// back repo (and front repo)
engineFormCallback.probe.formStage.Checkout()
if engineFormCallback.engine == nil {
engineFormCallback.engine = new(models.Engine).Stage(engineFormCallback.probe.stageOfInterest)
}
engine_ := engineFormCallback.engine
_ = engine_
for _, formDiv := range engineFormCallback.formGroup.FormDivs {
switch formDiv.Name {
// insertion point per field
case "Name":
FormDivBasicFieldToField(&(engine_.Name), formDiv)
case "EndTime":
FormDivBasicFieldToField(&(engine_.EndTime), formDiv)
case "CurrentTime":
FormDivBasicFieldToField(&(engine_.CurrentTime), formDiv)
case "SecondsSinceStart":
FormDivBasicFieldToField(&(engine_.SecondsSinceStart), formDiv)
case "Fired":
FormDivBasicFieldToField(&(engine_.Fired), formDiv)
case "ControlMode":
FormDivEnumStringFieldToField(&(engine_.ControlMode), formDiv)
case "State":
FormDivEnumStringFieldToField(&(engine_.State), formDiv)
case "Speed":
FormDivBasicFieldToField(&(engine_.Speed), formDiv)
}
}
// manage the suppress operation
if engineFormCallback.formGroup.HasSuppressButtonBeenPressed {
engine_.Unstage(engineFormCallback.probe.stageOfInterest)
}
engineFormCallback.probe.stageOfInterest.Commit()
fillUpTable[models.Engine](
engineFormCallback.probe,
)
engineFormCallback.probe.tableStage.Commit()
// display a new form by reset the form stage
if engineFormCallback.CreationMode || engineFormCallback.formGroup.HasSuppressButtonBeenPressed {
engineFormCallback.probe.formStage.Reset()
newFormGroup := (&table.FormGroup{
Name: table.FormGroupDefaultName.ToString(),
}).Stage(engineFormCallback.probe.formStage)
newFormGroup.OnSave = __gong__New__EngineFormCallback(
nil,
engineFormCallback.probe,
newFormGroup,
)
engine := new(models.Engine)
FillUpForm(engine, newFormGroup, engineFormCallback.probe)
engineFormCallback.probe.formStage.Commit()
}
fillUpTree(engineFormCallback.probe)
}
func __gong__New__EventFormCallback(
event *models.Event,
probe *Probe,
formGroup *table.FormGroup,
) (eventFormCallback *EventFormCallback) {
eventFormCallback = new(EventFormCallback)
eventFormCallback.probe = probe
eventFormCallback.event = event
eventFormCallback.formGroup = formGroup
eventFormCallback.CreationMode = (event == nil)
return
}
type EventFormCallback struct {
event *models.Event
// If the form call is called on the creation of a new instnace
CreationMode bool
probe *Probe
formGroup *table.FormGroup
}
func (eventFormCallback *EventFormCallback) OnSave() {
log.Println("EventFormCallback, OnSave")
// checkout formStage to have the form group on the stage synchronized with the
// back repo (and front repo)
eventFormCallback.probe.formStage.Checkout()
if eventFormCallback.event == nil {
eventFormCallback.event = new(models.Event).Stage(eventFormCallback.probe.stageOfInterest)
}
event_ := eventFormCallback.event
_ = event_
for _, formDiv := range eventFormCallback.formGroup.FormDivs {
switch formDiv.Name {
// insertion point per field
case "Name":
FormDivBasicFieldToField(&(event_.Name), formDiv)
case "Duration":
FormDivBasicFieldToField(&(event_.Duration), formDiv)
}
}
// manage the suppress operation
if eventFormCallback.formGroup.HasSuppressButtonBeenPressed {
event_.Unstage(eventFormCallback.probe.stageOfInterest)
}
eventFormCallback.probe.stageOfInterest.Commit()
fillUpTable[models.Event](
eventFormCallback.probe,
)
eventFormCallback.probe.tableStage.Commit()
// display a new form by reset the form stage
if eventFormCallback.CreationMode || eventFormCallback.formGroup.HasSuppressButtonBeenPressed {
eventFormCallback.probe.formStage.Reset()
newFormGroup := (&table.FormGroup{
Name: table.FormGroupDefaultName.ToString(),
}).Stage(eventFormCallback.probe.formStage)
newFormGroup.OnSave = __gong__New__EventFormCallback(
nil,
eventFormCallback.probe,
newFormGroup,
)
event := new(models.Event)
FillUpForm(event, newFormGroup, eventFormCallback.probe)
eventFormCallback.probe.formStage.Commit()
}
fillUpTree(eventFormCallback.probe)
}
func __gong__New__GongsimCommandFormCallback(
gongsimcommand *models.GongsimCommand,
probe *Probe,
formGroup *table.FormGroup,
) (gongsimcommandFormCallback *GongsimCommandFormCallback) {
gongsimcommandFormCallback = new(GongsimCommandFormCallback)
gongsimcommandFormCallback.probe = probe
gongsimcommandFormCallback.gongsimcommand = gongsimcommand
gongsimcommandFormCallback.formGroup = formGroup
gongsimcommandFormCallback.CreationMode = (gongsimcommand == nil)
return
}
type GongsimCommandFormCallback struct {
gongsimcommand *models.GongsimCommand
// If the form call is called on the creation of a new instnace
CreationMode bool
probe *Probe
formGroup *table.FormGroup
}
func (gongsimcommandFormCallback *GongsimCommandFormCallback) OnSave() {
log.Println("GongsimCommandFormCallback, OnSave")
// checkout formStage to have the form group on the stage synchronized with the
// back repo (and front repo)
gongsimcommandFormCallback.probe.formStage.Checkout()
if gongsimcommandFormCallback.gongsimcommand == nil {
gongsimcommandFormCallback.gongsimcommand = new(models.GongsimCommand).Stage(gongsimcommandFormCallback.probe.stageOfInterest)
}
gongsimcommand_ := gongsimcommandFormCallback.gongsimcommand
_ = gongsimcommand_
for _, formDiv := range gongsimcommandFormCallback.formGroup.FormDivs {
switch formDiv.Name {
// insertion point per field
case "Name":
FormDivBasicFieldToField(&(gongsimcommand_.Name), formDiv)
case "Command":
FormDivEnumStringFieldToField(&(gongsimcommand_.Command), formDiv)
case "CommandDate":
FormDivBasicFieldToField(&(gongsimcommand_.CommandDate), formDiv)
case "SpeedCommandType":
FormDivEnumStringFieldToField(&(gongsimcommand_.SpeedCommandType), formDiv)
case "DateSpeedCommand":
FormDivBasicFieldToField(&(gongsimcommand_.DateSpeedCommand), formDiv)
case "Engine":
FormDivSelectFieldToField(&(gongsimcommand_.Engine), gongsimcommandFormCallback.probe.stageOfInterest, formDiv)
}
}
// manage the suppress operation
if gongsimcommandFormCallback.formGroup.HasSuppressButtonBeenPressed {
gongsimcommand_.Unstage(gongsimcommandFormCallback.probe.stageOfInterest)
}
gongsimcommandFormCallback.probe.stageOfInterest.Commit()
fillUpTable[models.GongsimCommand](
gongsimcommandFormCallback.probe,
)
gongsimcommandFormCallback.probe.tableStage.Commit()
// display a new form by reset the form stage
if gongsimcommandFormCallback.CreationMode || gongsimcommandFormCallback.formGroup.HasSuppressButtonBeenPressed {
gongsimcommandFormCallback.probe.formStage.Reset()
newFormGroup := (&table.FormGroup{
Name: table.FormGroupDefaultName.ToString(),
}).Stage(gongsimcommandFormCallback.probe.formStage)
newFormGroup.OnSave = __gong__New__GongsimCommandFormCallback(
nil,
gongsimcommandFormCallback.probe,
newFormGroup,
)
gongsimcommand := new(models.GongsimCommand)
FillUpForm(gongsimcommand, newFormGroup, gongsimcommandFormCallback.probe)
gongsimcommandFormCallback.probe.formStage.Commit()
}
fillUpTree(gongsimcommandFormCallback.probe)
}
func __gong__New__GongsimStatusFormCallback(
gongsimstatus *models.GongsimStatus,
probe *Probe,
formGroup *table.FormGroup,
) (gongsimstatusFormCallback *GongsimStatusFormCallback) {
gongsimstatusFormCallback = new(GongsimStatusFormCallback)
gongsimstatusFormCallback.probe = probe
gongsimstatusFormCallback.gongsimstatus = gongsimstatus
gongsimstatusFormCallback.formGroup = formGroup
gongsimstatusFormCallback.CreationMode = (gongsimstatus == nil)
return
}
type GongsimStatusFormCallback struct {
gongsimstatus *models.GongsimStatus
// If the form call is called on the creation of a new instnace
CreationMode bool
probe *Probe
formGroup *table.FormGroup
}
func (gongsimstatusFormCallback *GongsimStatusFormCallback) OnSave() {
log.Println("GongsimStatusFormCallback, OnSave")
// checkout formStage to have the form group on the stage synchronized with the
// back repo (and front repo)
gongsimstatusFormCallback.probe.formStage.Checkout()
if gongsimstatusFormCallback.gongsimstatus == nil {
gongsimstatusFormCallback.gongsimstatus = new(models.GongsimStatus).Stage(gongsimstatusFormCallback.probe.stageOfInterest)
}
gongsimstatus_ := gongsimstatusFormCallback.gongsimstatus
_ = gongsimstatus_
for _, formDiv := range gongsimstatusFormCallback.formGroup.FormDivs {
switch formDiv.Name {
// insertion point per field
case "Name":
FormDivBasicFieldToField(&(gongsimstatus_.Name), formDiv)
case "CurrentCommand":
FormDivEnumStringFieldToField(&(gongsimstatus_.CurrentCommand), formDiv)
case "CompletionDate":
FormDivBasicFieldToField(&(gongsimstatus_.CompletionDate), formDiv)
case "CurrentSpeedCommand":
FormDivEnumStringFieldToField(&(gongsimstatus_.CurrentSpeedCommand), formDiv)
case "SpeedCommandCompletionDate":
FormDivBasicFieldToField(&(gongsimstatus_.SpeedCommandCompletionDate), formDiv)
}
}
// manage the suppress operation
if gongsimstatusFormCallback.formGroup.HasSuppressButtonBeenPressed {
gongsimstatus_.Unstage(gongsimstatusFormCallback.probe.stageOfInterest)
}
gongsimstatusFormCallback.probe.stageOfInterest.Commit()
fillUpTable[models.GongsimStatus](
gongsimstatusFormCallback.probe,
)
gongsimstatusFormCallback.probe.tableStage.Commit()
// display a new form by reset the form stage
if gongsimstatusFormCallback.CreationMode || gongsimstatusFormCallback.formGroup.HasSuppressButtonBeenPressed {
gongsimstatusFormCallback.probe.formStage.Reset()
newFormGroup := (&table.FormGroup{
Name: table.FormGroupDefaultName.ToString(),
}).Stage(gongsimstatusFormCallback.probe.formStage)
newFormGroup.OnSave = __gong__New__GongsimStatusFormCallback(
nil,
gongsimstatusFormCallback.probe,
newFormGroup,
)
gongsimstatus := new(models.GongsimStatus)
FillUpForm(gongsimstatus, newFormGroup, gongsimstatusFormCallback.probe)
gongsimstatusFormCallback.probe.formStage.Commit()
}
fillUpTree(gongsimstatusFormCallback.probe)
}