setLayoutParams sets the optional layout params of the specified panel and its attributes
(am map[string]interface{}, ipan IPanel)
| 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 { |
| 624 | |
| 625 | // Get layout params attributes |
| 626 | lpi := am[AttribLayoutParams] |
| 627 | if lpi == nil { |
| 628 | return nil |
| 629 | } |
| 630 | lp := lpi.(map[string]interface{}) |
| 631 | |
| 632 | // Checks if layout param specifies the layout type |
| 633 | // This is useful when the panel has no parent yet |
| 634 | var ltype string |
| 635 | if v := lp[AttribType]; v != nil { |
| 636 | ltype = v.(string) |
| 637 | } else { |
| 638 | // Get layout type from parent |
| 639 | pi := am[AttribParentInternal] |
| 640 | if pi == nil { |
| 641 | return b.err(am, AttribType, "Panel has no parent") |
| 642 | } |
| 643 | par := pi.(map[string]interface{}) |
| 644 | v := par[AttribLayout] |
| 645 | if v == nil { |
| 646 | return b.err(am, AttribType, "Parent has no layout") |
| 647 | } |
| 648 | playout := v.(map[string]interface{}) |
| 649 | ltype = playout[AttribType].(string) |
| 650 | } |
| 651 | |
| 652 | // Get layout builder and builds layout params |
| 653 | lbuilder := b.layouts[ltype] |
| 654 | params, err := lbuilder.BuildParams(b, lp) |
| 655 | if err != nil { |
| 656 | return err |
| 657 | } |
| 658 | ipan.GetPanel().SetLayoutParams(params) |
| 659 | return nil |
| 660 | } |
| 661 | |
| 662 | // AttribCheckTableSortType checks and converts attribute table column sort type |
| 663 | func AttribCheckTableSortType(b *Builder, am map[string]interface{}, fname string) error { |
no test coverage detected