コード例 #1
0
// NewSectionSelectionNodeTexter returns a new instance of SectionSelectionNodeTexter.
func NewSectionSelectionNodeTexter(node *viewmodel.SectionSelectionNode, listener ViewModelListener) *SectionSelectionNodeTexter {
	texter := &SectionSelectionNodeTexter{
		selectionTexter: NewValueSelectionNodeTexter(node.Selection(), listener),
		subTexter:       make(map[string]ViewModelNodeTexter),
		node:            node}

	sections := node.Sections()
	for key, section := range sections {
		visitor := NewViewModelTexterVisitor(listener)
		section.Specialize(visitor)
		texter.subTexter[key] = visitor.instance
	}

	return texter
}
コード例 #2
0
func (filler *viewModelFiller) SectionSelection(node *viewmodel.SectionSelectionNode) {
	filler.ValueSelection(node.Selection())
	filler.object.Set("type", "sectionSelection")
	filler.object.Set("label", node.Label())

	nodeSections := node.Sections()
	objSections := js.Global.Get("Object").New()
	for key, section := range nodeSections {
		sectionFiller := newViewModelFiller()
		section.Specialize(sectionFiller)
		objSections.Set(key, sectionFiller.object)
	}
	filler.object.Set("sections", objSections)
}