Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Implementation of non-graphical non-containament references
Implementation of non-graphical non-containament references [message #508941] Wed, 20 January 2010 19:20 Go to next message
Milan Milanovich is currently offline Milan MilanovichFriend
Messages: 201
Registered: July 2009
Senior Member
Hi,

I have one general question regarding non-containament references which are not defined graphically in gmf, e.g. I have following classes in my ecore domain model:

class SequenceFlow{
    expression[0..1]: Expression;
}

class FormalExpression extends Expression { <- this class is not defined graphically
    body : EObject;
    language : EString;
}



I want to enable that when a user clicks on the SequenceFlow, he can define its expression, by instantiating
the FormalExpression and populating the body with empty String and the language with asting. Then, user
should enter body of the FormalExpression.

What is the best strategy for this kind of situations (some example maybe?)?

--
Regards, Milan
Re: Implementation of non-graphical non-containament references [message #509529 is a reply to message #508941] Fri, 22 January 2010 16:55 Go to previous messageGo to next message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,
What you want is not an easy task. Apparently, you need more than a
simple label to represent your expression, which is not directly covered
by GMF models. I suggest you to use a compartment with a label inside
and edit the generated code to change the label into a TextFlow
(currently not supported by GMG-GRAPH models) which, I think, will suit
to your need.

----------------------------------------
//notational element
IFigure rect = new Rectangle();
//customize figure (layout, border, etc.)
....
//Create and add multi-line text area
FlowPage flowPage = new FlowPage();
TextFlow textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_TRUNCATE));
flowPage.add(textFlow);
rect.add(flowPage);
....
---------------------------------------

After that you will have to manage direct editing as for the label.

Hope it will help.
Cheers.




