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

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

There is a newer version: 0.1.1
Show newest version
package tornadofx.controlsfx


import javafx.beans.property.Property
import javafx.beans.property.SimpleObjectProperty
import javafx.collections.ObservableList
import javafx.event.EventTarget
import org.controlsfx.control.PropertySheet
import org.controlsfx.property.BeanPropertyUtils
import tornadofx.*

fun EventTarget.propertysheet(mode: PropertySheet.Mode = PropertySheet.Mode.NAME, op: (PropertySheet.() -> Unit)? = null): PropertySheet {
    val propertySheet = PropertySheet().apply {
        this.mode = mode
    }
    return opcr(this, propertySheet, op)
}

fun EventTarget.propertysheet(mode: PropertySheet.Mode = PropertySheet.Mode.NAME, items: ObservableList, op: (PropertySheet.() -> Unit)? = null): PropertySheet {
    val propertySheet = PropertySheet(items).apply {
        this.mode = mode
    }
    return opcr(this, propertySheet, op)
}

fun EventTarget.propertysheet(bean: Any, mode: PropertySheet.Mode = PropertySheet.Mode.NAME, op: (PropertySheet.() -> Unit)? = null): PropertySheet {
    val items = BeanPropertyUtils.getProperties(bean)
    val propertySheet = PropertySheet(items).apply {
        this.mode = mode
    }
    return opcr(this, propertySheet, op)
}

fun EventTarget.propertysheet(mode: Property, op: (PropertySheet.() -> Unit)? = null): PropertySheet {
    val propertySheet = PropertySheet().apply {
        this.modeProperty().bind(mode)
    }
    return opcr(this, propertySheet, op)
}

fun EventTarget.propertysheet(mode: Property, items: ObservableList, op: (PropertySheet.() -> Unit)? = null): PropertySheet {
    val propertySheet = PropertySheet(items).apply {
        this.modeProperty().bind(mode)
    }
    return opcr(this, propertySheet, op)
}

fun EventTarget.propertysheet(bean: Any, mode: Property, op: (PropertySheet.() -> Unit)? = null): PropertySheet {
    val items = BeanPropertyUtils.getProperties(bean)
    val propertySheet = PropertySheet(items).apply {
        this.modeProperty().bind(mode)
    }
    return opcr(this, propertySheet, op)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy