[announce] InhiBeans: mitigate redundant recalculations
swpalmer at gmail.com
Sun Dec 15 09:39:37 PST 2013
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.
imagine you have an "area" property that is bound to both "width" and
"height". You want to write code like:
and have only ONE recalculation of the area property happen. Currently the
way bindings work the area will be calculated twice. The intermediate
calculation is really not a value that you ever want to observe.
Are there helpers for this sort of situation? Are there guidelines in the
JavaFX docs somewhere?
On Sat, Dec 14, 2013 at 11:54 PM, Tomas Mikula <tomas.mikula at gmail.com>wrote:
> I just published a small extension of javafx bindings and properties
> that can help you reduce redundant recalculations.
> They provide two additional methods:
> public void block();
> public void release();
> Call p.block() when you suspect your actions will lead to multiple
> invalidations of p, and call p.release() when you are done and want to
> deliver a single invalidation notification to p's observers.
More information about the openjfx-dev