Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How can I store the bounds information in the model features?
How can I store the bounds information in the model features? [message #221787] Wed, 18 March 2009 11:33 Go to next message
tsangpo is currently offline tsangpoFriend
Messages: 1
Registered: July 2009
Junior Member
I want to store the bounds in the ecore model, for example, XXX.x, XXX.y,
XXX.width, XXX.height.
I found that these information is store seperately as the diagram notation.
How can I bind the bounds with my model feature, so I change the x of the
model, then will change the location of the figure displayed, and I drag
the figure will change the feature x of the model.
I'm new in gmf, is my requirement so spectial?
Thanks!
Re: How can I store the bounds information in the model features? [message #221811 is a reply to message #221787] Wed, 18 March 2009 16:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cayla_sha.gmx.net

Hello!

I did this in my editor. My node has two attributes: XPosition and
YPosition. So they´re automatically shown on the properties-tab. When
the user enters a new value for one of the attributes, the node moves
accordingly. In turn, when the user moves the node, I have to set the x
and y-values in GMF.

For that feature you have to do the following:

- when the user moves the shape, you have to catch this call and set the
X- and YPosition.
For that I overwrote the method handleNotificationEvent() in the
EditPart of the node. There I catch the call when the node was moved and
then I set the attributes X- and YPosition according to the place where
the user moved the node.

- when the user enters a value for X- or YPosition you need to move the
node.
This call is also catched in handleNotificationEvent(). I set x and y in
GMF and call refreshBounds().

To find the right events to catch please implement empty
handleNotificationEvent-Method and debug it.

Hope that helps
Best wishes
Julia


tsangpo schrieb:
> I want to store the bounds in the ecore model, for example, XXX.x,
> XXX.y, XXX.width, XXX.height. I found that these information is store
> seperately as the diagram notation.
> How can I bind the bounds with my model feature, so I change the x of
> the model, then will change the location of the figure displayed, and I
> drag the figure will change the feature x of the model.
> I'm new in gmf, is my requirement so spectial?
> Thanks!
>
Re: How can I store the bounds information in the model features? [message #221924 is a reply to message #221811] Thu, 19 March 2009 13:57 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Cayla,

Another option is to store positions directly in domain model and patch generated
code in accordance, but this is definitely more "advanced/compicated" way.
In case you are interested in it - you can have a look on org.eclipse.gmf.graphdef.editor
plugin.

-----------------
Alex Shatalin
Previous Topic:Setting properties into GMF
Next Topic:Prolem with composite figure
Goto Forum:
  


Current Time: Fri Apr 26 15:22:48 GMT 2024

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

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

Back to the top