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.

Bug 99048 - Animator listener is needed
Summary: Animator listener is needed
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Graph (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: apireviews
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2007-03-26 22:59 UTC by Ramesh Dara
Modified: 2007-05-25 22:21 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed patch (15.91 KB, patch)
2007-04-10 14:01 UTC, David Kaspar
Details | Diff
The second patch with AnimatorEvent (19.30 KB, patch)
2007-04-17 11:02 UTC, David Kaspar
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ramesh Dara 2007-03-26 22:59:57 UTC
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.
Comment 1 Joshua Sandusky 2007-03-26 23:27:41 UTC
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.)

Comment 2 David Kaspar 2007-04-10 14:00:11 UTC
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.
Comment 3 David Kaspar 2007-04-10 14:01:08 UTC
Created attachment 40673 [details]
Proposed patch
Comment 4 Joshua Sandusky 2007-04-10 20:35:32 UTC
This is exactly what we were hoping for (and more)! Thanks!
Comment 5 David Kaspar 2007-04-11 08:28:52 UTC
Asking for fast-track API review.
Comment 6 Jaroslav Tulach 2007-04-15 10:09:18 UTC
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...
Comment 7 David Kaspar 2007-04-16 17:34:05 UTC
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.
Comment 8 Jaroslav Tulach 2007-04-16 20:55:05 UTC
I do not fully understand reply to Y03, probably show here the diff before 
applying.
Comment 9 David Kaspar 2007-04-17 11:02:39 UTC
Created attachment 41056 [details]
The second patch with AnimatorEvent
Comment 10 David Kaspar 2007-05-25 22:21:44 UTC
Patch applied.