|
Re: Initial layout of figures on canvas for new diagram is cluttered [message #637603 is a reply to message #637335] |
Sun, 07 November 2010 15:57 |
|
Hi,
If I understand you correctly, you are trying to anagrammatically create a diagram corresponding to a domain object, save it to a file and open it again on an editor.
I think you will have to set the layout information just after creating the diagram using the notational model. The code would look something like below:
Diagram diagram = ViewService.createDiagram(....);
for (Object view : diagram.getChildren()) {
if (view instanceof Node) {
Node node = (Node) view;
LayoutConstraint layoutData = node.getLayoutConstraint();
if (layoutData instanceof Bounds) {
((Bounds) layoutData).setX(0); // calculated x (you need to come up with an algorithm)
((Bounds) layoutData).setY(0); // same
((Bounds) layoutData).setWidth(0); // same
((Bounds) layoutData).setHeight(0); // same
}
}
}
Although I should mention that I have never done something like this myself, this is just a suggestion
Hope this helps.
- Asiri
|
|
|
Powered by
FUDForum. Page generated in 0.03643 seconds