HG: /source/hg/javafx/8.0/scrum/graphics/rt: 2 new changesets

Richard Bair richard.bair at oracle.com
Wed Feb 6 10:13:43 PST 2013

Hi Martin,

> Changeset:  c2fb1c411133
> Author:     Martin Sladecek <martin.sladecek at oracle.com>
> Date:       Mon Feb 04 14:18:22 2013 +0100
> URL:        http://jfxsrc.us.oracle.com/javafx/8.0/scrum/graphics/rt/rev/c2fb1c411133
> Description:
> RT-28166 Animation methods accept illegal Duration values that are not expected in the Animation code.

I don't think this is the right thing for us to do. The issue here is this:

                protected void invalidated() {
                        final Duration newDuration = get();
                        if (newDuration.lessThan(Duration.ZERO)) {
                            if (isBound()) {
                            throw new IllegalArgumentException("Cannot set delay to negative value. Setting to Duration.ZERO");

This is an idiom we should really avoid (I've seen it in at least one other place before this change set, and I think it is an abomination there too :-)). The problem is that with a binding, you might end up in one of several intermediate states as the binding is reconfigured, and any such intermediate "illegal" state will cause the binding be silently unbound! Suppose the duration is based on some math based on two input variables:


Somebody (using sliders, whatever) changes start to be > than end, but only temporarily because they're now about to set the end to be > than start. However now the binding is no longer working.

Instead, we need to allow people to set the value to any valid Duration, specify what it will mean if the duration is < 0, and then get our implementation to handle it correctly. For example you could add a private / package helper method that gets the "normalizedDuration".


More information about the openjfx-dev mailing list