Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How To : Get compartment size for a layout implementation?
How To : Get compartment size for a layout implementation? [message #648962] Sun, 16 January 2011 18:25
Nigel is currently offline NigelFriend
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:[GMF + Debug] Displaying debugger annotations on a diagram
Next Topic:Select many elements, but only one is "activated"
Goto Forum:
  


Current Time: Fri Apr 19 00:37:39 GMT 2024

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

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

Back to the top