tornadofx.controlsfx.PropertySheet.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.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)
}