Skip to main content



      Home
Home » Modeling » Graphiti » Rearranging shapes according to EMF model
Rearranging shapes according to EMF model [message #1731465] Thu, 05 May 2016 11:51 Go to next message
Eclipse UserFriend
In EMF model I have three elements defined:

- E1
- E2
- E3

Order of elements matters and so in the XMI these elements are entered in the order defined in the model. However, when I add these elements in Graphiti editor, I use my own ILayoutFeature to position these elements as well as resize containers of these elements and so these Shapes are added to the bottom of the element list, for example, E2, E1, E3 or E3,E1,E2 - like a reverse queue.

I need to keep the order of the elements as defined in the model in Graphiti editor as well. I wanted to check if I am missing something obvious, a helper class perhaps that would allow me to "sync" Graphiti model with EMF model, before I write my own code.

If I need to write my own logic, the idea is to layout all elements (E1, E2, E3) when one is added and change elements' y-coordinate as needed. But key question is how do I know the order at which elements are inserted, how do I know that it's E1, E2, E3? Looks like EMF TreeViewer knows this and inserts model elements at their needed positions.
Re: Rearranging shapes according to EMF model [message #1731510 is a reply to message #1731465] Fri, 06 May 2016 07:00 Go to previous messageGo to next message
Eclipse UserFriend
Alex,

not sure if I understood your problem correctly. It seems that you have 1 to many relation that hold your elements in a ordered way. The list should in that case allow you to access the elements in that same order, be it using an iterator or index-based access. The tree viewer will use the same mechanisms unless there is a sorter set for it. So you should use that same sorter as in the tree and arrange the shapes on the diagram accordingly by using your Layout Feature.

HTH,
Michael
Re: Rearranging shapes according to EMF model [message #1731537 is a reply to message #1731510] Fri, 06 May 2016 11:18 Go to previous message
Eclipse UserFriend
Thanks Michael. It was error on my part in the way I was laying out the components.
Previous Topic:Undo / Redo not active when in Graphiti property view
Next Topic:[SOLVED!!!]I have a question on DirectEditingFeature
Goto Forum:
  


Current Time: Tue May 13 21:44:51 EDT 2025

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

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

Back to the top