|
Re: Provide own LayoutProvider [message #1738996 is a reply to message #1738994] |
Tue, 26 July 2016 15:54 |
|
Hello,
You will find my answers below.
Regards,
Steve
[1]
https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom-arrange-all.html
Le 26/07/2016 à 17:25, Frank Sorek a écrit :
> Hi everyone,
>
> I have a few questions about the LayoutProvider. I know that Sirius
> offers the possibility to provide an own LayoutProvider. I tested a bit
> the functions and options. After deleting an element with a child (which
> is not removed), the child is re-arranged by the default Layout
> Provider. My intention is, that the child is re-arranged at the same
> position where it was before.
> First question: By deleting the element, can I store the position of
> that element and the position of the child to calculate the logical(hope
> this is the right one) position?
Yes, you can store the position in the LayoutDataManager. You can access
using the registry
LayoutDataManagerRegistry.getSiriusLayoutDataManagers(diagram);
You can create a new LayoutData to store in the manager using
LayoutDataHelper.INSTANCE.createNodeLayoutData(gmfNode, editPart,
parentLayoutData);
This is the manager used to store the location on copy/paste layout action.
> Second question: Can I call a custom LayoutProvider in my services-class
> which handles the deletion?
I am not sure to understand what you want to do here. As I see it, the
deletion tool should take care of the semantic model update process
(here move the child model element, delete the parent model element). As
there is an update, your custom layout is later triggered and in that
case you need to move the children element where the parent was.
> Another question belongs to the creation of Container/Nodes. When I
> create a container, a child-node which shows the label ist also created.
> The problem is the position where the node is created. I want that the
> node inside the container is centered automatically. Can I use also a
> custom LayoutProvider in that case (also to resize the node, because the
> Size Computation Expression only allows square, but I need a rectangular
> node) to re-arrange the node inside to the position I want?
You can provide several LayoutProvider, or use one for different kind of
EditPart. In the UML2 example in the documentation[1], different
LayoutProviders are returned depending on the EditPart to layout.
>
> Thank you in Advance
> Frank
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: Provide own LayoutProvider [message #1739471 is a reply to message #1739459] |
Tue, 02 August 2016 08:23 |
|
Hello,
1/ For the deletion, you should create a delete tool, as the default behaviour is not enough. In this tool, before adding a remove operation, your should call a java service that will store the location of the selected element. The you will use the stored location in your custom layout.
2/ I am not sure to understand the "child-node for the label", as a container also have a label, why do you need a child node for it? Anyway, when you create the container it should trigger a call in your custom layout "layoutEditParts" method for your new container allowing you to access its children and layout them.
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04076 seconds