MCPcopy Index your code
hub / github.com/g3n/engine / buildPanel

Function buildPanel

gui/builder_panel.go:15–36  ·  view source on GitHub ↗

buildPanel builds an object of type Panel

(b *Builder, am map[string]interface{})

Source from the content-addressed store, hash-verified

13
14// buildPanel builds an object of type Panel
15func buildPanel(b *Builder, am map[string]interface{}) (IPanel, error) {
16
17 pan := NewPanel(0, 0)
18 err := b.SetAttribs(am, pan)
19 if err != nil {
20 return nil, err
21 }
22
23 // Builds children recursively
24 if am[AttribItems] != nil {
25 items := am[AttribItems].([]map[string]interface{})
26 for i := 0; i < len(items); i++ {
27 item := items[i]
28 child, err := b.build(item, pan)
29 if err != nil {
30 return nil, err
31 }
32 pan.Add(child)
33 }
34 }
35 return pan, nil
36}
37
38// buildImagePanel builds a gui object of type ImagePanel
39func buildImagePanel(b *Builder, am map[string]interface{}) (IPanel, error) {

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
NewPanelFunction · 0.85
SetAttribsMethod · 0.80
buildMethod · 0.80

Tested by

no test coverage detected