MCPcopy Create free account
hub / github.com/cogentcore/core / Init

Method Init

tensor/tensorcore/table.go:71–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69var _ core.Lister = (*Table)(nil)
70
71func (tb *Table) Init() {
72 tb.ListBase.Init()
73 tb.SortIndex = -1
74 tb.TensorDisplay.Defaults()
75 tb.ColumnTensorDisplay = map[int]*TensorDisplay{}
76 tb.ColumnTensorBlank = map[int]*tensor.Float64{}
77
78 tb.Makers.Normal[0] = func(p *tree.Plan) { // TODO: reduce redundancy with ListBase Maker
79 svi := tb.This.(core.Lister)
80 svi.UpdateSliceSize()
81
82 scrollTo := -1
83 if tb.InitSelectedIndex >= 0 {
84 tb.SelectedIndex = tb.InitSelectedIndex
85 tb.InitSelectedIndex = -1
86 scrollTo = tb.SelectedIndex
87 }
88 if scrollTo >= 0 {
89 tb.ScrollToIndex(scrollTo)
90 }
91
92 tb.UpdateStartIndex()
93 tb.UpdateMaxWidths()
94
95 tb.Updater(func() {
96 tb.UpdateStartIndex()
97 tb.UpdateMaxWidths()
98 })
99
100 tb.MakeHeader(p)
101 tb.MakeGrid(p, func(p *tree.Plan) {
102 for i := 0; i < tb.VisibleRows; i++ {
103 svi.MakeRow(p, i)
104 }
105 })
106 }
107}
108
109func (tb *Table) SliceIndex(i int) (si, vi int, invis bool) {
110 si = tb.StartIndex + i

Callers

nothing calls this directly

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls 10

UpdateMaxWidthsMethod · 0.95
MakeHeaderMethod · 0.95
ScrollToIndexMethod · 0.80
UpdateStartIndexMethod · 0.80
UpdaterMethod · 0.80
MakeGridMethod · 0.80
InitMethod · 0.65
DefaultsMethod · 0.65
UpdateSliceSizeMethod · 0.65
MakeRowMethod · 0.65

Tested by

no test coverage detected