Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8311127

Regression: The fix for TableView and TreeTableView menu button affects all table column headers

XMLWordPrintable

    • b03
    • b26

        After JDK-8087673, the fix to take into account the width of the menu button applies to _all_ the TableColumnHeaders, while it should only be applied to the header of the last visible column.

        TableHeaderRow::updateCornerPadding already mentions:

            // When the corner region is visible, and the vertical scrollbar is not,
            // in case the corner region is over the header of the last
            // visible column, if any, we have to consider its width as extra padding
            // for that header, to prevent the content of the latter from being partially
            // covered.

        so the padding for the tableHeaderRow is calculated based on the last visible column:

        padding = getRootHeader().getColumnHeaders().stream()
                            .filter(header -> header.isLastVisibleColumn)
        ...
        cornerPadding.set(padding);

        While this is correct, in TableColumnHeader::layoutChildren the width of _every_ header is calculated based on this padding:

                double cornerRegionPadding = tableHeaderRow == null ? 0.0 : tableHeaderRow.cornerPadding.get();
                double w = snapSizeX(getWidth()) - (snappedLeftInset() + snappedRightInset()) - cornerRegionPadding;

        which is wrong for every header but the one from the last visible column.

        In fact, the pics in the PR description (https://github.com/openjdk/jfx/pull/886#issue-1354147047) already show this issue, if one looks carefully:

        - before.png: Before the fix, columns 5-8 headers have some padding to the left (expected), and column 9 is wrong (arrow is not visible).

        - after.png: After the fix, headers of columns 5-8 have way less padding to the left (wrong!), and column 9 is fixed (arrow is visible).

        This issue can be reproduced always since JavaFX 20 (and also since 17.0.7).

          1. after.png
            209 kB
            Jose Pereda
          2. before.png
            209 kB
            Jose Pereda

              jpereda Jose Pereda
              jpereda Jose Pereda
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: