Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Animating the shapes example
Animating the shapes example [message #239922] Tue, 20 November 2007 16:28
Eclipse UserFriend
Originally posted by: serefarikan.kurumsalteknoloji.com

Hi,
I have tried to use LayoutAnimator and Animation on shapes example, and
my slightly modified shapes happily moved around. It look really nice,
but the problem is that the animator seems to play changes to objects in
the layout one by one. So a shape moves, after it stops the other one
moves. This is not desirable in my case, since I want to do something
like the rearrangement effect of dbvisualizer. All figures should be
moving at the same time. It appears the Display in gef (in SWT actually)
can not be accessed from a second thread, so in this case I'll either
modify the LayoutAnimator class, or ask for some help :)
My code that is executed in an action is pasted below, in case you want
to have an idea of what I'm doing.

All the best
Seref

the code:

DiagramEditPart dEditPart =
(DiagramEditPart)((StructuredSelection)selection).getFirstEl ement();
LayoutAnimator lAnimator = LayoutAnimator.getDefault();
dEditPart.getFigure().addLayoutListener(lAnimator);
for (int i = 0; i < nodes.size(); i++)
{
org.eclipse.draw2d.Animation.markBegin();
if(((Shape)nodes.get(i)).getName().equals("7"))
{
Shape nodeToMove = ((Shape)nodes.get(i));
nodeToMove.setLocation(nodeToMove.getLocation().translate(18 0, 0));
}
else if(((Shape)nodes.get(i)).getName().equals("6"))
{
Shape nodeToMove = ((Shape)nodes.get(i));
nodeToMove.setLocation(nodeToMove.getLocation().translate(-8 0, 0));
}
Animation.run(200);
}
dEditPart.getFigure().removeLayoutListener(lAnimator);
Previous Topic:zoom and connection-width -part2
Next Topic:GEF documentation
Goto Forum:
  


Current Time: Tue Apr 23 10:02:01 GMT 2024

Powered by FUDForum. Page generated in 0.02781 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top