add calculating methods to bind
Tom Eugelink
tbee at tbee.org
Wed May 21 19:11:16 UTC 2014
I would like to add a snap method to a calculating bind. For example:
startXProperty().bind( heightProperty().multiply(0.2).snap() )
One option would be to extend the DoubleProperty that is used for the heightProperty, but that would only work for situations where I am the owner of the source. If the binding were reversed (I don't own the source for Line) that will not work.
The other option would be to create a special bind method:
bindSnap( startXProperty(), heightProperty().multiply(0.2) )
But that would mean duplicating the code in the bind method, and I do not want that (if it is possible at all). And it is not possible to register a change listener to startXProperty and snap the result, because there is none, the value is calculated on the fly. So I really need a way to get into the chain.
Any suggestions?
Tom
More information about the openjfx-dev
mailing list