Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Adding connections between nodes "automatically"
Adding connections between nodes "automatically" [message #642514] Wed, 01 December 2010 16:13 Go to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
Hi,

lets pretend my ecore model looks like:
http://www.abload.de/img/ecoreocu6.jpg

how could i visualize the node "Topic" in my GMF diagram ?
Is it possible just to display "Topic" ?

its of my concern because i want to generate an diagram out of an dsl script. The language behind the dsl script is pretty like the common programming languages.
something like this:

do{ attr1->attr2 }

in this particular example i want to display "do" as one node and the assignment "->" as one node but there isn't any name to display just the functionname.

thanks for your help.
Greets
Tim

[Updated on: Mon, 06 December 2010 15:41]

Report message to a moderator

Re: Visualize a node without attribute [message #642527 is a reply to message #642514] Wed, 01 December 2010 16:44 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Tim,

The simplest way to do that is to add fixed static label into the figure definition. This way the related code will operate at Draw2D level without adding any GEF notion, similar to the way you may add, e.g, Border or set the color.

So, just :
- create the inner label inside your node figure and layout it correctly.
- set the "text" property of the new label to "->" (no quotes)
- you DON'T need to create neither new DiagramLabels in the GMF graph nor new LabelMapping's in GMFMap models

Regards,
Michael
Re: Visualize a node without attribute [message #642922 is a reply to message #642527] Fri, 03 December 2010 10:48 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
thank u, it works very well!


now i have a new problem its about the layout.
I want to have a TopDown Layout, (what should be default ?!) but its left to right , right now.

I've written this Provider :
http://www.abload.de/img/ecore7h7v.jpg

I added the layoutProviders extension to the plugin.xml in the diagram project with highest priority. When i debug he gets into the class into the provides method and returns true in the end.

but nothing happens. The layout stays the same.
Maybe anyone got this prob before ? Is there something i forgot ?

thanks 4 ur help
Tim

[Updated on: Fri, 03 December 2010 10:49]

Report message to a moderator

Re: Visualize a node without attribute [message #642959 is a reply to message #642922] Fri, 03 December 2010 14:08 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello,

I am not sure, I never digged deep into the graph layouting in GMF. But from the first look, I would try to override the following method to return true for all connections.

/**
* layoutTopDown Utility function that is commonly subclasses by domain
* specific layouts to determine whether a specific connection type is layed
* out in a top down manner.
*
* @param poly
* <code>ConnectionEditPart</code> to determine whether it is to be layed
* out in a top-down fashion.
* @return true if connection is to be layed out top-down, false otherwise.
*/
protected boolean layoutTopDown(ConnectionEditPart poly) {
return false;
}

Regards,
Michael
Re: Visualize a node without attribute [message #643248 is a reply to message #642959] Mon, 06 December 2010 09:38 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
ah okay, thats a pretty easier than my attempt.

But thats all just working if there is a connection between the nodes.

Any suggestions to put there automatic connections from 1st to 2nd node, from 2nd to 3rd node...

OR to adjust the layout manually for every node ?


thanks
Tim
Re: Visualize a node without attribute [message #643343 is a reply to message #643248] Mon, 06 December 2010 15:17 Go to previous message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
maybe to be more specific:

After I generated my diagram it looks like this:
http://www.abload.de/img/ecore6oro.jpg

Now i modelled relations which could be dragged into the editor between two nodes. These relations are not(!) a part of the ecore model, they are just modelled in the gmf editor.

After everything is painted there should (hopefully) be a way where i could connect one node to another programmatically, so the diagramm is connected at startup.

At this point i looked for edithelpers but all i found is using the basePackage of the ecore model...

Previous Topic:Generate diagram instance from ecore-instance
Next Topic:Can't refer to elements defined in more than one Ecore file in GMF Audit Rule
Goto Forum:
  


Current Time: Fri Mar 29 05:03:26 GMT 2024

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

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

Back to the top