8000 CLassCastException when binding in ItemViewModel · Issue #54 · edvin/tornadofx2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
CLassCastException when binding in ItemViewModel #54
Open
@tyb51

Description

@tyb51

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0