|
Re: Group Elements in TableTree [message #1242928 is a reply to message #1241255] |
Mon, 10 February 2014 09:17 |
|
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 #1243712 is a reply to message #1243686] |
Tue, 11 February 2014 10:44 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04376 seconds