Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Layout Role for connection childs
Layout Role for connection childs [message #716804] Thu, 18 August 2011 13:54 Go to next message
Alexandre Torres is currently offline Alexandre TorresFriend
Messages: 139
Registered: July 2009
Senior Member
Hi, I'm somewhat a beginner on GEF.
I'm trying to add labels to a connection, but instead of fixed labels such as on several examples, we need labels that can be moved around.
I tried to add a Layout_Role to my connection edit part, a subclass of ConstrainedLayoutEditPolicy able to deal with Locatoes constraints. The problem is that the diagram edit part (the parent) defines an XYLayoutPolicy, based on Rectangle constraints, that are fine to most of my nodes, but not for the children of connection (locator based).
I expected to had my layout handled by the connection editpolicy, but by some reason that I can't figure out, the layout is handled by the diagram layout role. It gives me an exception trying to cast locator to rectangle constraint.

So... does it make sense to give a Layout Role to a connection edit part ? or it will be ignored ?
And what would be the best solution to this design ? is there an example somewhere ? are connection parts supposed to have children (I could refactor to make labels children of the diagram, but that would be complicated, since its default position is near its parent connection... the position is relative to the midpoint).

Thanks in advance.
GEF is really powerfull. But it is still a bit complicated to learn.
Re: Layout Role for connection childs [message #716853 is a reply to message #716804] Thu, 18 August 2011 15:25 Go to previous message
Alexandre Torres is currently offline Alexandre TorresFriend
Messages: 139
Registered: July 2009
Senior Member
I think I solved the problem by overriding the public EditPart getTargetEditPart(Request request) method on the diagram XYLayoutEditPolicy and returning the connection editpart as the target for requests on its children. I still have to workout the layout algorim based on locators instead of rectangles.

If someone has any sugestion (maybe this kind of loyout policy was already developed somewhere) , it would be welcome.

Previous Topic:Properties view
Next Topic:Gef FreeForm LAyout
Goto Forum:

Current Time: Thu Oct 28 09:15:26 GMT 2021

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

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

Back to the top