This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
For the Casa Editor, We would like to have an animation listener, or at least an animationCompletionListener, so that we have some way of getting notified when the animation is complete at the time we set up the animation. When a palette item is Dragged and Dropped, we would like to show the newly created node by scrollRectToVisible. When the item is DnDed, we are laying out the widgets to avoid any collissions with the newly DnDed widget, presented with nice animation. So, the newly dropped widget, say at location (oldX, oldY) would be animated to move to new location (newX, newY). We are making a call to scrollRectToVisible with the widgets location, which happenes to be (oldX, oldY) in stead of (newX, newY). If we are listening for the completion of animation, we can set scrollRectToVisible to the widget's location. Also, as layout applies to the entire region holding all the widgets, we won't be knowng the new location of the widget. Hence, if no animation listener means, we need to stop using the nice animation.
basically we'd like to have some way of being informed when the animation is complete - so that we can perform additional operations afterwards (such as scroll to visible, etc.)
Attaching a patch for the AnimatorListener interface. Originally all built-in animators has been hidden and exposed by methods of SceneAnimator only. Now it is accessible by: Scene.getSceneAnimator().getPreferredLocationAnimator().addAnimatorListener(...) The preferredLocationAnimator takes care of preferred location animation of all widgets. If you invoke preferred-location-animator in the middle of previously started animation, the process is reset and continues from current situation to the new target. Patch contains update documentation, javadoc, automated test and increated spec number. If the proposed patch is sufficient for you, I am going to assign the issue to fast-track API review.
Created attachment 40673 [details] Proposed patch
This is exactly what we were hoping for (and more)! Thanks!
Asking for fast-track API review.
Y01 The newly added API methods and classes miss the @since tag, please add @since 2.2 there. Y02 The use of golden files in test is really inventive! Usually we just use Logger. At the begining of the test we create CharSequence log = Log.enable(...) and at the end we just do assertEquals("explog", log.toString()), no files are then needed and one can understand the whole test just by looking at its source code. Y03 Can you describe me the planned evolution story for AnimationListener? What if you find out that a method is missing or that it needs additional arguments? E.g. maybe you should add AnimatorEvent...
Y01 - thanks for notifying - i have forgotten about it Y02 - i have not know about this approach - i will use it for simple tests like this AnimationListenerTest Y03 - I will create AnimatorEvent which will contain Animator reference and Progress value. The listener is an interface and I think users would not like it to be an abstract class. Therefore a new listener-method is going to be added only using a new listener interface.
I do not fully understand reply to Y03, probably show here the diff before applying.
Created attachment 41056 [details] The second patch with AnimatorEvent
Patch applied.