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

Method setLayout

gui/builder.go:594–620  ·  view source on GitHub ↗

setLayout sets the optional layout of the specified panel

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

Source from the content-addressed store, hash-verified

592
593// setLayout sets the optional layout of the specified panel
594func (b *Builder) setLayout(am map[string]interface{}, ipan IPanel) error {
595
596 // Get layout type
597 lai := am[AttribLayout]
598 if lai == nil {
599 return nil
600 }
601 lam := lai.(map[string]interface{})
602 ltype := lam[AttribType]
603 if ltype == nil {
604 return b.err(am, AttribType, "Layout must have a type")
605 }
606
607 // Get layout builder
608 lbuilder := b.layouts[ltype.(string)]
609 if lbuilder == nil {
610 return b.err(am, AttribType, "Invalid layout type")
611 }
612
613 // Builds layout builder and set to panel
614 layout, err := lbuilder.BuildLayout(b, lam)
615 if err != nil {
616 return err
617 }
618 ipan.SetLayout(layout)
619 return nil
620}
621
622// setLayoutParams sets the optional layout params of the specified panel and its attributes
623func (b *Builder) setLayoutParams(am map[string]interface{}, ipan IPanel) error {

Callers 1

SetAttribsMethod · 0.95

Calls 3

errMethod · 0.95
BuildLayoutMethod · 0.65
SetLayoutMethod · 0.65

Tested by

no test coverage detected