matthjes
08/27/2017, 12:55 PMclass MainControl : JsonModel {
val controlProperty = SimpleDoubleProperty(0.0)
var control by controlProperty
override fun toJSON(json: JsonBuilder) {
with(json) {
add("controlValue", control)
}
}
}
class MainControlModel : ItemViewModel<MainControl>() {
val mainControl = bind(MainControl::controlProperty)
}
class MainController : Controller() {
private val api: Rest by inject()
private val control: MainControlModel by inject()
init {
with(api) {
baseURI = "<http://localhost:8090>"
}
control.mainControl.addListener { _, _, _ ->
LOG.debug("{}", control.item)
<http://api.post|api.post>("control", control.item)
}
}
}
But control.item
is always null? How can I do this?