Question

Is there a way to specify a layout for children of a PolylineConnection?

I want to add several Labels to a PolylineConnection at ConnectionLocator.MIDDLE without the use of a container figure for the labels.

Both PolylineConnection and Label have EditParts, and the label's model objects are children of the polyline connection's model objects.

Ideally I want to add all label children of a polyline to ConnectionLocator.MIDDLE in a ToolbarLayout...

Was it helpful?

Solution 2

I've found a way to achieve what I wanted:

Very generally, the first child must be added at ConnectionLocator.MIDDLE, and the rest of the children relative to the child before them with the help of RelativeLocator like this (line would be in a loop over all figure children in connection's edit part):

figure.add(childFigure, 
           new RelativeLocator((IFigure) figureChildren.get(currentIndex - 1), 
                                   0.5, 
                                   1.7);

I've written a blog post with more details.

OTHER TIPS

What you are trying to do is mix two layouts: on the first hand you want to use a ConnectionLocator.MIDDLE to locate the figures, but on the other hand you want to have the figures at this location to have their own layout.

The only solution you have is to create a figure that uses a ToolbarLayout and locate it in the Polyline using the ConnectionLocator

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top