package envoy.client.ui; import javafx.scene.control.ListCell; import javafx.scene.control.ListView; /** * This is a utility class that provides access to a refreshing mechanism for * elements that were added without notifying the underlying {@link ListView}. *

* Project: envoy-client
* File: ListViewRefresh.java
* Created: 16.07.2020
* * @author Leon Hofmeister * @since Envoy Client v0.1-beta */ public final class ListViewRefresh { private ListViewRefresh() {} /** * Deeply refreshes a {@code listview}, meaning it recomputes every single of * its {@link ListCell}s. *

* While it does work, it is not the most efficient algorithm possible. * * @param toRefresh the listView to refresh * @param the type of its {@code listcells} * @since Envoy Client v0.1-beta */ public static void deepRefresh(ListView toRefresh) { final var items = toRefresh.getItems(); toRefresh.setItems(null); toRefresh.setItems(items); } }