Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Get container size for a layout implementation
Get container size for a layout implementation [message #647527] Thu, 06 January 2011 18:44
Nigel is currently offline Nigel
Messages: 7
Registered: October 2010
Junior Member
Hi,

I'm implementing a custom layout provider and would like to ensure that
the contents of any compartments have the same layout applied. The
algorythm I'm applying needs to know the size of the nodes container. In
the case of the diagram I am using the following code:

Shell shell = new Shell();
Diagram diagram = node.getNode().getDiagram();
DiagramEditPart diagramEditPart =
OffscreenEditPartFactory.getInstance().createDiagramEditPart (diagram,
shell);
int maxX = diagramEditPart.getChildrenBounds().width;

In the case of any child nodes of the diagram I can use the following code:

Bounds bounds = (Bounds)node.getNode().getLayoutConstraint();
int nodeX = bounds.getWidth());

However it seems that the compartments do not provide a Bounds the
following code:

Bounds bounds = (Bounds)container.getLayoutConstraint();

returns a null rather than a bounds object. Can anyone suggest an
approach I can use to get the width of a compartment?

Thanks for any help or suggestions.

Best regards,

Nigel
Previous Topic:What's new in GMF 2.4M4?
Next Topic:One mapping element for several meta model elements
Goto Forum:
  


Current Time: Tue Oct 21 00:50:48 GMT 2014

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

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