RFR: 8235491: Tree/TableView: implementation of isSelected(int) violates contract
Andy Goryachev
angorya at openjdk.org
Tue Jul 19 22:50:47 UTC 2022
On Tue, 19 Jul 2022 22:08:19 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> …ontract
>
> 1. reword SelectionModel.isSelected(int) javadoc, removing incorrect statement "Is functionally equivalent to calling <code>getSelectedIndices().contains(index)</code>."
> 2. reimplement TableView.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).
I think the behavior of utility method SelectionModel.isSelected(int) was poorly defined in the context of TableView, and/or incorrect in case of cell selection enabled.
People who used TableView.isSelected(int, TableColumn|TableColumnBase) will be ok, but those who assumed (arguable incorrect) implementation may need to revisit their code, and only in the case when cell selection is enabled.
-------------
PR: https://git.openjdk.org/jfx/pull/839
More information about the openjfx-dev
mailing list