Animation on editpart [message #248208] |
Thu, 09 April 2009 15:06  |
Eclipse User |
|
|
|
Hi,
I have requirement to show animation on editparts. i,e i have set of
connections which has a source and traget node.
On a event i need to highlight the single node at a time till it reaches
its target point node
eq
A C1 B C2 D
where C1 and C2 are connections and A,B and D are the nodes
with the below implementationn it is all the nodes are get highlighted
together but what i need is first highlight the A,then some time interval
B and then C
private void blinkingFeature(Set<ConnectionEditPart> tracedConnEditParts)
{
for (ConnectionEditPart connectionEditPart : tracedConnEditParts)
{
final GraphicalEditPart targetEditPart =
(GraphicalEditPart)connectionEditPart.getTarget();
final GraphicalEditPart sourcEditPart =
(GraphicalEditPart)connectionEditPart.getSource();
Thread thread1 = new Thread(new AnimatePort(targetEditPart));
thread1.start();
Thread thread2 = new Thread(new AnimatePort(sourcEditPart));
thread2.start();
}
}
private class AnimatePort implements Runnable
{
GraphicalEditPart graphicalEditPart;
public AnimatePort(final GraphicalEditPart graphicalEditPart)
{
this.graphicalEditPart = graphicalEditPart;
}
public void run() {
for(int i = 1; i < 20;i++)
{
if(i % 2 == 0)
{
Display.getDefault().syncExec( new Runnable(){
@Override
public void run() {
setColorBorder(graphicalEditPart, ColorConstants.red);
}
});
}else
{
Display.getDefault().syncExec( new Runnable(){
@Override
public void run() {
setColorBorder(graphicalEditPart, ColorConstants.black);
}
});
}
try {
Thread.sleep(300);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
I tried the thread join but it us blocking my UI update process. Any idea
how achive this ?
Regards
Byre
|
|
|
|
Powered by
FUDForum. Page generated in 0.03812 seconds