-
Notifications
You must be signed in to change notification settings - Fork 0
/
fill_up_form_from_gongstruct.go
111 lines (104 loc) · 2.84 KB
/
fill_up_form_from_gongstruct.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
// generated code - do not edit
package probe
import (
gongtable "github.com/fullstack-lang/gongtable/go/models"
"github.com/fullstack-lang/gongfly/go/models"
)
func FillUpFormFromGongstruct[T models.Gongstruct](instance *T, probe *Probe) {
formStage := probe.formStage
formStage.Reset()
formStage.Commit()
FillUpNamedFormFromGongstruct[T](instance, probe, formStage, gongtable.FormGroupDefaultName.ToString())
}
func FillUpNamedFormFromGongstruct[T models.Gongstruct](instance *T, probe *Probe, formStage *gongtable.StageStruct, formName string) {
switch instancesTyped := any(instance).(type) {
// insertion point
case *models.CivilianAirport:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "CivilianAirport Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__CivilianAirportFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Liner:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Liner Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__LinerFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Message:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Message Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__MessageFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.OpsLine:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "OpsLine Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__OpsLineFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Radar:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Radar Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__RadarFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Satellite:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Satellite Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__SatelliteFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Scenario:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Scenario Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__ScenarioFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
default:
_ = instancesTyped
}
formStage.Commit()
}