RFR: 8299753: Tree/TableView: Column Resizing With Fractional Scale [v7]

Kevin Rushforth kcr at openjdk.org
Wed Jan 29 21:46:00 UTC 2025


On Wed, 5 Jul 2023 16:53:41 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/ResizeHelper.java line 77:
>> 
>>> 75:                 double cmin = snapCeil(c.getMinWidth()); // always honor min width!
>>> 76:                 double cmax = snapFloor(c.getMaxWidth()); // TableColumnBase.doSetWidth() clamps to (min,max) range
>>> 77:                 min[i] = cmin;
>> 
>> Looking at `doSetWidth` I see that it clamps using unsnapped values, so the column can still be given an unsnapped size.  When scale is 1.0, and the column for example has its min/max width set to 20.1 and 20.9, then snapCeil is 21 and snapFloor is 20 (so maximum is less than minimum, which may already be a bit dubious).  When `doSetWidth` is called it will be clamped, resulting in `20.1` or `20.9`.
>
> For some reason, I've decided to leave that as is, but since you pointed it out, I think it ought to be fixed. 
> 
> I am going to implement proper snapping logic in ResizeFeaturesBase.setColumnWidth() using private APIs, with the intent to eventually convert them to public APIs with https://bugs.openjdk.org/browse/JDK-8311527

As with my earlier comment in `ResizeFeaturesBase` (which you  fixed), I don't think we should be using different snapping functions for min and max. I recommend `snapCeil` for  both.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1156#discussion_r1934655915


More information about the openjfx-dev mailing list