(p *tree.Plan, i int)
| 277 | } |
| 278 | |
| 279 | func (tb *Table) MakeRow(p *tree.Plan, i int) { |
| 280 | svi := tb.This.(Lister) |
| 281 | si, _, invis := svi.SliceIndex(i) |
| 282 | itxt := strconv.Itoa(i) |
| 283 | val := tb.sliceElementValue(si) |
| 284 | // stru := val.Interface() |
| 285 | |
| 286 | if tb.ShowIndexes { |
| 287 | tb.MakeGridIndex(p, i, si, itxt, invis) |
| 288 | } |
| 289 | |
| 290 | for fli := 0; fli < tb.numVisibleFields; fli++ { |
| 291 | field := tb.visibleFields[fli] |
| 292 | uvp := reflectx.UnderlyingPointer(val.FieldByIndex(field.Index)) |
| 293 | uv := uvp.Elem() |
| 294 | valnm := fmt.Sprintf("value-%d-%s-%s", fli, itxt, reflectx.ShortTypeName(field.Type)) |
| 295 | tags := field.Tag |
| 296 | if uv.Kind() == reflect.Slice || uv.Kind() == reflect.Map { |
| 297 | ni := reflect.StructTag(`display:"no-inline"`) |
| 298 | if tags == "" { |
| 299 | tags += " " + ni |
| 300 | } else { |
| 301 | tags = ni |
| 302 | } |
| 303 | } |
| 304 | readOnlyTag := tags.Get("edit") == "-" |
| 305 | |
| 306 | tree.AddNew(p, valnm, func() Value { |
| 307 | return NewValue(uvp.Interface(), tags) |
| 308 | }, func(w Value) { |
| 309 | wb := w.AsWidget() |
| 310 | tb.MakeValue(w, i) |
| 311 | w.AsTree().SetProperty(ListColProperty, fli) |
| 312 | if !tb.IsReadOnly() && !readOnlyTag { |
| 313 | wb.OnChange(func(e events.Event) { |
| 314 | tb.SendChange() |
| 315 | }) |
| 316 | } |
| 317 | wb.Updater(func() { |
| 318 | si, vi, invis := svi.SliceIndex(i) |
| 319 | val := tb.sliceElementValue(vi) |
| 320 | upv := reflectx.UnderlyingPointer(val.FieldByIndex(field.Index)) |
| 321 | Bind(upv.Interface(), w) |
| 322 | |
| 323 | vc := tb.ValueTitle + "[" + strconv.Itoa(si) + "]" |
| 324 | if !invis { |
| 325 | if lblr, ok := tb.Slice.(labels.SliceLabeler); ok { |
| 326 | slbl := lblr.ElemLabel(si) |
| 327 | if slbl != "" { |
| 328 | vc = joinValueTitle(tb.ValueTitle, slbl) |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | wb.ValueTitle = vc + " (" + wb.ValueTitle + ")" |
| 333 | wb.SetReadOnly(tb.IsReadOnly() || readOnlyTag) |
| 334 | wb.SetState(invis, states.Invisible) |
| 335 | if svi.HasStyler() { |
| 336 | w.Style() |
nothing calls this directly
no test coverage detected