|Re: Arranging all nodes according to grid [message #1837685 is a reply to message #1837640]
||Thu, 04 February 2021 08:15
| Wilbert Alberts
Registered: June 2010
First of all, I got it working but still thanks for getting back to me.
I recon there are two relevant extensions:
- layoutProvider: is asked whether it provides a layouter for an IGraphicalEditPart
- viewOrderingProvider: is asked whether it provides an ordering for a DiagramElementMapping
I assumed that the viewOrderingProvider would be asked whether it can provide an ordering for any Sirius diagram as a whole. If my 'logging' is correct, than I think that this is not the case. My viewOrderingProvider is queried for each element on the diagram, but not for the diagram as a whole. Does this correspond with your expectations/knowledge?
If that's true, (if a viewOrderingProvider is not called for the diagram as a whole) then the only way to layout the diagram elements on a grid, is to create an extension of GridLayoutProvider and provide it via the layoutProvider extension.
So here's what I did:
- create an org.eclipse.sirius.diagram.ui.layoutProvider extension that provides a layouter for my kind of diagram.
- create the implementation of the layouter by extending the GridLayoutProvider
- in my layouter implementation, I overrid:
- layoutEditParts and layoutLayoutNodes (but I am not sure whether both need to be overriden) to ensure that the colum and line size modes were set to DIMENSION_BY_LINE_OR_C)LUMN
- buildGrid to create a grid containing the nodes that I want to be layouted accordingly.
By this, I got my diagram layoutted the way I wanted. (Just writing it down here in case someone has a similar task at hand.)
[Updated on: Thu, 04 February 2021 08:15]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01551 seconds