<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I agree, I implemented something similar already. I will share it here right away, up for discussion if this is worth to add. :)</div>

<div> </div>

<div>In (Tree)TableView:</div>

<div>
<pre>setCellSizeProvider(ToDoubleFunction<S> cellSizeProvider)</pre>

<div>In (Tree)TableRow:</div>

<pre>ToDoubleFunction<S> cellSizeProvider = tableView.getCellSizeProvider()
double cellSize = cellSizeProvider.applyAsDouble(getSkinnable().getItem());</pre>
which is then used as min, pref and max height, like the fixed cell size.<br/>
The advantage here is, that the row does not need to calculate the height of all cells in order to get the max height, instead we ask the cell size provider directly.<br/>
And I think most of the times developers know the expected height for a particular item S. <br/>
In my case I needed it because my entity should show a list of strings. Therefore my cell size provider was as simple as:
<pre>setCellSizeProvider(item -> item.getStrings().size() * 24)
</pre>

<div>If I have one string in the list, the cell size is 24. If two, it's 48 and so on.</div>

<div><br/>
>From here on, we can probably also optimize the VirtualFlow to not take the cell bounds but ask the cell size provider as well. <br/>
VirtualFlow is index based, but pretty sure we can find a nice way to implement this still.</div>

<div> </div>

<div>What this implementation can not fix is if the size is not known by the developer or changed in the updateItem(...) method.</div>

<div> </div>

<div>-- Marius</div>
</div>

<div>
<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Dienstag, 22. November 2022 um 11:44 Uhr<br/>
<b>Von:</b> "Dirk Lemmermann" <dlemmermann@gmail.com><br/>
<b>An:</b> "Johan Vos" <johan.vos@gluonhq.com>, "openjfx-dev" <openjfx-dev@openjdk.org><br/>
<b>Betreff:</b> Re: Virtual Flow enhancements</div>

<div name="quoted-content">
<div>Food for thought: something that might be nice to have could be a separate model that tells the VirtualFlows what the row heights are. In FlexGanttFX the height of each row is explicitly controlled by a heightProperty() of a “row" class and not by calculation. E.g. VirtualFlow.setHeightProvider(...) or (to support vertical and horizontal flows) VirtualFlow.setSizeProvider(…). This could then be used to pre-populate the size cache. If your application stays the in the range of hundreds of rows this could work pretty fast. 
<div> 
<blockquote>
<div>On 28 Oct 2022, at 14:43, Dirk Lemmermann <dlemmermann@gmail.com> wrote:</div>
 

<div>
<div>Looks like I missed this last replay from Johan. In my last email I was referring to a work-around where one VirtualFlow gets repositioned via scrollTo() method calls in response to changes in the other VirtualFlow. Not only are the rows alignments way off but updates are lagging behind.
<div> </div>

<div>But let’s leave that behind for now and let’s try to find an existing property that would make our use-case work again.
<div> </div>

<div>For the “FlexGanttFX” use-case where I need to syncronize  the scrolling of a TreeTableView and a ListView I would love to be able to simply bind the “position” properties of those two controls with each other. That feels very intuitive to me. If both controls have the same number of rows and each row’s height matches the row’s height in the other control then this should work, but currently it does not. </div>

<div> </div>

<div>The “position” property gets updated by the VirtualFlow. When the flow sets this property to a certain value then I would hope setting the same value from outside would place the virtual flow at the exact same position. Basically I am hoping that this is a bijective mapping but it is not …. unless … the user scrolled all the way down in both views. Then it becomes a bijective mapping. So I guess after having made all rows visible the calculations are based on hard facts (as in “actual row height”) and not on estimates.</div>

<div> </div>

<div>To summarise the requirement: there should be a way to bind a property of VirtualFlow so that two instances with the same content can be scrolled in sync (content = same rows with same heights resulting in same total virtual height).</div>

<div> </div>

<div>Dirk</div>
</div>

<div> 
<blockquote>
<div>On 15 Sep 2022, at 21:20, Johan Vos <<a href="mailto:johan.vos@gluonhq.com" onclick="parent.window.location.href='mailto:johan.vos@gluonhq.com'; return false;" target="_blank">johan.vos@gluonhq.com</a>> wrote:</div>
 

<div>
<div>
<div> </div>
 

<div class="gmail_quote">
<div class="gmail_attr">On Wed, Sep 14, 2022 at 12:19 PM Dirk Lemmermann <<a href="mailto:dlemmermann@gmail.com" onclick="parent.window.location.href='mailto:dlemmermann@gmail.com'; return false;" target="_blank">dlemmermann@gmail.com</a>> wrote:</div>

<blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;">Hi,<br/>
<br/>
<br/>
FlexGanttFX used to make this work via bidirectional bindings of the properties of the vertical scrollbars of both VirtualFlows. With the latest fixes to the VirtualFlow the assumption that two identically populated VirtualFlows would provide identical values to the ScrollBar properties is no longer true. The attempt to bind the “position” property also failed and a work-around that Johan provided also has not been successful, yet (a customer of mine is still evaluating it).</blockquote>

<div> </div>

<div>I don't know what work-around you refer to, but I often point to public methods in VirtualFlow that, when properly combined, allow many usecases. I sometimes see code where the information about the positioning of elements in the VirtualFlow is obtained via the position of the scrollbar thumb, which seems a really odd way to get this info (and especially unreliable as the relation with the real positioning of cells is unspecified). There are other methods on VirtualFlow that imho are better suited for getting/setting information. </div>

<div>What I want to avoid is that we have 2 API's that almost achieve the same. Hence, before considering a new method or property, I think we should make sure that there is currently no existing (documented) way to achieve it. I am pretty sure there are cases that can not be solved with the existing set of API's, and those cases are exactly what I'm looking for.</div>

<div> </div>

<div>- Johan</div>

<div> </div>

<div> </div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>