Provide own LayoutProvider [message #1738994] |
Tue, 26 July 2016 11:25  |
Eclipse User |
|
|
|
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?
Second question: Can I call a custom LayoutProvider in my services-class which handles the deletion?
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?
Thank you in Advance
Frank
|
|
|
Re: Provide own LayoutProvider [message #1738996 is a reply to message #1738994] |
Tue, 26 July 2016 11:54   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
Re: Provide own LayoutProvider [message #1742809 is a reply to message #1739976] |
Wed, 07 September 2016 14:22  |
Eclipse User |
|
|
|
Note: Pls delete the two posts before.
My Deletion Tool is now working as wanted. But there is a problem with the Layout Provider. Because, it only worked for elements which has a depth up to 3. For Elements with a depth higher than 3, the Layout Provider is not even called. So I can not restore these elements. Is it possible to enlarge the depth?
|
|
|
Powered by
FUDForum. Page generated in 0.04323 seconds