|
Re: Arranging all nodes according to grid [message #1837640 is a reply to message #1837270] |
Wed, 03 February 2021 14:34 |
|
Hi Wilbert,
You may have solved your issue since last week but when you say the AbstractViewOrdering extension didn't work, you mean the extension is never called?
The view ordering provided by the extension point are populated here: org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDDiagramEditPart.populateViewOrderings(). It might be a good entry point to see what happens.
Regards,
Florian
|
|
|
Re: Arranging all nodes according to grid [message #1837685 is a reply to message #1837640] |
Thu, 04 February 2021 08:15 |
Wilbert Alberts Messages: 210 Registered: June 2010 |
Senior Member |
|
|
Hi Florian,
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.)
Regards,
Wilbert
[Updated on: Thu, 04 February 2021 08:15] Report message to a moderator
|
|
|
Re: Arranging all nodes according to grid [message #1837745 is a reply to message #1837685] |
Fri, 05 February 2021 08:08 |
|
Indeed, the viewOrdering is intended to make it possible to provide your own ordering for the children of a given view. The viewOrderingProvider that provides the viewOrdering is selected on a particular mapping.
I do not see a simpler way than implementing your own GridLayoutProvider.
Thanks for your feedback!
Regards,
Florian
|
|
|
Powered by
FUDForum. Page generated in 0.03919 seconds