All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tornadofx.controlsfx.ItemControls.kt Maven / Gradle / Ivy

There is a newer version: 0.1.1
Show newest version
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)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy