de.factoryfx.javafx.widget.dataview.UpdatableDataView Maven / Gradle / Ivy
package de.factoryfx.javafx.widget.dataview;
import java.util.List;
import java.util.function.Supplier;
import de.factoryfx.data.Data;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
public class UpdatableDataView implements DataView {
private final ObservableList dataList= FXCollections.observableArrayList();
private final Supplier> listSupplier;
public UpdatableDataView(Supplier> listSupplier) {
this.listSupplier = listSupplier;
}
public void update(){
dataList.setAll(listSupplier.get());
}
@Override
public ObservableList dataList(){
update();
return dataList;
}
}