Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement task progress indicator (and dialog) in the toolbar #6443
Implement task progress indicator (and dialog) in the toolbar #6443
Changes from 10 commits
fdfe074
6fd1811
b883491
255a6e4
38dd89d
1b2aaa6
baf9bd0
40a8feb
cac989b
8f525b8
c877431
1ad9598
cd4e38e
23f8cf0
4628c3d
90ff19e
62d7c14
008d55e
a9f4493
66ac316
e9a7176
d7442cc
5defe3e
fba9c70
6a62e6f
a97af13
3ee4571
44d9ca8
bd2eefd
41efc04
2c9ccea
ff9ce00
d56138b
cf10859
fcb1d0c
396411a
e24c141
478ee05
0557c67
23b7e69
e3ae796
3db3997
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to wrap the tasks around in a
ObjectProperty
? It should also work without this wrapper. If there were problems with the updates, you might need to add an "extractor" to theobservableArrayList
which specifies that the list should update if the underlying data changes (in this case probably the progress of the task).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. I though EasyBind's combineList takes care of updating the observable when the progress updates? From the doc:
I had to turn it into a list of ObjectProperty because that's what EasyBind's combineList expects, but I guess it then only registers changes of the ObjectProperty, not the task.
So to update upon progress changes, I need to tell the list that I am interested in the progress by defining an extractor. I found some code online working with extractors, so I think I should be able to implement that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, combineList takes updates into account but for this the elements have to observable themselves. For example, if
ObservableList<ObservableDoubleValue>
is a list containing theprogress
property of each task.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hints. This works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the ObjectProperty wrapping issue. I tried changing it back just to see what happens, and I still get the same error for the bindings:
I think that the combine method only works on lists of observables.
If I create the binding with Bindings.createDoubleBinding, it does not update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
doesn't work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it does (except for some minor mistakes in your code).
I did not put the list name (backgroundTasks) as a second argument. Does that mean that the binding would have worked ONLY on the extractor? So adding and removing does not update the value, but a change in the progress would have? Or why else do we need to pass the list as a second argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second argument specifies the observables that the function (the first argument) depends on. That is, every time these observables change, the function is called and the binding is updated with the new value. If you don't specify any observables in the second argument, then the binding is never updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that makes sense! Thanks for explaining!