RFR: 8089280: horizontal scrollbar should never become visible in TableView with constrained resize policy [v2]

Kevin Rushforth kcr at openjdk.org
Sat Sep 10 15:18:54 UTC 2022


On Fri, 9 Sep 2022 22:00:39 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Modified the tree/table view internals to suppress the horizontal (a.k.a. breadth in VirtualFlow) scroll bar when a constrained resize mode is in effect.  This change complements fixes added in [JDK-8089009](https://bugs.openjdk.org/browse/JDK-8089009) without addressing other bugs found in https://bugs.openjdk.org/browse/JDK-8292810
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8089280: added tests

The fix looks good to me. I verified that the new tests fail without the fix and pass with the fix. I was also able to reproduce the problem using the [HorizontalConstrainedTableScrollingMin test](https://bugs.openjdk.org/browse/JDK-8089280?focusedCommentId=14521664&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14521664) from the bug report without the fix, and verified that it works as expected with the fix.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableSkinUtils.java line 215:

> 213:     public static boolean isConstrainedResizePolicy(Callback<? extends ResizeFeaturesBase,Boolean> x) {
> 214:         return (x == (Object)TableView.CONSTRAINED_RESIZE_POLICY) ||
> 215:                (x == (Object)TreeTableView.CONSTRAINED_RESIZE_POLICY);

Is the cast to `(Object)` needed?

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 307:

> 305:     private boolean needLengthBar;
> 306:     private boolean tempVisibility = false;
> 307:     private boolean suppressBreadthBar;

Suggestion (optional) : You might want to explicitly initialize this to `false`, since we rely on this for other controls (e.g., `ListView`) which don't call `setSuppressBreadthBar`. (yes, I know Java will initialize it to false anyway, but setting it explicitly could be helpful to a reader of the code)

-------------

Marked as reviewed by kcr (Lead).

PR: https://git.openjdk.org/jfx/pull/894


More information about the openjfx-dev mailing list