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

yosbits duke at openjdk.java.net
Mon Feb 7 15:44:24 UTC 2022


On Mon, 7 Feb 2022 10:24:01 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.
>
> Jose Pereda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address feedback from reviewer

getRow () returns an int.
It is more efficient to process the primitive as it is.
The code below will be less boxing.
Because filter and distinct are processes for primitives
It can be done at high speed.

``` java
            final List<Integer> removed = c.getRemoved().stream()
                    .mapToInt(TablePositionBase::getRow)
                    .distinct()
                    .filter(removeRowFilter)
                    .boxed()
                    .peek(sm.selectedIndices::clear)
                    .collect(Collectors.toList());

            final int addedSize = (int)c.getAddedSubList().stream()
                    .mapToInt(TablePositionBase::getRow)
                    .distinct()
                    .boxed()
                    .peek(sm.selectedIndices::set)
                    .count();

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

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


More information about the openjfx-dev mailing list