-
Bug
-
Resolution: Fixed
-
P3
-
jfx20, jfx17.0.7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8315802 | jfx17.0.9 | Jose Pereda | P3 | Resolved | Fixed | b03 |
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).
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).
- backported by
-
JDK-8315802 Regression: The fix for TableView and TreeTableView menu button affects all table column headers
- Resolved
- relates to
-
JDK-8087673 [TableView] TableView and TreeTableView menu button overlaps columns when using a constrained resize policy.
- Resolved
- links to
-
Commit openjdk/jfx17u/21a08a84
-
Commit openjdk/jfx/5aad0406
-
Review openjdk/jfx17u/162
-
Review openjdk/jfx/1166
(1 links to)