Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Routing of connections
Routing of connections [message #516362] Tue, 23 February 2010 17:43 Go to next message
Ben Wecker is currently offline Ben Wecker
Messages: 4
Registered: February 2010
Junior Member
I had based my editor on the Shapes Editor tutorial (http:// www.eclipse.org/articles/Article-GEF-diagram-editor/shape.ht ml). What made it especially interesting for me was that, when a new model element was set so that the connection would intersect with an exisiting model element, the connection would automatically be re-routed around the existing model element. In the next step for my editor I wanted to implement my own layouting algorithm for the connections. Now I realized that even the "move-around-model-elements" layouting is not working anymore since I added a new element in the hierarchy between the diagram and the shapes. So I have now the hierarchy Diagram->Root->Shape. I could not find how to restore the initial behaviour for connections nor could I implement a custom layouting. For what I have understood from some tutorials that I read, this has to do with Layout Managers. Both, the diagram figure and the root figure use a FreeformLayout as Layout Manager. However, I could not find how the FreeformLayout is related to re-rerouting the connections. To make it clearer what I mean with re-routing: before new connections looked like this: http://yfrog.com/1q62629423p
and now I get this result:
http://yfrog.com/jb45551815p

How can I first restore the original behaviour and second implement a custom routing behaviour?

[Updated on: Tue, 23 February 2010 17:43]

Report message to a moderator

Re: Routing of connections [message #516455 is a reply to message #516362] Wed, 24 February 2010 04:33 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
Routing is done by routers which are set in the root figure...

In shapes DiagramEditpart class

/* (non-Javadoc)
 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
 */
protected IFigure createFigure() {
	Figure f = new FreeformLayer();
	f.setBorder(new MarginBorder(3));
	f.setLayoutManager(new FreeformLayout());

	// Create the static router for the connection layer
>ConnectionLayer connLayer = 
>(ConnectionLayer)getLayer
>(LayerConstants.CONNECTION_LAYER);
>	connLayer.setConnectionRouter(new >ShortestPathConnectionRouter(f));
	
	return f;
}


may be what you added has negated that router setting..


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Wed, 24 February 2010 04:40]

Report message to a moderator

Re: Routing of connections [message #516493 is a reply to message #516455] Wed, 24 February 2010 08:56 Go to previous message
Ben Wecker is currently offline Ben Wecker
Messages: 4
Registered: February 2010
Junior Member
Yes, that solved the problem. I must have been kind of blind to miss it. Razz
Previous Topic:Routing Problem ShortestPathConnectionRouter
Next Topic:GEF Editor with Palette and Toolbar
Goto Forum:
  


Current Time: Sat Sep 20 12:18:47 GMT 2014

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

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