Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behavior of bindChildren(ObservableMap) #8

Open
yevhenii-nadtochii opened this issue Jun 15, 2020 · 0 comments
Open

Incorrect behavior of bindChildren(ObservableMap) #8

yevhenii-nadtochii opened this issue Jun 15, 2020 · 0 comments

Comments

@yevhenii-nadtochii
Copy link

yevhenii-nadtochii commented Jun 15, 2020

Having this:

    private val backedMap = LinkedHashMap<String, Int>().asObservable()
    private val mapProperty: SimpleMapProperty<String, Int> = SimpleMapProperty(backedMap)
    private val map: MutableMap<String, Int> by mapProperty

        vbox(spacing = 10) {
            bindChildren(mapProperty) { key, value ->
                label("$key: $value")
            }
        }

I get two bugs\unexpected things:

  1. Ordering of converted items is not preserved. I end up with different ordering in my map and vbox's children. But I use LinkedHashMap for backed map and expect that binding would preserve ordering of backed collection.
  2. Instead of updating items in vbox's children it just adds a new one each time I put already presented key in map (== update value).

For the first one the possible reason is using val sourceToTarget = HashMap<SourceTypeKey, TargetType>() in MapConversionListener for observable lists which vbox's one may be. So it doesn't honor which type of map a user uses.
For the second It seems that it is referenced with Improving MapConversionListener #1183 but changes were not picked up to tornadofx2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant