```class LoadQueryFragment: Fragment() { var o...
# tornadofx
b
Copy code
class LoadQueryFragment: Fragment() {
    var output: Query? = null
    var items: MutableList<Query> = mutableListOf(Query(Resource {"A"}, "B", "C"))

    override val root = borderpane {

        val list = listview(items.observable()) {
            cellFormat { text = it.label }
        }
        center = list
        bottom = hbox {
            button("Ok") {
                setOnAction {
                    output = list.selectionModel.selectedItem
                    close()
                }
            }
            button("Cancel") {
                setOnAction {
                    close()
                }
            }
        }
    }
}

val frag = find<LoadQueryFragment>().apply {
                        items.addAll(controller.configurationManager.getSparqlQueries())
                    }
                    frag.openModal(stageStyle = StageStyle.UTILITY, block= true)