[REVIEW REQUEST] Improvements to TableView sorting

Knut Arne Vedaa knut.arne.vedaa at broadpark.no
Mon Feb 18 14:12:58 PST 2013


> It won't - when an ObservableList is used we will maintain the current
> behavior of not retaining the original, unsorted state. For people who
> want to support returning to an unsorted state but otherwise have
> functionality like that of a normal ObservableList, they will do
> something like this:
>
> SortedList sortedList = new SortedList(SortedList.UNSORTED); // where
> SortedList.UNSORTED is a special Comparator
> sortedList.setAll(....);
> TableView tableview = new TableView(sortedList);
> sortedList.comparatorProperty().bind(tableview.comparatorProperty());

I see. So "return to unsorted" is thus not a feature of TableView - but 
of SortedList, and the user has to set it up correctly in order to get 
that feature. And providing a SortedList to TableView is a signal saying 
"hey, don't sort me - I'm taking care of it on my own (and you couldn't, 
even if you tried, so just don't try)".

This is not a bad solution in my opinion, although I don't think it's 
100% clean to create such coupling between TableView and a specific 
other class that is not appearing as a type in it's (TableView's) API.


Knut Arne


More information about the openjfx-dev mailing list