I have an Observable<List<T>>
that I want to display with a TableView<T>
.
It seems as though there should be a library function in JavaFx to convert an RxJava Observable<List<T>>
into a JavaFx ObservableList<T>
, but if there is, I can't find it (though there's lots of support in RxJavaFx for going the other way).
Do I need to write my own ObservableListBase<T>
implementation and my own implementation of ListChangeListener.Change
, or is there a better way?
Should I just replace the items wholesale?
TableView<T> table = ...
Observable<List<T>> observable = ...
observable
.observeOn(JavaFxScheduler.platform())
.subscribe(updatedList -> {
ObservableList<T> items = table.getItems();
items.setAll(updatedList);
});