for the mooc videos I must use larger fonts. So I ended up hacking and changing the hardcoded number in default defaultRowHeight ^ 24 rowHeight "This is the row height your rows will have. Cells answered in dataSource will be forced to have this height number... We force it instead allowing lists to have any height because the logic to calculate rows becomes complicated. Possible, but complicated :)" ^ rowHeight ifNil: [ self class defaultRowHeight ] Esteban two questions: - when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :). - if I were about to manage the height of a row based on its actual contents where should I put it. FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed? Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font. I still did not get where the strings built. may be here updateExposedRows ... | cell | cell := (self owner dataSource cellColumn: (columns at: columnIndex) row: rowIndex). cell width: (columnWidths at: columnIndex). We should add more comments to methods. Stef drawOn: canvas | x y cellWidth cellHeight rowsToDisplay rowSubviews highligtedRowIndexes primarySelectionIndex | self bounds ifNil: [ ^ self ]. "Nothing to show yet" self owner ifNil: [ ^ self ]. x := self left + self class rowLeftMargin. y := self top. cellWidth := self width - self class rowLeftMargin. cellHeight := self owner rowHeight. ^^^^^^^^^^^^^^^^^^^^^^^ highligtedRowIndexes := self owner selectedRowIndexes, self owner highlightedRowIndexes. primarySelectionIndex := self owner selectedRowIndex. "For some superweird reason, calling #calculateExposedRows here instead in #changed (where it should be called) is 10x faster. Since the whole purpose of this component is speed, for now I'm calling it here and adding the #setNeedRecalculateRows mechanism. History, please forgive me." self updateAllRows. rowsToDisplay := self exposedRows. rowSubviews := OrderedCollection new: rowsToDisplay size + 1. headerRow ifNotNil: [ headerRow bounds: (x@y extent: cellWidth@cellHeight). y := y + cellHeight + self owner intercellSpacing. rowSubviews add: headerRow ]. rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | visibleHeight := cellHeight min: (self bottom - y). row bounds: (x@y extent: cellWidth@visibleHeight). y := y + visibleHeight + self owner intercellSpacing. rowSubviews add: ((highligtedRowIndexes includes: rowIndex) ifTrue: [ "IMPORTANT: I need to set owner to nil because otherwise it will trigger an invalidation of the owner when adding morph to selectionMorph, causing an infinite loop" self toSelectionRow: (row privateOwner: nil) primary: primarySelectionIndex = rowIndex ] ifFalse: [ row ]) ]. submorphs := rowSubviews asArray. super drawOn: canvas. needsRefreshExposedRows := false
Le 20/10/2015 18:42, stepharo a écrit :
for the mooc videos I must use larger fonts. So I ended up hacking and changing the hardcoded number in default
defaultRowHeight ^ 24
rowHeight "This is the row height your rows will have. Cells answered in dataSource will be forced to have this height number... We force it instead allowing lists to have any height because the logic to calculate rows becomes complicated. Possible, but complicated :)"
^ rowHeight ifNil: [ self class defaultRowHeight ]
Esteban two questions:
- when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
- if I were about to manage the height of a row based on its actual contents where should I put it. FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed?
Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font. I still did not get where the strings built.
may be here
updateExposedRows
...
| cell | cell := (self owner dataSource cellColumn: (columns at: columnIndex) row: rowIndex). cell width: (columnWidths at: columnIndex).
We should add more comments to methods.
Stef
drawOn: canvas | x y cellWidth cellHeight rowsToDisplay rowSubviews highligtedRowIndexes primarySelectionIndex |
self bounds ifNil: [ ^ self ]. "Nothing to show yet" self owner ifNil: [ ^ self ].
x := self left + self class rowLeftMargin. y := self top. cellWidth := self width - self class rowLeftMargin. cellHeight := self owner rowHeight. ^^^^^^^^^^^^^^^^^^^^^^^
highligtedRowIndexes := self owner selectedRowIndexes, self owner highlightedRowIndexes. primarySelectionIndex := self owner selectedRowIndex.
"For some superweird reason, calling #calculateExposedRows here instead in #changed (where it should be called) is 10x faster. Since the whole purpose of this component is speed, for now I'm calling it here and adding the #setNeedRecalculateRows mechanism. History, please forgive me." self updateAllRows.
rowsToDisplay := self exposedRows. rowSubviews := OrderedCollection new: rowsToDisplay size + 1. headerRow ifNotNil: [ headerRow bounds: (x@y extent: cellWidth@cellHeight). y := y + cellHeight + self owner intercellSpacing. rowSubviews add: headerRow ].
rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | visibleHeight := cellHeight min: (self bottom - y). row bounds: (x@y extent: cellWidth@visibleHeight). y := y + visibleHeight + self owner intercellSpacing. rowSubviews add: ((highligtedRowIndexes includes: rowIndex) ifTrue: [ "IMPORTANT: I need to set owner to nil because otherwise it will trigger an invalidation of the owner when adding morph to selectionMorph, causing an infinite loop" self toSelectionRow: (row privateOwner: nil) primary: primarySelectionIndex = rowIndex ] ifFalse: [ row ]) ].
submorphs := rowSubviews asArray. super drawOn: canvas. needsRefreshExposedRows := false
If you load the development version of FT it will be fine normally :) Maybe not perfect for now but usable with large fonts. (You have to close and reopen the existing FT if you change font size because the change is hard coded and not announce). I adapted also the FTFastTableComposer so that it manage the font size. -- Cyril Ferlicot http://www.synectique.eu 165 Avenue Bretagne Lille 59000 France
On 20 Oct 2015, at 18:47, Ferlicot D. Cyril <cyril.ferlicot@gmail.com> wrote:
Le 20/10/2015 18:42, stepharo a écrit :
for the mooc videos I must use larger fonts. So I ended up hacking and changing the hardcoded number in default
defaultRowHeight ^ 24
rowHeight "This is the row height your rows will have. Cells answered in dataSource will be forced to have this height number... We force it instead allowing lists to have any height because the logic to calculate rows becomes complicated. Possible, but complicated :)"
^ rowHeight ifNil: [ self class defaultRowHeight ]
Esteban two questions:
- when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
- if I were about to manage the height of a row based on its actual contents where should I put it. FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed?
Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font. I still did not get where the strings built.
may be here
updateExposedRows
...
| cell | cell := (self owner dataSource cellColumn: (columns at: columnIndex) row: rowIndex). cell width: (columnWidths at: columnIndex).
We should add more comments to methods.
Stef
drawOn: canvas | x y cellWidth cellHeight rowsToDisplay rowSubviews highligtedRowIndexes primarySelectionIndex |
self bounds ifNil: [ ^ self ]. "Nothing to show yet" self owner ifNil: [ ^ self ].
x := self left + self class rowLeftMargin. y := self top. cellWidth := self width - self class rowLeftMargin. cellHeight := self owner rowHeight. ^^^^^^^^^^^^^^^^^^^^^^^
highligtedRowIndexes := self owner selectedRowIndexes, self owner highlightedRowIndexes. primarySelectionIndex := self owner selectedRowIndex.
"For some superweird reason, calling #calculateExposedRows here instead in #changed (where it should be called) is 10x faster. Since the whole purpose of this component is speed, for now I'm calling it here and adding the #setNeedRecalculateRows mechanism. History, please forgive me." self updateAllRows.
rowsToDisplay := self exposedRows. rowSubviews := OrderedCollection new: rowsToDisplay size + 1. headerRow ifNotNil: [ headerRow bounds: (x@y extent: cellWidth@cellHeight). y := y + cellHeight + self owner intercellSpacing. rowSubviews add: headerRow ].
rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | visibleHeight := cellHeight min: (self bottom - y). row bounds: (x@y extent: cellWidth@visibleHeight). y := y + visibleHeight + self owner intercellSpacing. rowSubviews add: ((highligtedRowIndexes includes: rowIndex) ifTrue: [ "IMPORTANT: I need to set owner to nil because otherwise it will trigger an invalidation of the owner when adding morph to selectionMorph, causing an infinite loop" self toSelectionRow: (row privateOwner: nil) primary: primarySelectionIndex = rowIndex ] ifFalse: [ row ]) ].
submorphs := rowSubviews asArray. super drawOn: canvas. needsRefreshExposedRows := false
If you load the development version of FT it will be fine normally :) Maybe not perfect for now but usable with large fonts. (You have to close and reopen the existing FT if you change font size because the change is hard coded and not announce).
I adapted also the FTFastTableComposer so that it manage the font size.
I thought we were removing FTFastTableComposer, as is not such a great idea. Esteban
-- Cyril Ferlicot
165 Avenue Bretagne Lille 59000 France
We will at least keep it for Synectique in order to have a widget with an action button for now. I don't think you want an action button to be integrated inside the FTTableMorph ? When we will integrate the next configuration of FT into Pharo I will remove it from the FastTable package. On Thu, Oct 22, 2015 at 8:55 AM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I thought we were removing FTFastTableComposer, as is not such a great idea.
Esteban
-- Cheers Cyril Ferlicot
On 22 Oct 2015, at 09:09, Cyril Ferlicot <cyril.ferlicot@gmail.com> wrote:
We will at least keep it for Synectique in order to have a widget with an action button for now.
I do not want it in the main distribution :S As we talked, for me correct way to implement such behaviour is: - Transmit to FTSearchFunction creation of search field (or filter, FTSearchFunction should be split in FTSearchFunction and FTFilterFunction in a hierarchy). - Then you can implement a child of FTFilterFunction⦠like âFTActionFilterFunctionâ who adds the action buttons you want. no composed blabla! Esteban
I don't think you want an action button to be integrated inside the FTTableMorph ?
When we will integrate the next configuration of FT into Pharo I will remove it from the FastTable package.
On Thu, Oct 22, 2015 at 8:55 AM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I thought we were removing FTFastTableComposer, as is not such a great idea.
Esteban
-- Cheers Cyril Ferlicot
Excellent How did you do it? Le 20/10/15 18:47, Ferlicot D. Cyril a écrit :
Le 20/10/2015 18:42, stepharo a écrit :
for the mooc videos I must use larger fonts. So I ended up hacking and changing the hardcoded number in default
defaultRowHeight ^ 24
rowHeight "This is the row height your rows will have. Cells answered in dataSource will be forced to have this height number... We force it instead allowing lists to have any height because the logic to calculate rows becomes complicated. Possible, but complicated :)"
^ rowHeight ifNil: [ self class defaultRowHeight ]
Esteban two questions:
- when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
- if I were about to manage the height of a row based on its actual contents where should I put it. FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed?
Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font. I still did not get where the strings built.
may be here
updateExposedRows
...
| cell | cell := (self owner dataSource cellColumn: (columns at: columnIndex) row: rowIndex). cell width: (columnWidths at: columnIndex).
We should add more comments to methods.
Stef
drawOn: canvas | x y cellWidth cellHeight rowsToDisplay rowSubviews highligtedRowIndexes primarySelectionIndex |
self bounds ifNil: [ ^ self ]. "Nothing to show yet" self owner ifNil: [ ^ self ].
x := self left + self class rowLeftMargin. y := self top. cellWidth := self width - self class rowLeftMargin. cellHeight := self owner rowHeight. ^^^^^^^^^^^^^^^^^^^^^^^
highligtedRowIndexes := self owner selectedRowIndexes, self owner highlightedRowIndexes. primarySelectionIndex := self owner selectedRowIndex.
"For some superweird reason, calling #calculateExposedRows here instead in #changed (where it should be called) is 10x faster. Since the whole purpose of this component is speed, for now I'm calling it here and adding the #setNeedRecalculateRows mechanism. History, please forgive me." self updateAllRows.
rowsToDisplay := self exposedRows. rowSubviews := OrderedCollection new: rowsToDisplay size + 1. headerRow ifNotNil: [ headerRow bounds: (x@y extent: cellWidth@cellHeight). y := y + cellHeight + self owner intercellSpacing. rowSubviews add: headerRow ].
rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | visibleHeight := cellHeight min: (self bottom - y). row bounds: (x@y extent: cellWidth@visibleHeight). y := y + visibleHeight + self owner intercellSpacing. rowSubviews add: ((highligtedRowIndexes includes: rowIndex) ifTrue: [ "IMPORTANT: I need to set owner to nil because otherwise it will trigger an invalidation of the owner when adding morph to selectionMorph, causing an infinite loop" self toSelectionRow: (row privateOwner: nil) primary: primarySelectionIndex = rowIndex ] ifFalse: [ row ]) ].
submorphs := rowSubviews asArray. super drawOn: canvas. needsRefreshExposedRows := false
If you load the development version of FT it will be fine normally :) Maybe not perfect for now but usable with large fonts. (You have to close and reopen the existing FT if you change font size because the change is hard coded and not announce).
I adapted also the FTFastTableComposer so that it manage the font size.
For now On Thu, Oct 22, 2015 at 8:57 AM, stepharo <stepharo@free.fr> wrote:
Excellent
How did you do it?
I removed the hardcode value of the default row height in order use the size of the default font. "StandardFont defaultfont pixelSize" or something like that. (Can't check now). But as Esteban said this is maybe not the best solution since a FT can store something else than a string. -- Cheers Cyril Ferlicot
On 22 Oct 2015, at 09:13, Cyril Ferlicot <cyril.ferlicot@gmail.com> wrote:
For now
On Thu, Oct 22, 2015 at 8:57 AM, stepharo <stepharo@free.fr> wrote:
Excellent
How did you do it?
I removed the hardcode value of the default row height in order use the size of the default font. "StandardFont defaultfont pixelSize" or something like that. (Can't check now). But as Esteban said this is maybe not the best solution since a FT can store something else than a string.
Yes⦠this *has* to be transmitted to the data source. Just there you can know how to calculate height. Esteban
-- Cheers Cyril Ferlicot
Le 26/10/2015 11:37, Esteban Lorenzano a écrit :
On 22 Oct 2015, at 09:13, Cyril Ferlicot <cyril.ferlicot@gmail.com> wrote:
For now
On Thu, Oct 22, 2015 at 8:57 AM, stepharo <stepharo@free.fr> wrote:
Excellent
How did you do it?
I removed the hardcode value of the default row height in order use the size of the default font. "StandardFont defaultfont pixelSize" or something like that. (Can't check now). But as Esteban said this is maybe not the best solution since a FT can store something else than a string.
Yes⦠this *has* to be transmitted to the data source. Just there you can know how to calculate height.
I have a nagging feeling that basing FT on the knowledge of all rows height is not scalable for very large datasources. I'll let you try and see where you end up ;) Thierry
On 26 Oct 2015, at 14:05, Thierry Goubier <thierry.goubier@gmail.com> wrote:
Le 26/10/2015 11:37, Esteban Lorenzano a écrit :
On 22 Oct 2015, at 09:13, Cyril Ferlicot <cyril.ferlicot@gmail.com> wrote:
For now
On Thu, Oct 22, 2015 at 8:57 AM, stepharo <stepharo@free.fr> wrote:
Excellent
How did you do it?
I removed the hardcode value of the default row height in order use the size of the default font. "StandardFont defaultfont pixelSize" or something like that. (Can't check now). But as Esteban said this is maybe not the best solution since a FT can store something else than a string.
Yes⦠this *has* to be transmitted to the data source. Just there you can know how to calculate height.
I have a nagging feeling that basing FT on the knowledge of all rows height is not scalable for very large datasources.
I have the same feeling, thatâs why I put it out at the first time⦠at first moment, datasource should answer a constant, not a variable size (FT does not know what to do with them right now). But then, is a good place to start doing experiments :) Esteban
I'll let you try and see where you end up ;)
Thierry
Le 26/10/2015 14:09, Esteban Lorenzano a écrit :
On 26 Oct 2015, at 14:05, Thierry Goubier <thierry.goubier@gmail.com <mailto:thierry.goubier@gmail.com>> wrote:
Le 26/10/2015 11:37, Esteban Lorenzano a écrit :
On 22 Oct 2015, at 09:13, Cyril Ferlicot <cyril.ferlicot@gmail.com <mailto:cyril.ferlicot@gmail.com>> wrote:
For now
On Thu, Oct 22, 2015 at 8:57 AM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Excellent
How did you do it?
I removed the hardcode value of the default row height in order use the size of the default font. "StandardFont defaultfont pixelSize" or something like that. (Can't check now). But as Esteban said this is maybe not the best solution since a FT can store something else than a string.
Yes⦠this *has* to be transmitted to the data source. Just there you can know how to calculate height.
I have a nagging feeling that basing FT on the knowledge of all rows height is not scalable for very large datasources.
I have the same feeling, thatâs why I put it out at the first time⦠at first moment, datasource should answer a constant, not a variable size (FT does not know what to do with them right now).
But then, is a good place to start doing experiments :)
Yes, the FT core code is a very interesting base to work on. I can highly recommend what you did there :) Thierry
Hi, Sorry late response but yesterday I was not around.
On 20 Oct 2015, at 18:42, stepharo <stepharo@free.fr> wrote:
for the mooc videos I must use larger fonts. So I ended up hacking and changing the hardcoded number in default
defaultRowHeight ^ 24
rowHeight "This is the row height your rows will have. Cells answered in dataSource will be forced to have this height number... We force it instead allowing lists to have any height because the logic to calculate rows becomes complicated. Possible, but complicated :)"
^ rowHeight ifNil: [ self class defaultRowHeight ]
Esteban two questions:
- when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
this is not a question :) in the case of rowHeight, it determines how the row looks (and not what it shows) then is UI (IMO)⦠anyway Iâm aware this is not 100% MVC but knowing the height of rows is very important to calculate in a fast way how many rows fit and get the rows from datasource (an operation that happens a lot so is convenient to have it as fast as possible (at least in a âfast tableâ). this do not supports variable height but that can be achieved by extending the table without compromising the performance of the parent(just very few use-cases need a variable height table).
- if I were about to manage the height of a row based on its actual contents where should I put it.
as described, you need to extend the functionality, this is not supported in current version (reason already explained). For me, to support this you need to extend: - rowHeight should be rowHeightFor: index - visibleRows and around need to take first visible row height, then iterate one by one asking for the each row size. - datasource needs to be extended with ârowHeight: indexâ
FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed?
explained above: speed needs.
Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font. I still did not get where the strings built.
I didnât thought about, thatâs why is not calculating font size :) Also⦠I cannot know your table will contain text⦠thatâs a task for the datasource, then (to answer appropriate row height)⦠but it needs to be fast! :) Esteban
may be here
updateExposedRows
...
| cell | cell := (self owner dataSource cellColumn: (columns at: columnIndex) row: rowIndex). cell width: (columnWidths at: columnIndex).
We should add more comments to methods.
Stef
drawOn: canvas | x y cellWidth cellHeight rowsToDisplay rowSubviews highligtedRowIndexes primarySelectionIndex |
self bounds ifNil: [ ^ self ]. "Nothing to show yet" self owner ifNil: [ ^ self ].
x := self left + self class rowLeftMargin. y := self top. cellWidth := self width - self class rowLeftMargin. cellHeight := self owner rowHeight. ^^^^^^^^^^^^^^^^^^^^^^^
highligtedRowIndexes := self owner selectedRowIndexes, self owner highlightedRowIndexes. primarySelectionIndex := self owner selectedRowIndex.
"For some superweird reason, calling #calculateExposedRows here instead in #changed (where it should be called) is 10x faster. Since the whole purpose of this component is speed, for now I'm calling it here and adding the #setNeedRecalculateRows mechanism. History, please forgive me." self updateAllRows.
rowsToDisplay := self exposedRows. rowSubviews := OrderedCollection new: rowsToDisplay size + 1. headerRow ifNotNil: [ headerRow bounds: (x@y extent: cellWidth@cellHeight). y := y + cellHeight + self owner intercellSpacing. rowSubviews add: headerRow ].
rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | visibleHeight := cellHeight min: (self bottom - y). row bounds: (x@y extent: cellWidth@visibleHeight). y := y + visibleHeight + self owner intercellSpacing. rowSubviews add: ((highligtedRowIndexes includes: rowIndex) ifTrue: [ "IMPORTANT: I need to set owner to nil because otherwise it will trigger an invalidation of the owner when adding morph to selectionMorph, causing an infinite loop" self toSelectionRow: (row privateOwner: nil) primary: primarySelectionIndex = rowIndex ] ifFalse: [ row ]) ].
submorphs := rowSubviews asArray. super drawOn: canvas. needsRefreshExposedRows := false
- when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
this is not a question :)
I know it was more a general feeling that I wanted to share with you
in the case of rowHeight, it determines how the row looks (and not what it shows) then is UI (IMO)⦠anyway Iâm aware this is not 100% MVC but knowing the height of rows is very important to calculate in a fast way how many rows fit and get the rows from datasource (an operation that happens a lot so is convenient to have it as fast as possible (at least in a âfast tableâ). this do not supports variable height but that can be achieved by extending the table without compromising the performance of the parent(just very few use-cases need a variable height table).
So it means that you could get a default for the first computation = for exemple it tells you that you will have 2- rows then for the displays you could use the real size of each rows and the default row is smaller than the actual size then this is not a problem because you will get less rows.
- if I were about to manage the height of a row based on its actual contents where should I put it. as described, you need to extend the functionality, this is not supported in current version (reason already explained). For me, to support this you need to extend:
- rowHeight should be rowHeightFor: index - visibleRows and around need to take first visible row height, then iterate one by one asking for the each row size. - datasource needs to be extended with ârowHeight: indexâ Yes.
FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed? explained above: speed needs.
Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font. I still did not get where the strings built. I didnât thought about, thatâs why is not calculating font size :) Also⦠I cannot know your table will contain text⦠thatâs a task for the datasource, then (to answer appropriate row height)⦠but it needs to be fast! :)
:)
2015-10-22 8:54 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
Hi,
Sorry late response but yesterday I was not around.
On 20 Oct 2015, at 18:42, stepharo <stepharo@free.fr> wrote:
for the mooc videos I must use larger fonts. So I ended up hacking and changing the hardcoded number in default
defaultRowHeight ^ 24
rowHeight "This is the row height your rows will have. Cells answered in dataSource will be forced to have this height number... We force it instead allowing lists to have any height because the logic to calculate rows becomes complicated. Possible, but complicated :)"
^ rowHeight ifNil: [ self class defaultRowHeight ]
Esteban two questions:
- when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
this is not a question :) in the case of rowHeight, it determines how the row looks (and not what it shows) then is UI (IMO)⦠anyway Iâm aware this is not 100% MVC but knowing the height of rows is very important to calculate in a fast way how many rows fit and get the rows from datasource (an operation that happens a lot so is convenient to have it as fast as possible (at least in a âfast tableâ). this do not supports variable height but that can be achieved by extending the table without compromising the performance of the parent(just very few use-cases need a variable height table).
Hum, from practical results playing with the FastTable core code: - With varying height, if you know the start index, then you can fill the container fast by streaming over the data source, building the row morphs and adding the heights, stopping when you reach the end of the container. - Current FastTable core code is very inefficient if #at: is slow on the data source - What is hard is getting the vertical scrollbar right. - Current FastTable core code does multiple passes on some of the row building / coordinates stuff for no clear reasons.
- if I were about to manage the height of a row based on its actual
contents where should I put it.
as described, you need to extend the functionality, this is not supported in current version (reason already explained). For me, to support this you need to extend:
- rowHeight should be rowHeightFor: index - visibleRows and around need to take first visible row height, then iterate one by one asking for the each row size. - datasource needs to be extended with ârowHeight: indexâ
It is not the only way to do it. It at: is slow on the data source, then rowheight: will be slow.
FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed?
explained above: speed needs.
Why the ContainerMorph does not ask the FTTableRowMorph for its height
and it could be computed based on the font.
I still did not get where the strings built.
I didnât thought about, thatâs why is not calculating font size :) Also⦠I cannot know your table will contain text⦠thatâs a task for the datasource, then (to answer appropriate row height)⦠but it needs to be fast! :)
Thierry
Esteban
may be here
updateExposedRows
...
| cell | cell := (self owner dataSource cellColumn: (columns at: columnIndex) row: rowIndex). cell width: (columnWidths at: columnIndex).
We should add more comments to methods.
Stef
drawOn: canvas | x y cellWidth cellHeight rowsToDisplay rowSubviews
highligtedRowIndexes primarySelectionIndex |
self bounds ifNil: [ ^ self ]. "Nothing to show yet" self owner ifNil: [ ^ self ].
x := self left + self class rowLeftMargin. y := self top. cellWidth := self width - self class rowLeftMargin. cellHeight := self owner rowHeight. ^^^^^^^^^^^^^^^^^^^^^^^
highligtedRowIndexes := self owner selectedRowIndexes, self owner highlightedRowIndexes. primarySelectionIndex := self owner selectedRowIndex.
"For some superweird reason, calling #calculateExposedRows here
instead in #changed (where
it should be called) is 10x faster. Since the whole purpose of this
component is speed, for
now I'm calling it here and adding the #setNeedRecalculateRows
mechanism.
History, please forgive me." self updateAllRows.
rowsToDisplay := self exposedRows. rowSubviews := OrderedCollection new: rowsToDisplay size + 1. headerRow ifNotNil: [ headerRow bounds: (x@y extent: cellWidth@cellHeight). y := y + cellHeight + self owner intercellSpacing. rowSubviews add: headerRow ].
rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight | visibleHeight := cellHeight min: (self bottom - y). row bounds: (x@y extent: cellWidth@visibleHeight). y := y + visibleHeight + self owner intercellSpacing. rowSubviews add: ((highligtedRowIndexes includes: rowIndex) ifTrue: [ "IMPORTANT: I need to set owner to nil because otherwise
it will trigger an
invalidation of the owner when adding morph to
selectionMorph, causing an
infinite loop" self toSelectionRow: (row privateOwner: nil) primary: primarySelectionIndex = rowIndex ] ifFalse: [ row ]) ].
submorphs := rowSubviews asArray. super drawOn: canvas. needsRefreshExposedRows := false
participants (5)
-
Cyril Ferlicot -
Esteban Lorenzano -
Ferlicot D. Cyril -
stepharo -
Thierry Goubier