Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to modify a position attribute in real time?
icon9.gif  How to modify a position attribute in real time? [message #665281] Thu, 14 April 2011 06:36 Go to next message
fenrir  is currently offline fenrir Friend
Messages: 15
Registered: April 2011
Location: France
Junior Member
Hi,

I'm beginner in GMF and I have to modify an attribute "position" (x/y) in a node in real time (every time we change object's position)
The problem is that I don't know where I have to put the code to do that ='(

Can you help me please?

Thanks,
Fenrir
Re: How to modify a position attribute in real time? [message #665295 is a reply to message #665281] Thu, 14 April 2011 08:17 Go to previous messageGo to next message
emil salageanu is currently offline emil salageanuFriend
Messages: 94
Registered: June 2010
Location: Nice, France
Member
Hello,

Find the edit part for that node. In the edit part, add this method:
protected void handleNotificationEvent(Notification notification) {
		super.handleNotificationEvent(notification);
          ..... my code here
  }



Check when your desired event occurs (the position modification, for instance) and execute your code.
You will probably need to create and execute a Command in order to change the value of your attribute.


Good Luck,

emil salageanu
www.activeeon.com









Re: How to modify a position attribute in real time? [message #665357 is a reply to message #665295] Thu, 14 April 2011 12:37 Go to previous messageGo to next message
fenrir  is currently offline fenrir Friend
Messages: 15
Registered: April 2011
Location: France
Junior Member
It works!

Thank you very much for your reply. =)


Re: How to modify a position attribute in real time? [message #665723 is a reply to message #665357] Fri, 15 April 2011 15:40 Go to previous messageGo to next message
Rahma  is currently offline Rahma Friend
Messages: 7
Registered: February 2011
Junior Member
Hi Fenrir,

I'm beginner in GMF and I have the same problem of the position, can you please give me the code that you put in the method "protected void handleNotificationEvent (Notification notification)"

I need your help.

Thanks,
Rahma.
Re: How to modify a position attribute in real time? [message #665918 is a reply to message #665723] Mon, 18 April 2011 07:29 Go to previous message
fenrir  is currently offline fenrir Friend
Messages: 15
Registered: April 2011
Location: France
Junior Member
Here is the code I included, the problem is that the position which is read is the element's last position (it's late of one movement)


//********************************************************** *****************
Point rect = this.getAbsoluteLocation(this);

BigInteger big1 = new BigInteger(""+rect.x);
BigInteger big2 = new BigInteger(""+rect.y);
EList<BigInteger> activation = new BasicEList<BigInteger>();
activation.add(big1);
activation.add(big2);
((ComponentImpl)this.getNotationView().getElement()).setActi vation_node(activation);


//********************************************************** ******************
I know this code isn't a must, but that's what I have to do^^

(sorry for the bad english)


Fenrir
Previous Topic:External labels on node - question on positioning
Next Topic:creating editors with gmf, nothing is drawn in the diagram
Goto Forum:
  


Current Time: Thu Mar 28 15:51:19 GMT 2024

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

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

Back to the top