Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Border Item Rectilinear router
Border Item Rectilinear router [message #134763] Tue, 12 June 2007 07:48 Go to next message
Norbert  Schöpke is currently offline Norbert SchöpkeFriend
Messages: 63
Registered: July 2009
Member
There is a nice example showing the Border Item Rectilinear router on the "New and Noteworthy" wiki page (section
"Improved link routing").
Is there also example code showing how to generate this behaviour? Do I need separate nodes for those little Borderitems
or would it suffice to have model elements /nodes for the components only (and maybe for the link also)?

Any pointers appreciated as this functionality is just what I need.
Kudos to the devs for including it in the 2.0 release!

Norbert Schöpke
Re: Border Item Rectilinear router [message #136554 is a reply to message #134763] Fri, 15 June 2007 16:02 Go to previous messageGo to next message
Norbert  Schöpke is currently offline Norbert SchöpkeFriend
Messages: 63
Registered: July 2009
Member
Norbert Schöpke wrote:
> There is a nice example showing the Border Item Rectilinear router on the "New and Noteworthy" wiki page (section
> "Improved link routing").
> Is there also example code showing how to generate this behaviour? Do I need separate nodes for those little Borderitems
> or would it suffice to have model elements /nodes for the components only (and maybe for the link also)?
>
> Any pointers appreciated as this functionality is just what I need.
> Kudos to the devs for including it in the 2.0 release!
>
> Norbert Schöpke

Anyone?
Re: Border Item Rectilinear router [message #136649 is a reply to message #136554] Fri, 15 June 2007 21:22 Go to previous messageGo to next message
Mohammed Mostafa is currently offline Mohammed MostafaFriend
Messages: 143
Registered: July 2009
Senior Member
Hi Norbert :

The BorderItemRectilinearRouter is not enabled by default

The way to enable it is to override ConnectionLayerEx
#getRectilinearRouter and make it look like this

public ConnectionRouter getRectilinearRouter() {
if (rectilinearRouter == null)
rectilinearRouter = new BorderItemRectilinearRouter();
return rectilinearRouter;
}

you can have your own connection layer by overriding the
createPrintableLayers method in your RootEditPart and changing it to
look like this:


protected LayeredPane createPrintableLayers() {
FreeformLayeredPane layeredPane = new FreeformLayeredPane();

layeredPane.add(new BorderItemsAwareFreeFormLayer(), PRIMARY_LAYER);
layeredPane.add(new MyConnectionLayerEx(), CONNECTION_LAYER);
layeredPane.add(new FreeformLayer(), DECORATION_PRINTABLE_LAYER);

return layeredPane;
}

you will notice that in this method i'm creating MyConnectionLayerEX
instead of the default ConnectionLAyerEX

Now, for this router to work the border Item Figure position had to be
set otherwise it will not work as expected, if you have troubles
initializing the position on the figure you can always subclass the
router and override the method protected getBorderFigurePosition and
calculate the position in any way you like

i hope this helps

Norbert Schöpke wrote:
> Norbert Schöpke wrote:
>> There is a nice example showing the Border Item Rectilinear router on the "New and Noteworthy" wiki page (section
>> "Improved link routing").
>> Is there also example code showing how to generate this behaviour? Do I need separate nodes for those little Borderitems
>> or would it suffice to have model elements /nodes for the components only (and maybe for the link also)?
>>
>> Any pointers appreciated as this functionality is just what I need.
>> Kudos to the devs for including it in the 2.0 release!
>>
>> Norbert Schöpke
>
> Anyone?
Re: Border Item Rectilinear router [message #136851 is a reply to message #136649] Mon, 18 June 2007 11:28 Go to previous messageGo to next message
Norbert  Schöpke is currently offline Norbert SchöpkeFriend
Messages: 63
Registered: July 2009
Member
Thx Mohammed

I'll get my hands dirty on this...
Norbert
Re: Border Item Rectilinear router [message #193277 is a reply to message #136649] Wed, 18 June 2008 13:30 Go to previous message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Hi Mohammed,

I refer to an answer where you explained how to setup the
BorderItemRectilinearRouter. You wrote:

> you can have your own connection layer by overriding the
> createPrintableLayers method in your RootEditPart and changing it to
> look like this:
>
>
> protected LayeredPane createPrintableLayers() {
> FreeformLayeredPane layeredPane = new FreeformLayeredPane();
>
> layeredPane.add(new BorderItemsAwareFreeFormLayer(),
> PRIMARY_LAYER);
> layeredPane.add(new MyConnectionLayerEx(), CONNECTION_LAYER);
> layeredPane.add(new FreeformLayer(), DECORATION_PRINTABLE_LAYER);
>
> return layeredPane;
> }

What do you mean by "your RootEditPart"? I debug my editor a bit and
none of my generated classes extends any RootEditPart.
I only found
org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEdit Part, which
seems to be something from the GMF runtime called by the runtime itself.
How can I override there any method? I need to install my own
RootEditPart I assume but I don't know how.

Cheers,
Hauke
Previous Topic:Update failure
Next Topic:Resize only smaller
Goto Forum:
  


Current Time: Wed Apr 24 23:40:21 GMT 2024

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

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

Back to the top