RFR: 8325154: resizeColumnToFitContent is slower than it needs to be
Marius Hanl
mhanl at openjdk.org
Wed Feb 7 10:48:04 UTC 2024
On Wed, 7 Feb 2024 09:59:45 GMT, Robert Lichtenberger <rlichten at openjdk.org> wrote:
>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableColumnHeader.java line 670:
>>
>>> 668: cell.updateTableRow(tableRow);
>>> 669: cell.updateIndex(row);
>>> 670:
>>
>> we could also check if we need/can call `tableRow.applyCss();` just only one time (below) (e.g. at first?),
>> May works and improve performance, or may not work
>
> That doesn't work unfortunately. I tried this:
>
> boolean tableRowHasCss = false;
> for (int row = 0; row < rows; row++) {
> tableRow.updateIndex(row);
> cell.updateIndex(row);
>
> if ((cell.getText() != null && !cell.getText().isEmpty()) || cell.getGraphic() != null) {
> if (!tableRowHasCss) {
> tableRow.applyCss();
> tableRowHasCss = true;
> }
> maxWidth = Math.max(maxWidth, cell.prefWidth(-1));
> }
> }
>
> but if you have a table with this css:
>
> .oddbig .table-row-cell:odd{
> -fx-font-size: 36;
> }
>
>
> Then only the css of the first row will be taken into account, i.e. the column wont size correctly.
> I've recorded a little video of the effect at https://youtu.be/-p0pv-i4K2s
Thanks for checking!
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1358#discussion_r1481278071
More information about the openjfx-dev
mailing list