Skip to main content



      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 02:36 Go to next message
Eclipse UserFriend
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 04:17 Go to previous messageGo to next message
Eclipse UserFriend
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 08:37 Go to previous messageGo to next message
Eclipse UserFriend
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 11:40 Go to previous messageGo to next message
Eclipse UserFriend
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 03:29 Go to previous message
Eclipse UserFriend
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: Tue Jul 22 15:20:16 EDT 2025

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

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

Back to the top