Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Multiple EditParts for one semantic element
Multiple EditParts for one semantic element [message #641596] Fri, 26 November 2010 08:52 Go to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

Hi,

here is a funny question: imagine a model for many network apps, each of
which might act as client and or server. The model shows the apps, and
network connections as lines. Now, if you have a great number of apps,
this can be confusing. So my idea is to line up clients on the left side
and servers on the right side. But, since one app could implement both a
server and a client function, it would appear on both sides, ie. two
editparts for one semantic element! Here's a sketch of what I mean:

CLIENTS SERVERS

+------+ +------+
| app1 |---------| app2 |
+------+ +------+

+------+ +------+
| app2 |---------| app3 |
+------+ +------+

In this diagram, app2 is a server to app1, and a client to app3!
Would that be possible in GMF at all?

Thanks for ideas and pointers!

Marius
Re: Multiple EditParts for one semantic element [message #642171 is a reply to message #641596] Tue, 30 November 2010 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 26.11.2010 09:52, Marius Gröger wrote:
> here is a funny question: imagine a model for many network apps, each of
> which might act as client and or server. The model shows the apps, and
> network connections as lines. Now, if you have a great number of apps,
> this can be confusing. So my idea is to line up clients on the left side
> and servers on the right side. But, since one app could implement both a
> server and a client function, it would appear on both sides, ie. two
> editparts for one semantic element! Here's a sketch of what I mean:
>
> CLIENTS SERVERS
>
> +------+ +------+
> | app1 |---------| app2 |
> +------+ +------+
>
> +------+ +------+
> | app2 |---------| app3 |
> +------+ +------+
>
> In this diagram, app2 is a server to app1, and a client to app3!
> Would that be possible in GMF at all?
>

Nobody, really?

Is that so weird a usecase, or am I just way beyond GMFs capabilities?

Thanks
Marius
Re: Multiple EditParts for one semantic element [message #642468 is a reply to message #642171] Wed, 01 December 2010 13:13 Go to previous messageGo to next message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Hi Marius,

shall be the app2 being visible twice on the diagram?

NO: the answer is simple. Let your model class being a server and a
client. The diagram instance will than allow app2 acting as server or
client. define your graph mapping for the abstract server and client
eclasses.

YES: its a little more complicated. I have had the same case in my
project. I solved the issue using a cloned instance of the object and
installed an replicator that repeats all changes from the source to all
cloned instances (and vice versa). The replication is as simple emf
change recorder.

Sven

Am 30.11.2010 09:42, schrieb Marius Gröger:
> On 26.11.2010 09:52, Marius Gröger wrote:
>> here is a funny question: imagine a model for many network apps, each of
>> which might act as client and or server. The model shows the apps, and
>> network connections as lines. Now, if you have a great number of apps,
>> this can be confusing. So my idea is to line up clients on the left side
>> and servers on the right side. But, since one app could implement both a
>> server and a client function, it would appear on both sides, ie. two
>> editparts for one semantic element! Here's a sketch of what I mean:
>>
>> CLIENTS SERVERS
>>
>> +------+ +------+
>> | app1 |---------| app2 |
>> +------+ +------+
>>
>> +------+ +------+
>> | app2 |---------| app3 |
>> +------+ +------+
>>
>> In this diagram, app2 is a server to app1, and a client to app3!
>> Would that be possible in GMF at all?
>>
>
> Nobody, really?
>
> Is that so weird a usecase, or am I just way beyond GMFs capabilities?
>
> Thanks
> Marius
Re: Multiple EditParts for one semantic element [message #642532 is a reply to message #642468] Wed, 01 December 2010 17:10 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello, Marius and Sven,

Even if you want the App2 beiing visible twice at the same diagram, cloning of the instances and installing a replicator seems to be over-complicated a bit.

I would solve the same problem differently:

- Make sure that you have 2 DIFFERENT mappings for Apps and Servers, even if the graphical representation is the same. It will ensure that the VID of App2-as-a-server is different from App2-as-an-app, and will help the diagram update.

- If you already have implemented it as a single mapping, clone the reference in the Map model and add 2 constraints into the both mappings, based on whatever semantic property you are going to use to distinguish between the servers and apps.
E,g, it may be "self.canBeServer" and "self.canBeApp" OCL constraints.

- Add the feature initializers into the both mappings to ensure that the constraint is satisfied just after creation : so in the sample above, server mapping will set the canBeServer property to true.

=>

Just after that, the reinitialized diagram from the semantic model described in your post should have 2 different nodes for App2. Both will share the semantic element, so renaming will immediately update both of them.

Choosing the server-but-not-an-app node at the diagram and switching the "canBeApp" property to true in the property sheet in this case will / should add the new App node (its possible that it does not work right now as GMF has an update problems, but that would be just one more a bug to fix). The new editor node will most probably added to the top-level corner of the diagram.

If you like to make it more user-friendly, you will need to add and implement some positioning logic as a custom actions for both mappings.

Regards,
Michael



Re: Multiple EditParts for one semantic element [message #642740 is a reply to message #642532] Thu, 02 December 2010 15:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

On 01.12.2010 18:11, Michael Golubev wrote:
> Hello, Marius and Sven,
> Even if you want the App2 beiing visible twice at the same diagram,
> cloning of the instances and installing a replicator seems to be
> over-complicated a bit.
> I would solve the same problem differently:
> - Make sure that you have 2 DIFFERENT mappings for Apps and Servers,

Sven, Michael,

thanks for your input. I would agree that using 2 different GMF mappings
would be a rather elegent way to solve the problem, I hope I can soon
begin trying this out, and I will report back how it went!

Thanks again,
Marius
Re: Multiple EditParts for one semantic element [message #645828 is a reply to message #642740] Mon, 20 December 2010 17:37 Go to previous messageGo to next message
Tiago is currently offline TiagoFriend
Messages: 11
Registered: July 2009
Junior Member
Hello Marius,

I have a problem similar to that described by you.
Do you solve it? How?

Thanks
Tiago
Re: Multiple EditParts for one semantic element [message #645909 is a reply to message #645828] Tue, 21 December 2010 07:39 Go to previous message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

Tiago,

On 20.12.2010 18:38, Tiago wrote:
> I have a problem similar to that described by you.
> Do you solve it? How?

Actually in the meanwhile, my requirements have changed such that I no
longer need to implement this. But the suggested methods to do it look
fairly realizable, so why don't you give it a go and tell us how it
went? Perhaps we can help if you run into issues.

Regards
Marius
Previous Topic:gmfmap to gmfgen
Next Topic:gmfgraph -> Node -> Content Pane
Goto Forum:
  


Current Time: Wed Apr 24 17:05:42 GMT 2024

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

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

Back to the top