RFR: 8273336: Clicking a selected cell from a group of selected cells in a TableView clears the selected items list but remains selected
Jose Pereda
jpereda at openjdk.java.net
Mon Feb 7 10:14:13 UTC 2022
On Sat, 5 Feb 2022 05:08:54 GMT, yosbits <duke at openjdk.java.net> 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.
>
> Why not use IntPredicate?
>
> before
>
> ``` java
> public static <S> void updateSelectedIndices(MultipleSelectionModelBase<S> sm,
> ListChangeListener.Change<? extends TablePositionBase<?>> c,
> Predicate<Integer> removeRowFilter) {
>
>
> after
>
> ``` java
> public static <S> void updateSelectedIndices(MultipleSelectionModelBase<S> sm,
> ListChangeListener.Change<? extends TablePositionBase<?>> c,
> IntPredicate removeRowFilter) {
>
>
> before
> ``` java
> .map(TablePositionBase::getRow)
>
>
> after
> ``` java
> .mapToInt(TablePositionBase::getRow)
@yososs Do you see any possible gain by using `IntPredicate` vs `Predicate<Integer>?
It changes the `Stream<Integer>` to `IntStream`, and that needs an extra `.boxed()` operation (or alternatively an extra operation to transform the int array with `.collect(ArrayList::new, ArrayList::add, ArrayList::addAll)`).
So I'm wondering if this is worthy?
-------------
PR: https://git.openjdk.java.net/jfx/pull/709
More information about the openjfx-dev
mailing list