setLayout sets the optional layout of the specified panel
(am map[string]interface{}, ipan IPanel)
| 592 | |
| 593 | // setLayout sets the optional layout of the specified panel |
| 594 | func (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 |
| 623 | func (b *Builder) setLayoutParams(am map[string]interface{}, ipan IPanel) error { |
no test coverage detected