Le 20/01/2010 20:20, Milan Milanovich a écrit :
> Hi,
>
> I have one general question regarding non-containament references which
> are not defined graphically in gmf, e.g. I have following classes in my
> ecore domain model:
>
> class SequenceFlow{
> expression[0..1]: Expression;
> }
>
> class FormalExpression extends Expression { <- this class is not defined
> graphically
> body : EObject;
> language : EString;
> }
>
>
> I want to enable that when a user clicks on the SequenceFlow, he can
> define its expression, by instantiating
> the FormalExpression and populating the body with empty String and the
> language with asting. Then, user
> should enter body of the FormalExpression.
> What is the best strategy for this kind of situations (some example
> maybe?)?
>
> --
> Regards, Milan
Re: Implementation of non-graphical non-containament references [message #509551 is a reply to message #509529] Fri, 22 January 2010 20:38 Go to previous messageGo to next message
Milan Milanovich is currently offline Milan MilanovichFriend
Messages: 201
Registered: July 2009
Senior Member
Dear Ali,

I'm not sure that I follow this. The SequenceFlow is a node, and an FormalExpression is its property that should be instantiated and populated (i.e., its properties body and language) by a user in some tree-based style.

--
Regards, Milan
Re: Implementation of non-graphical non-containament references [message #509582 is a reply to message #509551] Sat, 23 January 2010 04:28 Go to previous messageGo to next message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
Hi Milan,

Actually, your property does not have to appear graphically but only in
the property view, Am I right ? And your expression is a string that
conforms to some BNF grammar ? If it is the case then this is not really
a GMF issue. Still, I don't think I have really understood what you aim
to do, do you have some sketch that you make this clear for me ?

Cheers.

Le 22/01/2010 21:38, Milan a écrit :
> Dear Ali,
>
> I'm not sure that I follow this. The SequenceFlow is a node, and an
> FormalExpression is its property that should be instantiated and
> populated (i.e., its properties body and language) by a user in some
> tree-based style.
>
> --
> Regards, Milan
Re: Implementation of non-graphical non-containament references [message #509586 is a reply to message #509582] Sat, 23 January 2010 11:34 Go to previous messageGo to next message
Milan Milanovich is currently offline Milan MilanovichFriend
Messages: 201
Registered: July 2009
Senior Member
Dear Ali,

Ali Koudri wrote on Fri, 22 January 2010 23:28
Hi Milan,

Actually, your property does not have to appear graphically but only in
the property view, Am I right ?


yes. But, I would like to show the Expression body as a label.

Ali Koudri wrote on Fri, 22 January 2010 23:28

And your expression is a string that
conforms to some BNF grammar ?


No, actually, it is a plain string, contained in the body property of the Expression.

Ali Koudri wrote on Fri, 22 January 2010 23:28

If it is the case then this is not really
a GMF issue. Still, I don't think I have really understood what you aim
to do, do you have some sketch that you make this clear for me ?


I have a Node (SequenceFlow), which have the Expression property. This expression have a body (EObject, which actually should be a String in this case), and a language (String). So, when a user click on the Node (SequenceFlow) in the diagram, I need to enable him to populate Expression properties (body and language) in property view.

--
Best regards, Milan
Re: Implementation of non-graphical non-containament references [message #509619 is a reply to message #509586] Sat, 23 January 2010 17:01 Go to previous messageGo to next message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
Le 23/01/2010 12:34, Milan a écrit :
> Dear Ali,
>
> Ali Koudri wrote on Fri, 22 January 2010 23:28
>> Hi Milan,
>>
>> Actually, your property does not have to appear graphically but only
>> in the property view, Am I right ?
>
>
> yes. But, I would like to show the Expression body as a label.
>

I don't get it, a label is a graphical element ! You define it in the
gmfgraph model.

> Ali Koudri wrote on Fri, 22 January 2010 23:28
>> And your expression is a string that conforms to some BNF grammar ?
>
>
> No, actually, it is a plain string, contained in the body property of
> the Expression.
>
> Ali Koudri wrote on Fri, 22 January 2010 23:28
>> If it is the case then this is not really a GMF issue. Still, I don't
>> think I have really understood what you aim to do, do you have some
>> sketch that you make this clear for me ?
>
>
> I have a Node (SequenceFlow), which have the Expression property. This
> expression have a body (EObject, which actually should be a String in
> this case), and a language (String). So, when a user click on the Node
> (SequenceFlow) in the diagram, I need to enable him to populate
> Expression properties (body and language) in property view.


So you just want to see the node representing your sequence flow,
automatically create an expression associated to it, and edit properties
of that expression in the node ? If this is what you want to use OCL to
express derived attributes, or use invisible rectangle as notational
element for the expression.
>
> --
> Best regards, Milan
>
Re: Implementation of non-graphical non-containament references [message #509640 is a reply to message #509619] Sat, 23 January 2010 22:33 Go to previous messageGo to next message
Milan Milanovich is currently offline Milan MilanovichFriend
Messages: 201
Registered: July 2009
Senior Member
Dear Ali,

Ali Koudri wrote on Sat, 23 January 2010 12:01
Le 23/01/2010 12:34, Milan a écrit :

> I have a Node (SequenceFlow), which have the Expression property. This
> expression have a body (EObject, which actually should be a String in
> this case), and a language (String). So, when a user click on the Node
> (SequenceFlow) in the diagram, I need to enable him to populate
> Expression properties (body and language) in property view.

So you just want to see the node representing your sequence flow,
automatically create an expression associated to it, and edit properties
of that expression in the node ? If this is what you want to use OCL to
express derived attributes, or use invisible rectangle as notational
element for the expression.



Yes, that's what I want to do. How OCL derived attributes can help here?

--
Regards, Milan
Re: Implementation of non-graphical non-containament references [message #509656 is a reply to message #509640] Sun, 24 January 2010 11:35 Go to previous message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
You could for instance declare two derivate attributes (body and
language) which are computed from its expression (self.body =
self.expression.body) and in the mapping, intanciate a new expression
(using Feature Seq Initializer) and perform the mapping between the
labels and the derived attributes.

Cheers.

Le 23/01/2010 23:33, Milan a écrit :
> Dear Ali,
>
> Ali Koudri wrote on Sat, 23 January 2010 12:01
>> Le 23/01/2010 12:34, Milan a écrit :
>>
>> > I have a Node (SequenceFlow), which have the Expression property. This
>> > expression have a body (EObject, which actually should be a String in
>> > this case), and a language (String). So, when a user click on the Node
>> > (SequenceFlow) in the diagram, I need to enable him to populate
>> > Expression properties (body and language) in property view.
>>
>> So you just want to see the node representing your sequence flow,
>> automatically create an expression associated to it, and edit
>> properties of that expression in the node ? If this is what you want
>> to use OCL to express derived attributes, or use invisible rectangle
>> as notational element for the expression.
>
>
> Yes, that's what I want to do. How OCL derived attributes can help here?
>
> --
> Regards, Milan
>
Previous Topic:Eclipse plug-in to build applications using WYGIWYS approach
Next Topic:InnerSideAffixedNode associated to a SideAffixedNode
Goto Forum:
  


Current Time: Thu Apr 15 23:55:47 GMT 2021

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

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

Back to the top