本文整理汇总了Golang中github.com/axel-freesp/sge/models.FilesTreeStore.SetValueById方法的典型用法代码示例。如果您正苦于以下问题:Golang FilesTreeStore.SetValueById方法的具体用法?Golang FilesTreeStore.SetValueById怎么用?Golang FilesTreeStore.SetValueById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/axel-freesp/sge/models.FilesTreeStore
的用法示例。
在下文中一共展示了FilesTreeStore.SetValueById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateConnections
func updateConnections(p bh.PortIf, fts *models.FilesTreeStore) {
nodeCursor := fts.Cursor(p.Node())
portCursor := fts.CursorAt(nodeCursor, p)
for _, c := range p.Connections() {
conn := p.Connection(c)
connCursor := fts.CursorAt(portCursor, conn)
otherNode := c.Node()
otherNodeCursor := fts.Cursor(otherNode)
otherPortCursor := fts.CursorAt(otherNodeCursor, c)
otherConnCursor := fts.CursorAt(otherPortCursor, conn)
connText := fmt.Sprintf("%s/%s -> %s/%s",
conn.From().Node().Name(), conn.From().Name(),
conn.To().Node().Name(), conn.To().Name())
fts.SetValueById(connCursor.Path, connText)
fts.SetValueById(otherConnCursor.Path, connText)
}
}
示例2: EditObject
func (j *EditJob) EditObject(fts *models.FilesTreeStore, direction EditJobDirection) (state string, err error) {
var detail, old *map[inputElement]string
if direction == EditJobForward {
detail, old = &j.detail, &j.old
} else {
old, detail = &j.detail, &j.old
}
var obj tr.TreeElementIf
obj, err = fts.GetObjectById(j.objId)
state = j.objId
switch j.elemType {
case eNode:
n := obj.(bh.NodeIf)
(*old)[iNodeName] = n.Name()
n.SetName((*detail)[iNodeName])
fts.SetValueById(j.objId, n.Name())
for _, p := range n.InPorts() {
updateConnections(p, fts)
}
for _, p := range n.OutPorts() {
updateConnections(p, fts)
}
case eOutputNode:
n := obj.(bh.NodeIf)
(*old)[iOutputNodeName] = n.Name()
n.SetName((*detail)[iOutputNodeName])
fts.SetValueById(j.objId, n.Name())
for _, p := range n.InPorts() {
updateConnections(p, fts)
}
case eInputNode:
n := obj.(bh.NodeIf)
(*old)[iInputNodeName] = n.Name()
n.SetName((*detail)[iInputNodeName])
fts.SetValueById(j.objId, n.Name())
for _, p := range n.OutPorts() {
updateConnections(p, fts)
}
case eNodeType:
nt := obj.(bh.NodeTypeIf)
if len(nt.Instances()) > 0 {
log.Printf("jobApplier.Apply(JobEdit): WARNING: NodeTypeIf %s has instances.\n", nt.TypeName())
log.Printf("jobApplier.Apply(JobEdit): Editing is not implemented in this case.\n")
return
}
(*old)[iTypeName] = nt.TypeName()
nt.SetTypeName((*detail)[iTypeName])
fts.SetValueById(j.objId, nt.TypeName())
case ePortType:
pt := obj.(bh.PortTypeIf)
ptCursor := fts.Cursor(pt)
ntCursor := fts.Parent(ptCursor)
nt := fts.Object(ntCursor).(bh.NodeTypeIf)
if len(nt.Instances()) > 0 {
log.Printf("jobApplier.Apply(JobEdit): WARNING: NodeTypeIf %s has instances.\n", nt.TypeName())
log.Printf("jobApplier.Apply(JobEdit): Editing is not implemented in this case.\n")
return
}
(*old)[iPortName] = pt.Name()
(*old)[iSignalTypeSelect] = pt.SignalType().TypeName()
(*old)[iDirection] = direction2string[pt.Direction()]
fts.DeleteObject(ptCursor.Path)
fts.AddNewObject(ntCursor.Path, ntCursor.Position,
behaviour.PortTypeNew((*detail)[iPortName],
(*detail)[iSignalTypeSelect],
string2direction[(*detail)[iDirection]]))
state = ptCursor.Path
case eSignalType:
st := obj.(bh.SignalTypeIf)
if (*detail)[iSignalTypeName] != st.TypeName() {
log.Printf("jobApplier.Apply(JobEdit): Renaming SignalType is not implemented.\n")
}
(*old)[iCType] = st.CType()
st.SetCType((*detail)[iCType])
(*old)[iChannelId] = st.ChannelId()
st.SetChannelId((*detail)[iChannelId])
(*old)[iScope] = scope2string[st.Scope()]
st.SetScope(string2scope[(*detail)[iScope]])
(*old)[iSignalMode] = mode2string[st.Mode()]
st.SetMode(string2mode[(*detail)[iSignalMode]])
case eImplementation:
impl := obj.(bh.ImplementationIf)
(*old)[iImplName] = impl.ElementName()
impl.SetElemName((*detail)[iImplName])
fts.SetValueById(j.objId, (*detail)[iImplName])
case eArch:
a := obj.(pf.ArchIf)
(*old)[iArchName] = a.Name()
a.SetName((*detail)[iArchName])
for _, p := range a.Processes() {
for _, c := range p.InChannels() {
link := c.Link()
id := fts.Cursor(link)
fts.SetValueById(id.Path, link.Name())
}
for _, c := range p.OutChannels() {
link := c.Link()
id := fts.Cursor(link)
fts.SetValueById(id.Path, link.Name())
}
//.........这里部分代码省略.........
示例3: setCurrentTopValue
func setCurrentTopValue(fts *models.FilesTreeStore, value string) {
id0 := getToplevelId(fts)
fts.SetValueById(id0, value)
}