FilteredList/SortedList
Jonathan Giles
jonathan.giles at oracle.com
Thu Jan 3 23:41:24 PST 2013
> I find it really strange that TableView modifies the list I put into it
> when I sort it.
>
> Say I have an Domain model like this:
>
> Person {
> private ObservableList<Address> addresses;
> }
>
> Address {
> private String street;
> ....
> }
>
> and I put the a persons address list into a table view, I would not
> expect you to modify it when the table gets sorted. I think you need to
> keep a sorted/filtered copy internally but leave the original list in
> place. BTW what would happen if I pushed an immutable-list into it, it
> would fail on sorting right?
>
> Tom
>
Yes, it was never really intended that this be the case, but
unfortunately in the build-up to JavaFX 2.0 we had to remove the
SortedList implementation, so the fallback was to modify in place. As
with every API decision it has its pluses and minuses, and supporters
and detractors. Now that it is cast in stone we can only look forward to
how best to support the SortedList and FilteredList concepts in JavaFX 8.0.
-- Jonathan
More information about the openjfx-dev
mailing list