Re: [announce] InhiBeans: mitigate redundant recalculations

2014-01-16 Thread Tomas Mikula
Hi Alexander, On Thu, Jan 16, 2014 at 10:24 AM, Alexander Kouznetsov < alexander.kouznet...@oracle.com> wrote: > There are two other options you may want to consider: > > 1) Use XXXBinding as following: > > value.bind(new DoubleBinding() { > { bind(widthProperty(), heightProperty()); } > > @Overr

Re: [announce] InhiBeans: mitigate redundant recalculations

2014-01-16 Thread Alexander Kouznetsov
There are two other options you may want to consider: 1) Use XXXBinding as following: value.bind(new DoubleBinding() { { bind(widthProperty(), heightProperty()); } @Override protected Double computeValue() { return widthProperty().get() * heightProperty().get

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Tomas Mikula
..@openjdk.java.net >> [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Tomas Mikula >> Sent: Monday, December 16, 2013 9:19 AM >> To: Richard Bair >> Cc: openjfx-dev@openjdk.java.net >> Subject: Re: [announce] InhiBeans: mitigate redundant recalculations

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Richard Bair
k.java.net > [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Tomas Mikula > Sent: Monday, December 16, 2013 9:19 AM > To: Richard Bair > Cc: openjfx-dev@openjdk.java.net > Subject: Re: [announce] InhiBeans: mitigate redundant recalculations > > As a matter of fact, I have. Only

RE: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread John Smith
@openjdk.java.net Subject: Re: [announce] InhiBeans: mitigate redundant recalculations As a matter of fact, I have. Only to the extent of the "Principles of Reactive Programming" [1] course that is currently in progress on Coursera. From what I have seen so far, it's all about asynchronous co

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Tomas Mikula
As a matter of fact, I have. Only to the extent of the "Principles of Reactive Programming" [1] course that is currently in progress on Coursera. From what I have seen so far, it's all about asynchronous composition (with emphasis on both "asynchronous" and "composition"). I didn't see it addressin

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Richard Bair
Have you looked at https://github.com/Netflix/RxJava by chance? I've been dying to see somebody do an RxJava in JavaFX ever since devoxx and it looks like you may have inadvertently started down that path :-). Richard On Dec 16, 2013, at 8:09 AM, Tomas Mikula wrote: > On Mon, Dec 16, 2013 at

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Tomas Mikula
On Mon, Dec 16, 2013 at 1:47 AM, Tomas Mikula wrote: > On Mon, Dec 16, 2013 at 1:07 AM, Scott Palmer wrote: >> Interesting, no worse than John's pattern though. >> I thought of using a try/finally to make sure release was called and that >> naturally lead to thinking of try-with-resources, where

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Tom Eugelink
Point made. Tom On 2013-12-16 12:17, Tomas Mikula wrote: On Mon, Dec 16, 2013 at 7:56 AM, Tom Eugelink wrote: I understand what you are trying to do. I was wondering if a more coarse grained approach would be preferable, so a central registration of whether or not to postpone change events.

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Tomas Mikula
On Mon, Dec 16, 2013 at 12:17 PM, Tomas Mikula wrote: > On Mon, Dec 16, 2013 at 7:56 AM, Tom Eugelink wrote: >> >> I understand what you are trying to do. I was wondering if a more coarse >> grained approach would be preferable, so a central registration of whether >> or not to postpone change ev

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-16 Thread Tomas Mikula
On Mon, Dec 16, 2013 at 7:56 AM, Tom Eugelink wrote: > > I understand what you are trying to do. I was wondering if a more coarse > grained approach would be preferable, so a central registration of whether > or not to postpone change events. > > So: > Central.postponeAllChangeEvents() > Central.r

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread Tom Eugelink
I understand what you are trying to do. I was wondering if a more coarse grained approach would be preferable, so a central registration of whether or not to postpone change events. So: Central.postponeAllChangeEvents() Central.resumeAllChangeEvents() Or maybe both: p.postponeChangeEvents() p

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread Tomas Mikula
On Sun, Dec 15, 2013 at 8:30 PM, John Hendrikx wrote: > Since you are only allowed to modify properties on the JavaFX thread (in > most cases), I've been using Platform.runLater() to make sure I observe only > complete changes. > > Basically I register an InvalidationListener on the properties tha

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread Scott Palmer
Good stuff! This is the sort of thing that might make a good contribution to extend the standard Bindings class. Scott On Sun, Dec 15, 2013 at 5:49 PM, Tomas Mikula wrote: > On Sun, Dec 15, 2013 at 6:39 PM, Scott Palmer wrote: > > Interesting idea. > > > > There is a case I have been curious

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread Tomas Mikula
On Sun, Dec 15, 2013 at 6:39 PM, Scott Palmer wrote: > Interesting idea. > > There is a case I have been curious about and wonder what the best practices > are for it. Suppose you have a case when you are changing multiple > different properties that will be used in a single calculation. You wan

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread Scott Palmer
Yes, that does the trick, but this basically means you can't use bindings for such things. I'm wondering if there might be an opportunity for another enhancement similar to the block() resume() that Tomas has implemented, but for receiving size of the notification mechanism. Effectively it would

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread John Hendrikx
Since you are only allowed to modify properties on the JavaFX thread (in most cases), I've been using Platform.runLater() to make sure I observe only complete changes. Basically I register an InvalidationListener on the properties that are relevant, and when one gets triggered I set a boolean

Re: [announce] InhiBeans: mitigate redundant recalculations

2013-12-15 Thread Scott Palmer
Interesting idea. There is a case I have been curious about and wonder what the best practices are for it. Suppose you have a case when you are changing multiple different properties that will be used in a single calculation. You want to deal with a single change to all of them in one go. E.g.