RFR: 8235491: Tree/TableView: implementation of isSelected(int) violates contract [v7]

Andy Goryachev angorya at openjdk.org
Mon Aug 8 21:54:35 UTC 2022


On Mon, 8 Aug 2022 20:15:00 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> 1. reword SelectionModel.isSelected(int) javadoc, removing incorrect statement "Is functionally equivalent to calling <code>getSelectedIndices().contains(index)</code>." 
>> 2. reimplement TableView.TableViewSelectionModel.isSelected(int) method to return true when at least one cell in *any* column is selected on the given row (was: *all* columns)
>> 3. change selectRowWhenInSingleCellSelectionMode() and selectRowWhenInSingleCellSelectionMode2() in TableViewSelectionModelImplTest to reflect new reality.
>> 
>> NOTE: proposed change alters semantics of isSelected(int) method (in the right direction, in my opinion).
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8235491: revert clear selection

> the last line fails for cell selection enabled with this implementation and passes when delegating to super (or not override isSelected(int) at all)

I think you are right, @kleopatra !  Took me a while, but I see your point now.  This method should indeed delegate to super(), or not be overridden at all.

Thank you for creating the tests - they deserve to be integrated into  TableViewSelectionModelImplTest, with your permission.

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

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


More information about the openjfx-dev mailing list