How To : Get compartment size for a layout implementation? [message #648962] |
Sun, 16 January 2011 18:25 |
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
|
|
|
Powered by
FUDForum. Page generated in 0.01981 seconds