edvin
05/31/2017, 4:00 PMitemProperty
will make sure that it behaves correctly at runtime, and that also explains why you see the correct value in platform.runLater - because at that time the fragment was assigned a specific cell/value. You cannot rely on extraction of the value while you create the fragment, nor should you need to.kasrasadeghi
05/31/2017, 4:01 PMkasrasadeghi
05/31/2017, 4:02 PMedvin
05/31/2017, 4:04 PMinit { titleProperty.bind(entryModel.command)
- provided that command is a textProperty bound correctly in the ViewModel. If this doesn't work, I suspect an error in the ViewModel - please post it if so. Also, your label can be created and bound to at the same time: label(entryModel.output)
- no need to do that `textProperty().bind(entryModel.output)`:)kasrasadeghi
05/31/2017, 4:05 PMclass EntryModel(property: ObjectProperty<Entry>) : ItemViewModel<Entry>(itemProperty = property) {
val command: StringProperty = bind(autocommit = true) { item?.commandProperty }
val output : StringProperty = bind(autocommit = true) { item?.outputProperty }
val error : BooleanProperty = bind(autocommit = true) { item?.errorProperty }
}
kasrasadeghi
05/31/2017, 4:06 PMclass EntryFragment : ListCellFragment<Entry>() {
val entryModel: EntryModel = EntryModel(itemProperty)
override val root = titledpane(entryModel.command) {
label(entryModel.output) {
toggleClass(KermStyle.warning, entryModel.error)
}
}
}
edvin
05/31/2017, 4:06 PMkasrasadeghi
05/31/2017, 4:07 PMkasrasadeghi
05/31/2017, 4:07 PMkasrasadeghi
05/31/2017, 4:07 PMedvin
05/31/2017, 4:07 PMkasrasadeghi
05/31/2017, 4:07 PMedvin
05/31/2017, 4:08 PMedvin
05/31/2017, 4:08 PMkasrasadeghi
05/31/2017, 4:08 PMedvin
05/31/2017, 4:08 PMkasrasadeghi
05/31/2017, 4:09 PMkasrasadeghi
05/31/2017, 4:10 PMnimakro
05/31/2017, 4:11 PMtitilepane
builder which is expecting a stringnimakro
05/31/2017, 4:11 PMtitledpane {
titleProperty().bind(entryModel.command)
}
edvin
05/31/2017, 4:12 PMkasrasadeghi
05/31/2017, 4:12 PMkasrasadeghi
05/31/2017, 4:12 PMedvin
05/31/2017, 4:14 PMkasrasadeghi
05/31/2017, 4:14 PMkasrasadeghi
05/31/2017, 4:14 PMkasrasadeghi
05/31/2017, 4:14 PMoverride val root = titledpane {
titleProperty.bind(entryModel.command)
label(entryModel.output) {
toggleClass(KermStyle.warning, entryModel.error)
}
}
kasrasadeghi
05/31/2017, 4:14 PMkasrasadeghi
05/31/2017, 4:15 PMedvin
05/31/2017, 4:15 PMtitleProperty
as a value is coming from the Fragment itself. It's called textProperty()
on the TitledPane.