tornadofx.controlsfx.ItemControls.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tornadofx-controlsfx Show documentation
Show all versions of tornadofx-controlsfx Show documentation
TornadoFX integration library for ControlsFX
package tornadofx.controlsfx
import javafx.beans.property.ReadOnlyListProperty
import javafx.beans.value.ObservableValue
import javafx.collections.ObservableList
import javafx.event.EventTarget
import org.controlsfx.control.CheckListView
import tornadofx.*
// CheckListView
fun EventTarget.checklistview(items: ObservableList? = null, op: (CheckListView.() -> Unit) = {}): CheckListView {
val checkListView = CheckListView(items)
return opcr(this,checkListView,op)
}
fun EventTarget.checklistview(items: ReadOnlyListProperty, op: (CheckListView.() -> Unit)? = null): CheckListView =
checklistview(items as ObservableValue>, op)
fun EventTarget.checklistview(items: ObservableValue>, op: (CheckListView.() -> Unit)? = null): CheckListView {
val checkListView = CheckListView()
fun rebinder() {
(checkListView.items as? SortedFilteredList)?.bindTo(checkListView)
}
checkListView.itemsProperty().bind(items)
rebinder()
checkListView.itemsProperty().onChange {
rebinder()
}
return opcr(this, checkListView, op)
}