-
Notifications
You must be signed in to change notification settings - Fork 0
/
fill_up_form_from_gongstruct.go
87 lines (80 loc) · 2.25 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
// generated code - do not edit
package probe
import (
gongtable "github.com/fullstack-lang/gongtable/go/models"
"github.com/fullstack-lang/gongsim/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.DummyAgent:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "DummyAgent Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__DummyAgentFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Engine:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Engine Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__EngineFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.Event:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "Event Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__EventFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.GongsimCommand:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "GongsimCommand Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__GongsimCommandFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
case *models.GongsimStatus:
formGroup := (&gongtable.FormGroup{
Name: formName,
Label: "GongsimStatus Form",
}).Stage(formStage)
formGroup.OnSave = __gong__New__GongsimStatusFormCallback(
instancesTyped,
probe,
formGroup,
)
formGroup.HasSuppressButton = true
FillUpForm(instancesTyped, formGroup, probe)
default:
_ = instancesTyped
}
formStage.Commit()
}