Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to get default size of a node
How to get default size of a node [message #208181] Thu, 09 October 2008 15:00 Go to next message
Eclipse UserFriend
Originally posted by: zzhangh.cn.ibm.com

Hi,
Suppose I have an instance of org.eclipse.gmf.runtime.notation.Node, using Node#getLayoutConstraint I can get its Bounds
instance, but mostly bounds.getWidth() and bounds.getHeight() return -1, unless I changed the node's size before. So the
question is how to get the node's default width and height, thanks!

Regards,
Hao
Re: How to get default size of a node [message #208318 is a reply to message #208181] Fri, 10 October 2008 21:44 Go to previous message
Eclipse UserFriend
Originally posted by: thomas.beyer.t-online.de

Hello Hao,

my experience: you simply can't!
If you do an auto-resize on the figure, the figure will not have width
and height constraints either (even if it had before).
I tried two steps to get the bounds:
1. Access the matching EditPart for this node and get the bounds from
there. If you do not have the editor open, you could use the
OffScreenEditPartFactory (not sure what the exact name is) or
CopyToImageUtil to create a DiagramEditPart from the notational Diagram
and go from there.
2. You could modify your save-routine in the generated DiagramEditor to
make sure, all nodes get persisted with height and width parameters in
the layout constraints. You should check, if you could live with
auto-resize side-effect that come with this approach. I remember, there
were some issues.

HTH & regards
Thomas


Hao Zhang schrieb:
> Hi,
> Suppose I have an instance of org.eclipse.gmf.runtime.notation.Node, using Node#getLayoutConstraint I can get its Bounds
> instance, but mostly bounds.getWidth() and bounds.getHeight() return -1, unless I changed the node's size before. So the
> question is how to get the node's default width and height, thanks!
>
> Regards,
> Hao
Previous Topic:recursive descend in a diagram
Next Topic:how to make GMF able to see the difference between association and aggregation from xsd.
Goto Forum:
  


Current Time: Thu Mar 28 13:36:29 GMT 2024

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

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

Back to the top