(p *tree.Plan, i int)
| 274 | } |
| 275 | |
| 276 | func (tb *Table) MakeRow(p *tree.Plan, i int) { |
| 277 | svi := tb.This.(core.Lister) |
| 278 | si, _, invis := svi.SliceIndex(i) |
| 279 | itxt := strconv.Itoa(i) |
| 280 | |
| 281 | if tb.ShowIndexes { |
| 282 | tb.MakeGridIndex(p, i, si, itxt, invis) |
| 283 | } |
| 284 | |
| 285 | for fli := 0; fli < tb.NCols; fli++ { |
| 286 | col := tb.Table.Table.Columns[fli] |
| 287 | valnm := fmt.Sprintf("value-%v.%v", fli, itxt) |
| 288 | |
| 289 | _, isstr := col.(*tensor.String) |
| 290 | if col.NumDims() == 1 { |
| 291 | str := "" |
| 292 | fval := float64(0) |
| 293 | tree.AddNew(p, valnm, func() core.Value { |
| 294 | if isstr { |
| 295 | return core.NewValue(&str, "") |
| 296 | } else { |
| 297 | return core.NewValue(&fval, "") |
| 298 | } |
| 299 | }, func(w core.Value) { |
| 300 | wb := w.AsWidget() |
| 301 | tb.MakeValue(w, i) |
| 302 | w.AsTree().SetProperty(core.ListColProperty, fli) |
| 303 | if !tb.IsReadOnly() { |
| 304 | wb.OnChange(func(e events.Event) { |
| 305 | if si < len(tb.Table.Indexes) { |
| 306 | if isstr { |
| 307 | tb.Table.Table.SetStringIndex(fli, tb.Table.Indexes[si], str) |
| 308 | } else { |
| 309 | tb.Table.Table.SetFloatIndex(fli, tb.Table.Indexes[si], fval) |
| 310 | } |
| 311 | } |
| 312 | tb.SendChange() |
| 313 | }) |
| 314 | } |
| 315 | wb.Updater(func() { |
| 316 | _, vi, invis := svi.SliceIndex(i) |
| 317 | if !invis { |
| 318 | if isstr { |
| 319 | str = tb.Table.Table.StringIndex(fli, vi) |
| 320 | core.Bind(&str, w) |
| 321 | } else { |
| 322 | fval = tb.Table.Table.FloatIndex(fli, vi) |
| 323 | core.Bind(&fval, w) |
| 324 | } |
| 325 | } else { |
| 326 | if isstr { |
| 327 | core.Bind(tb.BlankString, w) |
| 328 | } else { |
| 329 | core.Bind(tb.BlankFloat, w) |
| 330 | } |
| 331 | } |
| 332 | wb.SetReadOnly(tb.IsReadOnly()) |
| 333 | wb.SetState(invis, states.Invisible) |
nothing calls this directly
no test coverage detected