Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Wrong Figure order for PictogramElements
Wrong Figure order for PictogramElements [message #1755630] Mon, 06 March 2017 11:56 Go to next message
Thomas Thonhofer is currently offline Thomas ThonhoferFriend
Messages: 25
Registered: July 2013
Junior Member
Hi everyone

I have a problem with changing the order in which Graphiti Shapes are drawn. I suspect it is a bug in the framework, but maybe its also my mistake. In case there is already a bug entry for this, I am sorry, I couldn't find one.

In my diagram there can be multiple overlapping shapes. I have a feature which should move a shape to the front, so it is completly visible and all overlapping shapes are shown behind. To achieve this I use the sendToFront(Shape shape) method in PeServiceImpl, which simply moves the shape to the end of the list of the diagrams children. This doesn't work the way I want it to, the shape is moved in front of some other shapes, but not completly to the front.

After some debugging I found waht I believe is the reason for this behaviour: After changing the order of the diagrams children, next time the diagrams editpart is refreshed, the order of the editpart children is updated in the method refreshChildren() in the class AbstractEditPart. For all editparts which need to be reordered it calls the method reorderChild(EditPart editpart, int index). This method then removes the draw2d figure and adds a new one using the index of the moved editpart. This works fine if there is an editpart for each figure and vice versa, but with Graphiti, decorators have a figure but no editpart. As I am using decorators for some of my shapes, which are added to the diagram, this means that there are more figures than editparts among the diagrams children, which means that inserting a new figure at the index of the last editpart, does not insert it at the last position. As far as I can tell, this leads to the inconsistent drawing order of my shapes.

I created a workaround where I sort the figures manually. This is an ugly solution and rather unreliable, but so far it is the best I could come up with. Any ideas for a better approach? Is this behaviour a bug or am I missing something?

Thanks,
Thomas
Re: Wrong Figure order for PictogramElements [message #1755723 is a reply to message #1755630] Tue, 07 March 2017 09:02 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Thomas,

this is an interesiting issue you brought up here. I would see that as a bug, however the involved code spots in AbstractEditPart are no Graphiti coding but leong to GEF. Maybe Graphiti has a special usage of this, but checking the JavaDoc of GEF on that I would say that it is valid.

I would be rather reluctant to build a Graphiti specific workaround for this, but would hope that GEF could comment on this and eventually provide a fix (however that would be on the the deprecated GEF3). Did you already reach out to GEF?

Michael
Re: Wrong Figure order for PictogramElements [message #1755803 is a reply to message #1755630] Wed, 08 March 2017 10:06 Go to previous messageGo to next message
Thomas Thonhofer is currently offline Thomas ThonhoferFriend
Messages: 25
Registered: July 2013
Junior Member
Thanks for the reply

I agree, the nicer solution would be if this was fixed on the GEF side. In case this is not possible I will just have to stick to my own workaround. I will consult the GEF forum and in case I find a proper solution, I will post it here.

Best regards,
Thomas
Re: Wrong Figure order for PictogramElements [message #1755813 is a reply to message #1755803] Wed, 08 March 2017 11:32 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Thanks, Thomas!
Previous Topic:Error when opening the diagram
Next Topic:Setting anchors on the inner shape
Goto Forum:
  


Current Time: Wed Jun 20 12:06:20 GMT 2018

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

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

Back to the top