Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to automantically change node's layout according to the element's property?
how to automantically change node's layout according to the element's property? [message #482453] Wed, 26 August 2009 15:20 Go to next message
Bo Liu is currently offline Bo LiuFriend
Messages: 9
Registered: July 2009
Junior Member
Hi everyone,

What I want to do is listening to the diagram element's attribute and
change the node's layout according to that attribute which is defined in
EMF(could be edited from property view).

There is an attribute called: boolean isDesigned,
I want to listen the change of this isDesigned property and add/Delete one
vertical line in the node.

I tried to use PropertyChangeListener in the node's EditPart, and use
view.getElement() to get the element's emf object, but it does not allow
me to AddPropertyChangeListener to that Object. I could add that lestiner
to other objects such as warrapingLabel.

I think I have gone to the wrong way, and your help on this problem will
be much of my appreciation.

Kind Regards

Bo Liu
problem solved in a "naive" way, other solution/discussion is welcome [message #482514 is a reply to message #482453] Wed, 26 August 2009 20:39 Go to previous messageGo to next message
Bo Liu is currently offline Bo LiuFriend
Messages: 9
Registered: July 2009
Junior Member
Hi All,

This part of the problem is solved by overriding the outlineShape() in
rectangle, that method is called a lot while editing the diagram element,
so I just add a checking in this method while calling graphics.drawLine().

Now it works, while I change the attributes of the element, it could
redraw the node diagram with/without the line.

but it seems not to be quite a wise solution, anyone with a better
solution for discussion is welcomed.

Kind Regards

Bo Liu
Re: problem solved in a "naive" way, other solution/discussion is welcome [message #482575 is a reply to message #482514] Thu, 27 August 2009 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aurelien.pupier.esial.net

Hi,

I'm not sure to understand nut perhaps this can be take you on the right way :
http://wiki.eclipse.org/GMF_Tips#Making_figures_sensitive_to _attributes_of_semantic_elements

hoping this will help

Aurelien pupier

Bo Liu a écrit :
> Hi All,
>
> This part of the problem is solved by overriding the outlineShape() in
> rectangle, that method is called a lot while editing the diagram
> element, so I just add a checking in this method while calling
> graphics.drawLine().
>
> Now it works, while I change the attributes of the element, it could
> redraw the node diagram with/without the line.
> but it seems not to be quite a wise solution, anyone with a better
> solution for discussion is welcomed.
>
> Kind Regards
>
> Bo Liu
>
Re: how to automantically change node's layout according to the element's property? [message #482610 is a reply to message #482453] Thu, 27 August 2009 09:38 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Bo,

you need to modify ???EditPart.handleNotificationEvent() method and relayout
diagram node based on a notification received there.

-----------------
Alex Shatalin
thx for the reply, handleNotificationEvent is a better way. [message #482646 is a reply to message #482610] Thu, 27 August 2009 12:34 Go to previous message
Bo Liu is currently offline Bo LiuFriend
Messages: 9
Registered: July 2009
Junior Member
Hi Alex and Aurelien,

Thanks for the reply, the handleNotificationEvent() is absolutely a better
way.
I will try it in my new node.

Cheers

Bo Liu
Previous Topic:Diagram to XMI
Next Topic:cannot create second level node class in the GMF generated editor.
Goto Forum:
  


Current Time: Tue Apr 16 16:59:18 GMT 2024

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

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

Back to the top