package envoy.client.ui.listcell; import java.util.function.Function; import javafx.scene.Node; import javafx.scene.control.*; import javafx.util.Callback; /** * Provides a creation mechanism for generic list cells given a list view and a conversion function. * * @author Kai S. K. Engelbart * @param the type of object to display * @param the type of node displayed * @since Envoy Client v0.1-beta */ public final class ListCellFactory implements Callback, ListCell> { private final Function renderer; /** * @param renderer a function converting the type to display into a node * @since Envoy Client v0.1-beta */ public ListCellFactory(Function renderer) { this.renderer = renderer; } @Override public ListCell call(ListView listView) { return new GenericListCell<>(listView, renderer); } }