Let's discuss JDK-8338952
Andy Goryachev
andy.goryachev at oracle.com
Mon May 19 19:28:21 UTC 2025
One possible solution would be to deprecate the comparator property (not for removal, keep it for backward compatibility), and add a new property 'sortPolicy' which will use an interface that can be evolved, as opposed to a naive callback.
public interface SortPolicy<ITEM,VALUE> {
public int compare(ITEM itemA, VALUE valueA, ITEM itemB, VALUE valueB);
}
when set, the new property will override the comparator property.
What do you think?
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com>
Date: Monday, May 19, 2025 at 00:59
To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: Let's discuss JDK-8338952
About six months ago, I opened JDK-8338952 with a proposal to add an item comparator to (Tree)TableView.
The reason for this issue is that when using non-standard sorting — for example, when there is a "Total"
row in the table — the standard API becomes insufficient. One has to reinvent the wheel, and the code
quickly becomes extremely messy. Given that tables are one of the core UI components, this becomes
a serious problem.
To address this, I proposed adding an item comparator, which I believe would be very simple to implement.
I suggest we at least discuss this issue so we can start moving toward a solution.
Best regards, Pavel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250519/96606a9a/attachment.htm>
More information about the openjfx-dev
mailing list