Beispiel #1
0
func (n *node) SubNode(ownId, childId bh.NodeIdIf) (ret bh.NodeIf, ok bool) {
	log.Printf("node.SubNode(%s, %s)\n", ownId, childId)
	if ownId.String() == childId.String() {
		ret, ok = n, true
		return
	}
	if !ownId.IsAncestor(childId) {
		return
	}
	for _, chn := range n.children() {
		ret, ok = chn.SubNode(NodeIdNew(ownId, chn.Name()), childId)
		if ok {
			return
		}
	}
	return
}
Beispiel #2
0
func (n *ExpandedNode) SelectNode(ownId, selectId bh.NodeIdIf) (modified bool, node NodeIf) {
	if ownId.String() == selectId.String() || ownId.IsAncestor(selectId) {
		n.highlighted = true
		node = n
		modified = n.Select()
	} else {
		n.highlighted = false
		modified = n.Deselect()
	}
	for _, ch := range n.Children {
		nn := ch.(NodeIf)
		chId := freesp.NodeIdNew(ownId, nn.Name())
		m, nd := nn.SelectNode(chId, selectId)
		if nd != nil {
			node = nd
		}
		modified = modified || m
	}
	return
}