Animation on Connection. [message #234709] |
Tue, 29 May 2007 10:19 |
Eclipse User |
|
|
|
Originally posted by: rakesh.pramati.com
Hi,
I want to animate connection figure.
There are 2 editparts and there is a polyline connection between two
editparts.
I want to draw a small ball image which moves just above the connection
line, which moves from source to target editpart. This should happen on
event based.
I tried in following manner but doesn't help.
In PolylineConnection.java
Override
outlinedShape(Graphics g){...} method and trying to draw an image on the
graphics but didn't find the way to remove the image from Graphics and
things
are not happening smoothly.
Any pointer? I need some help immediately.
Thanks in Adavnce.
Thanks
-Rakesh
|
|
|
Re: Animation on Connection. [message #234760 is a reply to message #234709] |
Wed, 30 May 2007 06:12 |
Eclipse User |
|
|
|
Originally posted by: rakesh.pramati.com
Hi,
After I post a question on news group, I found an answer.
Better way to handle the situation doing animation job on feedback layer
of Editor in separate thread. Just add Figure to FeedbackLayer and remove
it after some interval before you add new one. For better understanding
just see the code below.
This code is written in one of the Connection Editpart.
Image image =
ServicemodelDiagramEditorPlugin.getBundledImageDescriptor("\\icons\\go_over.gif ").createImage();
final ImageFigure imageFigure = new ImageFigure(image);
new Thread(){
public void run() {
int x = 100;
for(int i = 0; i< 1000;i++){
removeFromFeedback(imageFigure);
if(x > 400)
x = 100;
imageFigure.setBounds(new Rectangle(x,100,16,16));
if(i== 999)
break;
addToFeedback(imageFigure);
x = x+16;
try {
getFeedbackLayer().repaint();
sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
Hope this might help to somebody.
-Rakesh
|
|
|
|
Powered by
FUDForum. Page generated in 0.03920 seconds