MCPcopy
hub / github.com/g3n/engine / build

Method build

gui/builder.go:490–515  ·  view source on GitHub ↗

build builds the gui object from the specified description. All its children are also built recursively Returns the built object or an error

(am map[string]interface{}, iparent IPanel)

Source from the content-addressed store, hash-verified

488// All its children are also built recursively
489// Returns the built object or an error
490func (b *Builder) build(am map[string]interface{}, iparent IPanel) (IPanel, error) {
491
492 // Get panel type
493 itype := am[AttribType]
494 if itype == nil {
495 return nil, fmt.Errorf("Type not specified")
496 }
497 typename := itype.(string)
498
499 // Get builder function for this type name
500 builder := b.builders[typename]
501 if builder == nil {
502 return nil, fmt.Errorf("Invalid type:%v", typename)
503 }
504
505 // Builds panel
506 pan, err := builder(b, am)
507 if err != nil {
508 return nil, err
509 }
510 // Adds built panel to parent
511 if iparent != nil {
512 iparent.GetPanel().Add(pan)
513 }
514 return pan, nil
515}
516
517// SetAttribs sets common attributes from the description to the specified panel
518func (b *Builder) SetAttribs(am map[string]interface{}, ipan IPanel) error {

Callers 10

BuildMethod · 0.95
buildPanelFunction · 0.80
buildImagePanelFunction · 0.80
buildVListFunction · 0.80
buildHListFunction · 0.80
buildDropDownFunction · 0.80
buildSplitterFunction · 0.80
buildTreeFunction · 0.80
buildWindowFunction · 0.80
buildTabBarFunction · 0.80

Calls 2

GetPanelMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected