string rows
This commit is contained in:
parent
27c9417a32
commit
2a277c147a
26
action.go
26
action.go
|
@ -10,32 +10,6 @@ import (
|
|||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
// repeated string order = 1;
|
||||
//
|
||||
// repeated StringRow StringRows = 2;
|
||||
// repeated IntRow IntRows = 3;
|
||||
// repeated TimeRow TimeRows = 4;
|
||||
// repeated BoolRow BoolRows = 5;
|
||||
func (me *TreeInfo) doTable(a widget.Action) {
|
||||
if a.TablePB == nil {
|
||||
log.Log(TREE, "tree: action didn't have a Table PB")
|
||||
return
|
||||
}
|
||||
pb := guipb.NewTables()
|
||||
if err := pb.Unmarshal(a.TablePB); err != nil {
|
||||
log.Info("unmarshal error", err, "data len =", len(a.TablePB))
|
||||
return
|
||||
}
|
||||
log.Info("dumpTables:")
|
||||
all := pb.All()
|
||||
for all.Scan() {
|
||||
t := all.Next()
|
||||
for i, o := range t.Order {
|
||||
log.Info("got order:", t.Title, i, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// everything from the application goes through here
|
||||
func (me *TreeInfo) doAction(a widget.Action) {
|
||||
if a.TablePB != nil {
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
// Although most code from WIT.COM Inc is under the GPL
|
||||
// This code is more generic because it must be able
|
||||
// to be used in any GUI plugin
|
||||
|
||||
package tree
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/protobuf/guipb"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
// repeated string order = 1;
|
||||
//
|
||||
// repeated StringRow StringRows = 2;
|
||||
// repeated IntRow IntRows = 3;
|
||||
// repeated TimeRow TimeRows = 4;
|
||||
// repeated BoolRow BoolRows = 5;
|
||||
func (me *TreeInfo) doTable(a widget.Action) {
|
||||
if a.TablePB == nil {
|
||||
log.Log(TREE, "tree: action didn't have a Table PB")
|
||||
return
|
||||
}
|
||||
pb := guipb.NewTables()
|
||||
if err := pb.Unmarshal(a.TablePB); err != nil {
|
||||
log.Info("unmarshal error", err, "data len =", len(a.TablePB))
|
||||
return
|
||||
}
|
||||
log.Info("dumpTables:")
|
||||
all := pb.All()
|
||||
for all.Scan() {
|
||||
t := all.Next()
|
||||
for i, o := range t.Order {
|
||||
log.Info("got order:", t.Title, i, o)
|
||||
}
|
||||
me.ShowTable(t)
|
||||
dumpTable(t)
|
||||
}
|
||||
}
|
||||
|
||||
func dumpTable(t *guipb.Table) {
|
||||
for i, o := range t.Order {
|
||||
log.Info("got order:", t.Title, i, o)
|
||||
}
|
||||
for i, r := range t.StringRows {
|
||||
log.Info("got string row:", t.Title, i, r.Header, r.Vals)
|
||||
for _, v := range r.WidgetS {
|
||||
log.Info("tree: got string widget:", v.Id, v.Name)
|
||||
}
|
||||
}
|
||||
for i, r := range t.IntRows {
|
||||
log.Info("got int row:", t.Title, i, r.Header, r.Vals)
|
||||
for _, v := range r.Widgets {
|
||||
log.Info("tree: got int widget:", v.Id, v.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type TreeTable struct {
|
||||
PB *guipb.Table
|
||||
/*
|
||||
hostnames []string
|
||||
columns []*gui.NodeColumn
|
||||
order []*gui.NodeColumn
|
||||
*/
|
||||
}
|
Loading…
Reference in New Issue