RFR: 8293119: Additional constrained resize policies for Tree/TableView [v30]
Karthik P K
kpk at openjdk.org
Thu Jan 5 17:18:59 UTC 2023
On Wed, 4 Jan 2023 22:24:30 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> The current CONSTRAINED_RESIZE_POLICY has a number of issues as explained in [JDK-8292810](https://bugs.openjdk.org/browse/JDK-8292810).
>>
>> We propose to address all these issues by replacing the old column resize algorithm with a different one, which not only honors all the constraints when resizing, but also provides 4 different resize modes similar to JTable's. The new implementation brings changes to the public API for Tree/TableView and ResizeFeaturesBase classes. Specifically:
>>
>> - create a public abstract javafx.scene.control.ConstrainedColumnResizeBase class
>> - provide an out-of-the box implementation via javafx.scene.control.ConstrainedColumnResize class, offeting 4 resize modes: AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_SUBSEQUENT_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS
>> - add corresponding public static constants to Tree/TableView
>> - make Tree/TableView.CONSTRAINED_RESIZE_POLICY an alias to AUTO_RESIZE_SUBSEQUENT_COLUMNS (a slight behavioral change - discuss)
>> - add getContentWidth() and setColumnWidth(TableColumnBase<S,?> col, double width) methods to ResizeFeatureBase
>> - suppress the horizontal scroll bar when resize policy is instanceof ConstrainedColumnResizeBase
>> - update javadoc
>>
>>
>> Notes
>>
>> 1. The current resize policies' toString() methods return "unconstrained-resize" and "constrained-resize", used by the skin base to set a pseudostate. All constrained policies that extend ConstrainedColumnResizeBase will return "constrained-resize" value.
>> 2. The reason an abstract class ( ConstrainedColumnResizeBase) was chosen instead of a marker interface is exactly for its toString() method which supplies "constrained-resize" value. The implementors might choose to use a different value, however they must ensure the stylesheet contains the same adjustments for the new policy as those made in modena.css for "constrained-resize" value.
>
> Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 99 commits:
>
> - Merge remote-tracking branch 'origin/master' into 8293119.constrained
> - width indicator in tester
> - 2023
> - 2023
> - small delta
> - whitespace
> - whitespace
> - Merge remote-tracking branch 'origin/master' into 8293119.constrained
> - shrink small
> - snap after resize
> - ... and 89 more: https://git.openjdk.org/jfx/compare/94fb7ede...e09246a3
I'm also seeing the mouse cursor tracking issue mentioned by Kevin while dragging the column divider.
I wanted to check about following behavior.
When AUTO_RESIZE_FLEX_LAST_COLUMN policy and pref only data are selected, column divider between C1 and C2 is dragged to the right. C4 size will be reduced first and reaches minimum. Then C3 and C2 column size reduces.
After all the 3 columns reach minimum width, if same divider is dragged to the left , C4 gets expanded first, then C3 and C2.
Where as in AUTO_RESIZE_ALL_COLUMNS policy, the column whose width was reduced last gets expanded first. Should we keep the behavior consistent across all policies?
The behavior in CONSTRAINED_RESIZE_POLICY is same as FLEX policies.
I ran these test in Windows 11 system. I will try to do some more testing on the same machine.
-------------
PR: https://git.openjdk.org/jfx/pull/897
More information about the openjfx-dev
mailing list