class TodoItemListCell : ListCell<TodoItem>(...
# tornadofx
c
class TodoItemListCell : ListCell<TodoItem>() { override fun updateItem(item: TodoItem?, empty: Boolean) { super.updateItem(item, empty) if( empty || item == null) { setText(null) setGraphic(null) } else { setText( null ) setGraphic( readCache(item).root ) } } companion object { // TODO: clean up deletions from cache after removal from UI var cellCache : MutableMap<Int, ItemFragment> = mutableMapOf() fun readCache(item : TodoItem) : ItemFragment { val id = item.id.get() if( !cellCache.containsKey(id) ) { val itemFragment = find(ItemFragment::class) // prototype itemFragment.load( item ) cellCache.put( id, itemFragment ) } return cellCache.get(id)!! } } }