summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--table.go39
1 files changed, 38 insertions, 1 deletions
diff --git a/table.go b/table.go
index 24347cd..a8cf488 100644
--- a/table.go
+++ b/table.go
@@ -47,7 +47,7 @@ func (me *TreeInfo) doTable(a widget.Action) {
log.Info("TREE already has UUID", i, ot.Uuid)
if t.Uuid == ot.Uuid {
log.Info("TREE found UUID! update table here", i, ot.Uuid)
- log.Info("todo: compare table here...")
+ me.updateTable(t)
return
}
}
@@ -92,6 +92,43 @@ func (grid *Node) makeGridLabel(pb *guipb.Widget, w int, h int) *Node {
return AddNode(a)
}
+func (me *TreeInfo) updateTable(t *guipb.Table) {
+ log.Info("todo: compare table here...")
+ for _, name := range t.Order {
+ me.updateRow(t, name)
+ }
+}
+
+func (me *TreeInfo) updateRow(t *guipb.Table, name string) {
+ for _, r := range t.StringRows {
+ if name == r.Header.Name {
+ id := r.Header.Id
+ n := treeRoot.FindWidgetId(int(id))
+ if n == nil {
+ log.Info("could not find widget id", id)
+ }
+ // log.Info("tree.updateRow() start found header", id, r.Header, "len =", len(r.Widgets))
+ // if r.Header.Name == "Hostname" {
+ // }
+ // log.Info("tree.updateRow() found Hostnames", r.Vals)
+ for i, v := range r.Vals {
+ // log.Info("tree: Hostname Widget", i, v, w.Name)
+ w := r.Widgets[i]
+ if v != w.Name {
+ log.Info("tree: need to update:", i, v, "vs", w.Name, w.Id)
+ n := treeRoot.FindWidgetId(int(w.Id))
+ if n == nil {
+ log.Info("tree.TableUpdate() err n == nil ", w.Id, w.Name)
+ continue
+ }
+ me.SetText(n, v)
+ }
+ }
+ return
+ }
+ }
+}
+
func (me *TreeInfo) makeTable(t *guipb.Table) {
var grid *Node
if t.Window != nil {