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

Data-binding #8

Open
andreas-mausch opened this issue Nov 3, 2018 · 5 comments
Open

Data-binding #8

andreas-mausch opened this issue Nov 3, 2018 · 5 comments

Comments

@andreas-mausch
Copy link
Contributor

Do you plan to support some kind of data-binding?

I think of it in a way that you pass a model object (Observable?) to a TextField, and each time the string is changed, the UI is changed as well.

And, additionally, each time the user types into the TextField, the model object get's changed automatically.

@msink
Copy link
Owner

msink commented Nov 3, 2018

As general direction - yes, it should support some data-binding, but I think it should be separate library.

No concrete plans for now.

@mervyn-mccreight
Copy link
Contributor

Hello,

we (@andreas-mausch and me) would like to work on it. We already have a prototype version of this running (included in the DSL, not a separate library), but we are not sure how to test it. We found some files in the test directory, but can not make any sense of them. How can we write unit-tests for the stuff we came up with?

Our prototype is implementing the same as you can see in this vueJS example here: https://vuejs.org/v2/guide/#Handling-User-Input (app-6) -- the one with the input and the text.

mervyn-mccreight added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 4, 2018
Introduce an Observable to give anything that extends it the ability to
attach and call listeners that communicate a value change passing the new
value.

Refer to issue: msink#8


Co-authored-by: Andreas Mausch <andreas.mausch@gmail.com>
mervyn-mccreight added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 4, 2018
Introduce an Observable to give anything that extends it the ability to
attach and call listeners that communicate a value change passing the new
value.

Refer to issue: msink#8


Co-authored-by: Andreas Mausch <andreas.mausch@gmail.com>
mervyn-mccreight added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 4, 2018
Refer to issue: msink#8


Co-authored-by: Andreas Mausch <andreas.mausch@gmail.com>
mervyn-mccreight added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 4, 2018
Add possibility to do data binding to label and textfield and introduce a
simple example in the samples, to showcase a shared string value between an
input and a label.

Refer to issue: msink#8


Co-authored-by: Andreas Mausch <andreas.mausch@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 5, 2018
Refer to issue: msink#8


Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 5, 2018
Don't let users be confused by the optional parameters in the DSL.
Now we provide two versions which force you to set the correct parameters.

Refer to issue: msink#8


Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 5, 2018
Refer to issue: msink#8


Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
@msink
Copy link
Owner

msink commented Nov 5, 2018

About tests - test directory was here from very early days of development, and still not used.
Maybe it should be removed or cleaned - I still don't figure out how to test this correctly.

Anyway it too should wait for migration to 'multiplatform' plugin.

andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 6, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 11, 2018
* For the DSL, the model is still optional
* New sample data-binding-2, which features all new model-using widgets

Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 11, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 11, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 11, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 11, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 12, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 12, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 12, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 16, 2018
* Provide a list of values and a ModelEntry for the selected element
* When a different item is selected, the model is updated accordingly
* Values can be list of a user-defined type, the text displayed is the toString()
* Changes to the values are not reflected yet (WIP)

Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
andreas-mausch added a commit to mervyn-mccreight/kotlin-libui that referenced this issue Nov 16, 2018
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <mervyn.mccreight@gmail.com>
@andreas-mausch
Copy link
Contributor Author

@msink Can you take a look at the changes in this branch and tell us if you like it? https://github.com/mervyn-mccreight/kotlin-libui/tree/data-binding

Just check the new examples data-binding-1 and 2 to get an impression.

It's not complete yet, and we want to rename "ModelEntry" to "Property" to be more similar to TornadoFX.
But if you in general like what we did, I would continue on implementing ObservableLists for ComboBoxes and ListViews.

@msink
Copy link
Owner

msink commented Nov 27, 2018

I'm not competent in this area, but to me it looks overcomplicated.
Can it be just some data class, something like is done for tables?
checkbox(Data::checkbox)

Maybe more clean way could be using coroutines.

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

3 participants