[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Custom layout at diagram creation

Hi,

I wish to layout my nodes in a TopDown Layout, I create a diagram with default model elements in createInitialModel() method and create equivalent nodes with ViewService.createDiagram() and ViewService.createNode(),
Then I initialize bounds of my nodes using the following code :


Iterator entityNodeIterator = diagram.getChildren().iterator();;
int xMargin = 10;
int yMargin = 10;
int yCurrent = yMargin;
while(entityNodeIterator.hasNext()){
	Node entityNode = (Node) entityNodeIterator.next();
	Bounds bounds = (Bounds) entityNode.getLayoutConstraint();
	bounds.setX(xMargin);
	bounds.setY(yCurrent);
	yCurrent += bounds.getHeight()+yMargin;
	entityNode.setLayoutConstraint(bounds);
}

but my problem is that bounds.getHeight() == -1,

How can I initialize my node size to correct value depending of their content?

Thanks.