Description
I have been working on an application for use during brainsurgery using this amazing framework for about a year now. BUt I have now encountered an issue that I have not been able to solve.
I made this custom implementation of an ObservableMapProperty which is backed by a reversed map (value,keys) with some custom impelmentations
class ReversableObservableMapProperty<K, V?> (map: ObservableMap<K,V?> = FXCollections.observableMap<K,V?>(hashMapOf())) : SimpleMapProperty<K, V?>(map)
I have a Model :
class MappingModel() {
val parcelHexagonMapProperty = ReversableObservableMapProperty<ParcelPoint,Hexagon?>()
val parcelHexagonMap by parcelHexagonMapProperty
}
And and ItemViewModel:
class MappingModelView: ItemViewModel<MappingModel>() {
val parcelHexagonMap = bind(MappingModel::parcelHexagonMapProperty)
}
On build however it throws the following error:
java.lang.ClassCastException: class tornadofx.BindingAwareSimpleMapProperty cannot be cast to class com.sasdashboard.ui.utils.ReversableObservableMap (tornadofx.BindingAwareSimpleMapProperty and com.sasdashboard.ui.utils.ReversableObservableMap are in unnamed module of loader 'app')
at line val parcelHexagonMap = bind(MappingModel::parcelHexagonMapProperty)
Any idea what causes the issue? Is it due to my custom MapProperty not being accessible by TornadoFx? Might it be due to kotlin version (as I saw in another similar issue #12 . Any ideas on how to resolve it. I rely a lot on this easy binding of properties and delegation of Mapfunctions.