Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Composite Layout
Composite Layout [message #1438005] Sun, 05 October 2014 10:07 Go to next message
Studs Terkel is currently offline Studs TerkelFriend
Messages: 27
Registered: July 2011
Junior Member
Hello,

in my meta model I have a typical Composite pattern like structure. So I have a Component, and Composites and Leafs inherit from it. Composites having 0..* children of the type Component. I want to represent this structure as a interlaced Box diagram (Boxes that contain other boxes etc).

My question now: How can I realize a viewpoint that is able to do that?

I am pretty new to Sirius, so I only know the basic modelling techniques. I read about the Composite Layout , but I didnt figure out how to use it yet.
Re: Composite Layout [message #1438974 is a reply to message #1438005] Mon, 06 October 2014 18:54 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Le 05/10/2014 12:07, Studs Terkel a écrit :
> Hello,
Hi,
>
> in my meta model I have a typical Composite pattern like structure. So I
> have a Component, and Composites and Leafs inherit from it. Composites
> having 0..* children of the type Component. I want to represent this
> structure as a interlaced Box diagram (Boxes that contain other boxes etc)
>
> My question now: How can I realize a viewpoint that is able to do that?
> I am pretty new to Sirius, so I only know the basic modelling
> techniques. I read about the Composite Layout , but I didnt figure out
> how to use it yet.

It seems you should look into the possible mapping structure instead of
the composite layout.

Note that you should create a Container Mapping with domain class equals
to Composite. This mapping should have one child mapping to display the
Leafs (a node or container one). Then you should make your Composite
mapping recursive: it will reuse itself (see the Advanced property tab).
But be very attentive to your semantic candidates expression to be sure
to navigate on only one containment level of your semantic model:
feature:children or feature:eContents should be fine.

Then do not forget to add styles to each mapping.

Regards


--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Composite Layout [message #1440465 is a reply to message #1438974] Wed, 08 October 2014 11:55 Go to previous messageGo to next message
Studs Terkel is currently offline Studs TerkelFriend
Messages: 27
Registered: July 2011
Junior Member
Thx for the reply Maxime,

i followed your instructions and it worked out pretty well. The Reuse Options are actually in the Import property tab, but i found them quickly Smile .
Here is the result:
https://dl.dropboxusercontent.com/u/4062763/2014-10-08%2013_01_34-Java%20-%20interlaced_model_interlaced.ecore%20-%20Eclipse.png

I have two comments:

* I also have tried the Composite Layout. It has three options for the layout direction: Top to Bottom, Left to Right, Bottom to Top. In the example above I used 'Left to Right' and the structure are layouted from the top to the bottom. When I use the option 'Top to Bottom' or 'Bottom to Top' the structure is layouted from the left to the right... Is this a bug or have I just wrong expectations?!

* For me, the set of childern of a composite is not a simple set, it is an ordered list. So when I remove or add objects in the diagram, the information is propergated to the model. But when i change the order of Objects (e.g. place Leaf OneTwo in front of Leaf OneOne), nothing is changed in the model yet... How can I make something like that possible?
Re: Composite Layout [message #1441052 is a reply to message #1440465] Thu, 09 October 2014 07:40 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Le 08/10/2014 13:55, Studs Terkel a écrit :> * For me, the set of
childern of a composite is not a simple set, it is
> an ordered list. So when I remove or add objects in the diagram, the
> information is propergated to the model. But when i change the order of
> Objects (e.g. place Leaf OneTwo in front of Leaf OneOne), nothing is
> changed in the model yet... How can I make something like that possible?

If I understand correctly, you want to apply changes in your domain
model when the user changes the relative positions of the graphical
elements that represent them on the diagram, right?

This is not supported currently. Modifying the positions and size of
graphical elements on a diagram never triggers changes in the domain
model. Only "structural" changes (like deletions, reconnections,
dropping elements in or out of containers, etc.) and explicit tool
application trigger hooks (tools), where you can specify how to reflect
the change in the domain model. The only exception is found in the
sequence diagrams, where the order of elements is significant by
definition, and thus moving elements graphically may trigger a "reorder
tool", but there is no equivalent in plain diagrams.

It *might* be possible to develop some custom Java code which does what
you want, by registering a pre-commit listener which reacts to changes
in the graphical elements' positions and updates your domain model
accordingly. It's more complex work, and I'm not entirely sure it could
not have side-effects, but it may be possible.

Regards.


--
Pierre-Charles David - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Composite Layout [message #1698834 is a reply to message #1441052] Thu, 18 June 2015 09:29 Go to previous messageGo to next message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
Pierre-Charles David wrote on Thu, 09 October 2014 09:40

If I understand correctly, you want to apply changes in your domain
model when the user changes the relative positions of the graphical
elements that represent them on the diagram, right?

This is not supported currently. Modifying the positions and size of
graphical elements on a diagram never triggers changes in the domain
model. Only "structural" changes (like deletions, reconnections,
dropping elements in or out of containers, etc.) and explicit tool
application trigger hooks (tools), where you can specify how to reflect
the change in the domain model.


Has this changed in the meantime?

I'm having a similar use case: I'm having a Container representing a "Statement" and the children of the "Statement" are again Statements.

The container presents the children as "List", "Horizontal Stack" or "Vertical Stack".

It's important that the statements are displayed in the same order as they have in the model, as the order is part of the model's semantics.

If now a user changes the order of the children via drag'n'drop in the diagram, the order of the elements in the model should be updated accordingly.

Can this be done?
Re: Composite Layout [message #1699190 is a reply to message #1698834] Mon, 22 June 2015 12:09 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Le 18/06/2015 11:29, Moritz Eysholdt a écrit :
> Pierre-Charles David wrote on Thu, 09 October 2014 09:40
>> If I understand correctly, you want to apply changes in your domain
>> model when the user changes the relative positions of the graphical
>> elements that represent them on the diagram, right?
>>
>> This is not supported currently. Modifying the positions and size of
>> graphical elements on a diagram never triggers changes in the domain
>> model. Only "structural" changes (like deletions, reconnections,
>> dropping elements in or out of containers, etc.) and explicit tool
>> application trigger hooks (tools), where you can specify how to
>> reflect the change in the domain model.
>
>
> Has this changed in the meantime?

No, and nothing related is planned at the moment.

[snip]
> If now a user changes the order of the children via drag'n'drop in the
> diagram, the order of the elements in the model should be updated
> accordingly.
> Can this be done?

It *can* be done, and we have done it in the specific case of the
sequence diagram (see
https://www.eclipse.org/sirius/doc/specifier/sequences/Sequence%20Diagrams.html#eventReorderTool
from some details). But that experience has taught us that it is a much
larger endeavour that it might look like. In the relatively restricted
context of sequence diagrams it was manageable (with some restrictions),
but in the much more open case of general diagrams it would interact
with almost all other graphical features of Sirius, adding a lot of
complexity.

--
Pierre-Charles David - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Conditional Style using Enumeration Type
Next Topic:Edge Creation Problem
Goto Forum:
  


Current Time: Fri Apr 19 11:47:41 GMT 2024

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

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

Back to the top