FilteredList/SortedList
Knut Arne Vedaa
knut.arne.vedaa at broadpark.no
Wed Jan 2 14:00:51 PST 2013
> These lists have always been driven by the requirements of TableView,
> but I'm having a hard time understanding how the newly proposed API will
> fit in (and what will be required of me and / or end users of the
> TableView control). It would be great if you could show some examples of
> how a developer would instantiate a TableView that is:
Generally, this shouldn't mean any changes to TableView at all. The
consumers of FilteredList/SortableList should not see them as such, but
simply as implementations of ObservableList.
The task of TableView is to observe an ObservableList and update itself
according to changes of the list. These changes may be the result of
adding, removing, sorting, filtering and on. How the list changes
themselves is not something TableView (or other controls that listens to
ObservableLists) should care about.
> 1) always in a sorted state
First, it may not always be desireble to have a TableView that is always
in a sorted state, so a way to configure this (autoSortProperty) would
be needed.
> 2) able to filtered based on a user typing
This would be the task of the API user to hook up a FilteredList with a
suitable filter (with mutable predicate based on values of other
controls) to the TableView.
> 3) is always sorted and able to be filtered based on user input
For sorting, I think TableView should implement it with an internal
SortedList. That is, the user hooks up an ObservableList to the
TableView, but internally TableView wraps with in a SortedList and uses
the latter as the source for the display. This way you can, as you say,
also revert to the unsorted if so desired. An open question here is
whether this sortedList should be exposed, which may be desirable if the
user *actually* wanted to use the sorted list for something (which is
the current behaviour with sort in place...)
So in this sense, SortedList might be driven by the needs of TableView,
while FilteredList would be completely unrelated. FilteredList might
have som uses with ComboBox, though. (E.g. "find" or narrow the
possibilities as the user types.)
Knut Arne Vedaa
More information about the openjfx-dev
mailing list