Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Group Elements in TableTree
Group Elements in TableTree [message #1241255] Fri, 07 February 2014 18:01 Go to next message
Aleksandar Toshovski is currently offline Aleksandar ToshovskiFriend
Messages: 78
Registered: December 2011
Member
I have a class which has two lists of elements with the same type.For example:

class Field

class Group{
   Field[] headFields
   Field[] tableFields
}


When I define a Table Tree viewpoint I want to show them the same way like in the class definition -- separated. I've tried to create a line with two sublines, but it shows the elements on the same level:

Group
 headField1
 headField2
 tableField1
 tableField2


I'm trying to achieve:

Group
 headFields
  headField1
  headField2
 tableFields
  tableField1
  tableField2


How can I group the sublines without changing the metamodel?
Re: Group Elements in TableTree [message #1242928 is a reply to message #1241255] Mon, 10 February 2014 09:17 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Hi.

Le 07/02/2014 19:01, Aleksandar Toshovski a écrit :
> I'm trying to achieve:
>
> Group
> headFields
> headField1
> headField2
> tableFields
> tableField1
> tableField2

Are the "headerFields" and "tableFields" at the same level as the
"Group"? I'll assume they are below.

> How can I group the sublines without changing the metamodel?

You can get this by creating two line mappings which technically
represent the Group (so there is only one such line each), but change
the label expression to show "headerFields" and "tableField".

So you would have mappings like this:

GroupLineMapping
domainClass: Group
semanticCandidateExpression: [someExpression/]
HeaderFieldsCategoryMapping
| domainClass: Group
| semanticCandidateExpression: [someExpression/] <- the same
| label: "headFields" <- fixed category title
|
\- HeadFieldMapping: the same mapping you currently have for this


And repeat for the tableFields category.

Note that this will only work if there is a single Group in each of your
table/tree. If you try to show several groups with this definition, you
will get something like this:

Group1
Group2
headFields
fieldsForGroup1
headFields
fieldsForGroup2

If you are in that case, you will need to move the "Category" mappings
as sub-mappings of GroupLineMapping so they are properly scoped. In that
case you also need to change the semanticCandidateExpression of the
categories to "[self/]" (or "var:self") so that the mappings only used
for visual categorization do not change the context.

Regards,
Pierre-Charles David


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Group Elements in TableTree [message #1243686 is a reply to message #1242928] Tue, 11 February 2014 10:03 Go to previous messageGo to next message
Aleksandar Toshovski is currently offline Aleksandar ToshovskiFriend
Messages: 78
Registered: December 2011
Member
Sorry for the last description, but I think you didn't understand my description. I'll try to explain again what I'm trying to achieve:

This is the UML diagram:
http://i.imgur.com/o2RrW32.png

I want to group the HeadField and The TableFields adding a new level on the tree structure like below: 1st Level Groups, 2nd level Head/Table Fields and 3d level are the grouped fields.

Group 1
 |--Head Fields
 |  |-- Headfield 1
 |  |-- Headfield 2  
 |--Table Fields
 |  |-- Tablefield 1
 |  |-- Tablefield 2 
Group 2
....    
Re: Group Elements in TableTree [message #1243712 is a reply to message #1243686] Tue, 11 February 2014 10:44 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Le 11/02/2014 11:03, Aleksandar Toshovski a écrit :
> Sorry for the last description, but I think you didn't understand my
> description. I'll try to explain again what I'm trying to achieve:
>
> This is the UML diagram:


> I want to group the HeadField and The TableFields adding a new level on
> the tree structure like below: 1st Level Groups, 2nd level Head/Table
> Fields and 3d level are the grouped fields.
>
>
> Group 1
> |--Head Fields
> | |-- Headfield 1
> | |-- Headfield 2 |--Table Fields
> | |-- Tablefield 1
> | |-- Tablefield 2 Group 2
> ...

So that was what I tried to say in my last paragraph.

You need 5 mappings, organized like this:

GroupMapping
HeadFieldsCategoryMapping
HeadFieldsMapping
TableFieldsCategoryMapping
TableFieldMapping

From what I understand you already have GroupMapping, HeadFieldsMapping
and TableFieldMapping. You should be able to keep them with their
current definitions.

Instead of having HeadFieldsMapping (resp. TableFieldMapping) as direct
sub-lines of GroupMapping, you must insert an intermediate
HeadFieldsCategoryMapping (resp. TableFieldsCategoryMapping) to model
the categories. Your semantic model does not contain an intermediate
element between a Group and a Field, but that's OK, it does not need to.
Simply configure the HeadFieldsCategoryMapping (resp.
TableFieldsCategoryMapping) like this:

domainClass = Group
semanticCandidatesExpression = [self/]
headerLabelExpression = "Head Fields" (resp. "Table Fields")

This way, technically the category lines are bound to the same Group
element as their parent line (because each line *must* be bound to a
model element and your model does not have an explicit object for the
categories), but visually for end-users they look and behave like
different categories for specific kinds of sub-lines.

Note that this is a general technique which can be used with all Sirius
dialects (incl. diagrams and trees): if you need intermediate elements
in your representation that don't actually exists in your domain model,
create a mapping which binds to the same domain element as its parent
(here both categories are technically bound to the Group) but use a
different graphical representation.

If this is still not clear enough or I misunderstood you, maybe you can
attach here (or send me in private) your example.

Regards,
Pierre-Charles David


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Set a default presentation view.
Next Topic:Integrating sirius into an RCP application, Best Practices
Goto Forum:
  


Current Time: Tue Apr 23 12:48:47 GMT 2024

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

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

Back to the top