Re: add calculating methods to bind

2014-05-22 Thread Tom Eugelink
https://javafx-jira.kenai.com/browse/RT-37255 On 2014-5-23 8:05, Martin Sladecek wrote: That would be nice. Don't forget to add it to JIRA! -Martin On 23.5.2014 07:11, Tom Eugelink wrote: I feel the standard binding should offer an easy hook option heightProperty().multiply(3.4).calc( val

Re: add calculating methods to bind

2014-05-22 Thread Martin Sladecek
That would be nice. Don't forget to add it to JIRA! -Martin On 23.5.2014 07:11, Tom Eugelink wrote: I feel the standard binding should offer an easy hook option heightProperty().multiply(3.4).calc( value -> { snap(vallue); } ).add(5.0) On 2014-5-21 22:00, Tomas Mikula wrote: Just a side

Re: add calculating methods to bind

2014-05-22 Thread Tom Eugelink
I feel the standard binding should offer an easy hook option heightProperty().multiply(3.4).calc( value -> { snap(vallue); } ).add(5.0) On 2014-5-21 22:00, Tomas Mikula wrote: Just a side note, you could use EasyBind.map(heightProperty(), value -> NodeUtil.snapXY(value.doubleValue() * 0

Re: add calculating methods to bind

2014-05-21 Thread Tom Eugelink
If I ever write a real application, I'm most definitely will use EasyBind. But this is for sharping up Agenda in JFXtras. I try to minimize the dependencies. Tom On 2014-5-21 22:00, Tomas Mikula wrote: Just a side note, you could use EasyBind.map(heightProperty(), value -> NodeUtil.sna

Re: add calculating methods to bind

2014-05-21 Thread Tomas Mikula
Just a side note, you could use EasyBind.map(heightProperty(), value -> NodeUtil.snapXY(value.doubleValue() * 0.2)); instead of snap(heightProperty().multiply(0.2)) and you don't need your custom DoubleBinding implementation. But note that it returns Binding, not DoubleBinding. EasyBin

Re: add calculating methods to bind

2014-05-21 Thread Tomas Mikula
Yeah, and you could also eliminate "Observable... dependencies" from snap's signature, since now you are not using them to invalidate your binding. On Wed, May 21, 2014 at 9:36 PM, Tom Eugelink wrote: > > Found it! Slightly different DoubleBinding was required (copied it from > negate). > > p

Re: add calculating methods to bind

2014-05-21 Thread Tom Eugelink
Found it! Slightly different DoubleBinding was required (copied it from negate). private DoubleBinding snap(final ObservableNumberValue value, final Observable... dependencies) { return new DoubleBinding() { { super.bind(value); }

Re: add calculating methods to bind

2014-05-21 Thread Tomas Mikula
Hi Tom, it seems to me that in your custom DoubleBinding implementation `other` is not its dependency, thus it does not react to it's invalidations. Tomas On Wed, May 21, 2014 at 9:25 PM, Tom Eugelink wrote: > I came up with this: > > startXProperty().bind( *snap(*heightProperty().multiply(0.2)

Re: add calculating methods to bind

2014-05-21 Thread Tom Eugelink
I came up with this: startXProperty().bind( *snap(*heightProperty().multiply(0.2)) ) And then: private DoubleBinding snap(final ObservableNumberValue other, final Observable... dependencies) { return new DoubleBinding() { { super.bind(dependencies);

add calculating methods to bind

2014-05-21 Thread Tom Eugelink
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