Populating a JavaView TableView from an RxJava Observable <List <T>>

I have Observable<List<T>>one that I want to display using TableView<T>.

It seems that JavaFx should have a library function in order to convert RxJava Observable<List<T>>to JavaFx ObservableList<T>, but if there is, I can not find it (although there is a lot of support in RxJavaFx for moving another way).

Do I need to write my own implementation ObservableListBase<T>and my own implementation ListChangeListener.Change, or is there a better way?

Should I just replace items in bulk?

TableView<T> table = ...
Observable<List<T>> observable = ...

observable
  .observeOn(JavaFxScheduler.platform())
  .subscribe(updatedList -> {
    ObservableList<T> items = table.getItems();
    items.setAll(updatedList);
  });
+4
source share

Source: https://habr.com/ru/post/1691053/


All Articles