RFR: 8273336: Clicking a selected cell from a group of selected cells in a TableView clears the selected items list but remains selected

Michael Strauß mstrauss at openjdk.java.net
Fri Feb 4 17:36:21 UTC 2022


On Fri, 7 Jan 2022 19:36:45 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> This PR adds a predicate to TableView and TreeTableView selection models order to remove rows from the selection only when there are no selected cells in that given row, when cell selection is enabled.
> 
> Two tests have been added as well, that fail without this PR and pass with it.

modules/javafx.controls/src/main/java/javafx/scene/control/ControlUtils.java line 172:

> 170:                     .map(TablePositionBase::getRow)
> 171:                     .filter(removeRowFilter)
> 172:                     .distinct()

Maybe `distinct` should be applied before `filter`. This can cut down the number of times the predicate is invoked (which iterates over all selected cells, so it may be a performance issue for large selections).

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

PR: https://git.openjdk.java.net/jfx/pull/709


More information about the openjfx-dev mailing list