package envoy.client.ui.listcell; import java.util.function.Function; import javafx.scene.Node; import javafx.scene.control.ListView; /** * A generic list cell rendering an item using a provided render function. * * @author Kai S. K. Engelbart * @param the type of element displayed by the list cell * @param the type of node as which the list element will be displayed * @since Envoy Client v0.2-beta */ public final class GenericListCell extends AbstractListCell { private final Function renderer; /** * @param listView the list view inside of which the cell will be displayed * @param renderer a function converting a list item to a node * @since Envoy Client v0.1-beta */ public GenericListCell(ListView listView, Function renderer) { super(listView); this.renderer = renderer; } @Override protected U renderItem(T item) { return renderer.apply(item); } }