Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How can I generate children for a node?
How can I generate children for a node? [message #83040] Tue, 05 December 2006 09:59 Go to next message
Eclipse UserFriend
Originally posted by: christian.daenekas.informatik.uni-oldenburg.de

Hi there!

I´ve got a specific node in my editor for which I´d like to create child
elements from another class. I´ve defined a compartment similar to the
Mindmap Example (part 2). I can create a node and create another element
(which is represented by its label like the ThreadItems from the
example) inside this node manually by using the palette. It semantically
represents a parameter for the parentnode. What I want to do is
something different. When I create the parentnode I specify an ID. After
I´ve done that I look up the ID from some datastorage (XML for example).
There is specified which parameters the node requires and how they are
named. They corresponding child elements (parameters) shall now be
created (using the names found in the datasource as the labels) both in
the graphical and semantical model. Any idea how I can manage this? Help
would be very appreciated.

Greeting,
Christian
Re: How can I generate children for a node? [message #83651 is a reply to message #83040] Wed, 06 December 2006 08:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.daenekas.informatik.uni-oldenburg.de

anyone? It would already help if I´d find the methods/classes that are
responsible for creating/modifying nodes so that I can modify them for
the node that should have parameters when its ID attribute is specified.

Christian Dänekas wrote:
> Hi there!
>
> I´ve got a specific node in my editor for which I´d like to create child
> elements from another class. I´ve defined a compartment similar to the
> Mindmap Example (part 2). I can create a node and create another element
> (which is represented by its label like the ThreadItems from the
> example) inside this node manually by using the palette. It semantically
> represents a parameter for the parentnode. What I want to do is
> something different. When I create the parentnode I specify an ID. After
> I´ve done that I look up the ID from some datastorage (XML for example).
> There is specified which parameters the node requires and how they are
> named. They corresponding child elements (parameters) shall now be
> created (using the names found in the datasource as the labels) both in
> the graphical and semantical model. Any idea how I can manage this? Help
> would be very appreciated.
>
> Greeting,
> Christian
Re: How can I generate children for a node? [message #83682 is a reply to message #83651] Wed, 06 December 2006 08:25 Go to previous messageGo to next message
Eclipse UserFriend
Hello Christian,

???ItemSemanticEditPolicy class will be generated for each diagram node with
possible child elements/outgoing-/incomming- links. You can take a looks
on the generated EditPolicy for the desired compartment and modify generated
code as you wish.

-----------------
Alex Shatalin
Re: How can I generate children for a node? [message #83740 is a reply to message #83682] Wed, 06 December 2006 09:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.daenekas.informatik.uni-oldenburg.de

Thanks,

i´ll take a look at that. Will both the semantic and graphical models be
affected by the changes performed there? It´s important that the
parameters are present semantically as well as graphically as labels in
the parent node (which i´ve called operator), so that i can select the
parameters and specify values for them.

Greetings,
Christian

Alex Shatalin wrote:
> Hello Christian,
>
> ???ItemSemanticEditPolicy class will be generated for each diagram node
> with possible child elements/outgoing-/incomming- links. You can take a
> looks on the generated EditPolicy for the desired compartment and modify
> generated code as you wish.
>
> -----------------
> Alex Shatalin
>
>
Re: How can I generate children for a node? [message #83755 is a reply to message #83740] Wed, 06 December 2006 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Hello Christian,

It depends on your configuration, but I thinkg graphical part of the model
should be corrected only in the place of parsing/combining the labels - quite
located part.


-----------------
Alex Shatalin
How to create elements in semantic/graphical layer by listening to events? [message #84059 is a reply to message #83755] Thu, 07 December 2006 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.daenekas.informatik.uni-oldenburg.de

This is a multi-part message in MIME format.
--------------080604040406080001030300
Content-Type: text/plain; charset=UTF-7
Content-Transfer-Encoding: 8bit

Hello again,

I+ALQ-m really somewhat puzzled about this whole issue. I understand it this
way:

When an attribute of a node is changed, an event is generated by

public void notifyChanged(Notification notification)

in the ..ItemProvider class. As I understand it by now the events are
handled by

protected void handleNotificationEvent(Notification event)

in the diagram.edit.parts.[...]EditPart classes.
I think I need general advice on how events must be handled an new
elements can be created (persistent in all model-layers).

I+ALQ-ve made some pics of what I want to do. I insert a new node which has
an attribute id. By standard the id isn+ALQ-t specified. This look like in
"no+AF8-id.jpg". Now i specify the id to "testid" This id is stored
somewhere (e.g. xml-file) and it+ALQ-s specified that testid must have two
parameters "testparameter1" and "testparameter2". So after the id was
specified the node looks like "id+AF8-specified.jpg" and the parameters are
also stored in the semantic layer. Maybe you or someone else can help me
out a bit further. I+ALQ-m using GMF 2.0M2.

Thanks in advance

Alex Shatalin schrieb:
> Hello Christian,
>
> It depends on your configuration, but I thinkg graphical part of the
> model should be corrected only in the place of parsing/combining the
> labels - quite located part.
>
>
> -----------------
> Alex Shatalin
>
>


--------------080604040406080001030300
Content-Type: image/jpeg;
name="id_specified.JPG"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="id_specified.JPG"

/9j/4AAQSkZJRgABAQEAYABgAAD/4QAWRXhpZgAASUkqAAgAAAAAAAAAAAD/ 2wBDAAgGBgcG
BQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx NDQ0Hyc5PTgy
PC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIy MjIyMjIyMjIy
MjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABtAJADASIAAhEBAxEB/8QAHwAA AQUBAQEBAQEA
AAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQR BRIhMUEGE1Fh
ByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RF RkdISUpTVFVW
V1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip qrKztLW2t7i5
usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEB
AQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEE BSExBhJBUQdh
cRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNE RUZHSElKU1RV
VldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaan qKmqsrO0tba3
uLm6wsPExcbHy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EHdk8ZJram+4P99f/ AEIVy1tcX8Hi
a2s01+XVZ95/tO18qFYrOMxsysAih0Jfywqu7kozH5tpdepm+4P99f8A0IUA S0UUUAFRS/wk
DO1s4/T+tS0UARecv91/+/bf4Vh6P4fsNFv7+6t1fddSZRfKYCFMDKL7bsnt xtHRRXQ0UJta
ILmZqlpBqtg1pN56AukiSRqQ0ciOHRxkEZVlVsEEHGCCMistvDwFxK8et6zC tzsa9SIRr9qc
IsZdm8rcjMiKD5TJjGVCnmunooA5yXw/Z3lxeyanc3t+lzbzWqxTIEWGCUjz I08tFODtQZYs
w2jBGTmgnhrUv7dnvR4m1SNHs4Lfzo4bcyzMkk7kuGgKAASqF2gd854NdlRQ ByJ8HadEIYrK
81GzsYZbaZrGFVaOV7fyxGWZ42k6QxKdrDIT1JJsDwzbwafpNtY6hqNlNpdq LKC7iRGkMOEB
Vg8bIcmKMk7QcrwQCQemooA5Ww8IaZpukDTIZb1oBcWlxucZbdbLAsY4XGCL ZM8d2xjIw+48
NW8mpXGpWl/qNhqFxK0huIERiqtHDGyBZI2Xafs8R5G7K8EAkV09FAHM33hi y1Gzgt7q71F2
SKW3mmZsvcwzEGaN8qQFcqv3ApXACFBxRF4cB1Oxvr7WtY1CawlaWATrGiKW jeNsrFEgbIfq
ckY4IBYN01FAHM6L4fl0QQRx6/rFzbQ7s29xDAVkLZJZ2WFXZixLFt2S3JJy c75cSEBUY8gk
sCoGDnuKnooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA KKKKAP/Z
--------------080604040406080001030300
Content-Type: image/jpeg;
name="no_id.JPG"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="no_id.JPG"

/9j/4AAQSkZJRgABAQEAYABgAAD/4QAWRXhpZgAASUkqAAgAAAAAAAAAAAD/ 2wBDAAgGBgcG
BQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx NDQ0Hyc5PTgy
PC4zNDL/2wBDAQkJ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SH
V7u+XVxESbCW3FvDGmRlolVnWT/lnubzZdhbGY95Wtez1vT7/wDs/wCzXHmf 2ham9tfkYeZC
NmW5HH+tTg4PzdODhEmnUQ/4+H/3F/ma5LVNY+1/Y77w5fX019dWsc8NrDbe fDNC2Sjyo7II
uC5UmSIsVwd+wJXT23ntta4SOOcxoZEjcuqtzkBiASM98DPoKALdFFFABRRR QAUUUUAFRD/j
4f8A3F/malqq9vDNct5sUchCLjeoOOTQBN5aiQyBRvIALY5IGcD9T+dSVW+w Wn/PrB/37FH2
C0/59YP+/YoAs0VW+wWn/PrB/wB+xR9gtP8An1g/79igCzUQ/wCPh/8AcX+Z qP7Baf8APrB/
37FLFDFDO6xRpGCqkhVA7mgCxRRRQAUUUUAFFFFABUbISwdGAbGORkGpKKAI sTf34/8Avg/4
0Ym/vx/98H/GpaKAIsTf34/++D/jRib+/H/3wf8AGpaKAI8Tf30/74P+NCIV yWYsT19PwFSU
UAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQ AUUUUAFFFFAB
RRRQAUUUUAFFFFAH/9k=
--------------080604040406080001030300--
Re: How to create elements in semantic/graphical layer by listening to events? [message #84078 is a reply to message #84059] Thu, 07 December 2006 12:07 Go to previous messageGo to next message
Eclipse UserFriend
Christian Dänekas wrote:

Hi Christian;

I'll try to explain how to implement this form the Runtime point of view

EditParts handle EMF events in the handleNotificationEvent, so in your
case i would expect that your edit part will listen to the EMF event
generated when you create/change the ID, then in response it will need
to create the 2 semantic elements for the parameters, also there should
be a canonical edit policy listening to the element owning the
parameters, This canonical edit policy should be installed on the
compartments that will contains these parameters. So as soon as you
create the semantic elements for the parameters the canonical edit
policy will kick in and create the views for these parameters, this will
trigger a refresh on the compartment which will result in creating the
edit parts for these parameters.

If you provide me with more specifics about your case, i might be able
to explain in more details



> Hello again,
>
> I´m really somewhat puzzled about this whole issue. I understand it this
> way:
>
> When an attribute of a node is changed, an event is generated by
>
> public void notifyChanged(Notification notification)
>
> in the ..ItemProvider class. As I understand it by now the events are
> handled by
>
> protected void handleNotificationEvent(Notification event)
>
> in the diagram.edit.parts.[...]EditPart classes.
> I think I need general advice on how events must be handled an new
> elements can be created (persistent in all model-layers).
>
> I´ve made some pics of what I want to do. I insert a new node which has
> an attribute id. By standard the id isn´t specified. This look like in
> "no_id.jpg". Now i specify the id to "testid" This id is stored
> somewhere (e.g. xml-file) and it´s specified that testid must have two
> parameters "testparameter1" and "testparameter2". So after the id was
> specified the node looks like "id_specified.jpg" and the parameters are
> also stored in the semantic layer. Maybe you or someone else can help me
> out a bit further. I´m using GMF 2.0M2.
>
> Thanks in advance
>
> Alex Shatalin schrieb:
>> Hello Christian,
>>
>> It depends on your configuration, but I thinkg graphical part of the
>> model should be corrected only in the place of parsing/combining the
>> labels - quite located part.
>>
>>
>> -----------------
>> Alex Shatalin
>>
>>
>
>
> ------------------------------------------------------------ ------------
>
>
> ------------------------------------------------------------ ------------
>
Re: How to create elements in semantic/graphical layer by listening to events? [message #84093 is a reply to message #84078] Thu, 07 December 2006 12:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.daenekas.informatik.uni-oldenburg.de

If I understand your explanation correctly the place to create the
elements that end up in the compartment is the handleNotificationEvent
method. There is a OperatorIdEditPart class that i think is the right
one (Operator is the class and Id its attribute). The
handleNotificationEvent method looks like this (generated code):

protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(f eature)) {
Integer c = (Integer) event.getNewValue();
setFontColor(DiagramColorRegistry.getInstance().getColor(c)) ;
} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(
feature)) {
refreshUnderline();
} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough()
.equals(feature)) {
refreshStrikeThrough();
} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(
feature)
|| NotationPackage.eINSTANCE.getFontStyle_FontName().equals(
feature)
|| NotationPackage.eINSTANCE.getFontStyle_Bold()
.equals(feature)
|| NotationPackage.eINSTANCE.getFontStyle_Italic().equals(
feature)) {
refreshFont();
} else {
if (getParser() != null
&& getParser().isAffectingEvent(event,
getParserOptions().intValue())) {
refreshLabel();
}
if (getParser() instanceof ISemanticParser) {
ISemanticParser modelParser = (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
super.handleNotificationEvent(event);
}


So all I´ve got is the event. Now the information I need is which
operator element caused the event (so that I can create the parameters
for the correct element), what the Id attribute value of this element is
so that i can look up if there are parameters to specify and what names
they have (the names end up as label figures in the node). What I did
not understand yet I think is how the creation of semantic elements
works. The rest of the process should work automatically, if I got you
right. This is all information i can think of that may be relevant.

Thanks in advance

Mohammed Mostafa schrieb:
> Christian Dänekas wrote:
>
> Hi Christian;
>
> I'll try to explain how to implement this form the Runtime point of view
>
> EditParts handle EMF events in the handleNotificationEvent, so in your
> case i would expect that your edit part will listen to the EMF event
> generated when you create/change the ID, then in response it will need
> to create the 2 semantic elements for the parameters, also there should
> be a canonical edit policy listening to the element owning the
> parameters, This canonical edit policy should be installed on the
> compartments that will contains these parameters. So as soon as you
> create the semantic elements for the parameters the canonical edit
> policy will kick in and create the views for these parameters, this will
> trigger a refresh on the compartment which will result in creating the
> edit parts for these parameters.
>
> If you provide me with more specifics about your case, i might be able
> to explain in more details
Re: How to create elements in semantic/graphical layer by listening to events? [message #84107 is a reply to message #84078] Thu, 07 December 2006 13:03 Go to previous messageGo to next message
Eclipse UserFriend
Hello Mohammed,

> I'll try to explain how to implement this form the Runtime point of
> view
To generate the code for this situation we can suppose that parameters are
just a normal child-nodes of this diagram nodes - generated CanonicalEditPolicy
should update diagram correctly on receiving corresponding event from domain
(semantic) model.

-----------------
Alex Shatalin
Re: How to create elements in semantic/graphical layer by listening to events? [message #84515 is a reply to message #84078] Sun, 10 December 2006 06:28 Go to previous message
Eclipse UserFriend
Originally posted by: christian.daenekas.informatik.uni-oldenburg.de

Do you need any more information than I provided in my other post? Maybe
you have any helpful links about the handlng of events in GMF and how I
can get the desired information from it.

Greetings,
Christian

Mohammed Mostafa schrieb:
> Christian Dänekas wrote:
>
> Hi Christian;
>
> I'll try to explain how to implement this form the Runtime point of view
>
> EditParts handle EMF events in the handleNotificationEvent, so in your
> case i would expect that your edit part will listen to the EMF event
> generated when you create/change the ID, then in response it will need
> to create the 2 semantic elements for the parameters, also there should
> be a canonical edit policy listening to the element owning the
> parameters, This canonical edit policy should be installed on the
> compartments that will contains these parameters. So as soon as you
> create the semantic elements for the parameters the canonical edit
> policy will kick in and create the views for these parameters, this will
> trigger a refresh on the compartment which will result in creating the
> edit parts for these parameters.
>
> If you provide me with more specifics about your case, i might be able
> to explain in more details
>
>
>
>> Hello again,
>>
>> I´m really somewhat puzzled about this whole issue. I understand it this
>> way:
>>
>> When an attribute of a node is changed, an event is generated by
>>
>> public void notifyChanged(Notification notification)
>>
>> in the ..ItemProvider class. As I understand it by now the events are
>> handled by
>>
>> protected void handleNotificationEvent(Notification event)
>>
>> in the diagram.edit.parts.[...]EditPart classes.
>> I think I need general advice on how events must be handled an new
>> elements can be created (persistent in all model-layers).
>>
>> I´ve made some pics of what I want to do. I insert a new node which has
>> an attribute id. By standard the id isn´t specified. This look like in
>> "no_id.jpg". Now i specify the id to "testid" This id is stored
>> somewhere (e.g. xml-file) and it´s specified that testid must have two
>> parameters "testparameter1" and "testparameter2". So after the id was
>> specified the node looks like "id_specified.jpg" and the parameters are
>> also stored in the semantic layer. Maybe you or someone else can help me
>> out a bit further. I´m using GMF 2.0M2.
>>
>> Thanks in advance
>>
>> Alex Shatalin schrieb:
>>> Hello Christian,
>>>
>>> It depends on your configuration, but I thinkg graphical part of the
>>> model should be corrected only in the place of parsing/combining the
>>> labels - quite located part.
>>>
>>>
>>> -----------------
>>> Alex Shatalin
>>>
>>>
>>
>> ------------------------------------------------------------ ------------
>>
>>
>> ------------------------------------------------------------ ------------
>>
Previous Topic:How to make setSelection having event from TreeView - EditPart for known EObject
Next Topic:problem with managing layout model
Goto Forum:
  


Current Time: Wed Jul 23 10:12:21 EDT 2025

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

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

Back to the top