Group Elements in TableTree [message #1241255] |
Fri, 07 February 2014 13:01  |
Eclipse User |
|
|
|
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 #1243712 is a reply to message #1243686] |
Tue, 11 February 2014 05:44  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03461 seconds