Bug 539778 - [ELK] Layout initialization of container elements
Summary: [ELK] Layout initialization of container elements
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 6.0.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 6.4.0   Edit
Assignee: Laurent Redor CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on: 568037
Blocks: 552747
  Show dependency tree
 
Reported: 2018-10-04 03:10 EDT by Frédéric Madiot CLA
Modified: 2020-12-17 03:09 EST (History)
4 users (show)

See Also:


Attachments
The default diagram layout (18.10 KB, image/png)
2018-10-04 03:10 EDT, Frédéric Madiot CLA
no flags Details
The diagram after clicking on "arrange all" (13.29 KB, image/png)
2018-10-04 03:10 EDT, Frédéric Madiot CLA
no flags Details
The odesign and a sample model (24.84 KB, application/x-zip-compressed)
2018-10-04 03:16 EDT, Frédéric Madiot CLA
no flags Details
mindstorms-mmAndModeler.zip (215.97 KB, application/x-zip-compressed)
2019-10-31 11:11 EDT, Laurent Redor CLA
no flags Details
mindstorms-sample.zip (4.83 KB, application/x-zip-compressed)
2019-10-31 11:11 EDT, Laurent Redor CLA
no flags Details
TestElkLayout.zip (5.75 KB, application/x-zip-compressed)
2019-11-13 05:28 EST, Laurent Redor CLA
no flags Details
ELKLayoutProblems.zip (41.86 KB, application/x-zip-compressed)
2020-10-20 09:53 EDT, Laurent Redor CLA
no flags Details
ELKLayoutProblems.zip (49.96 KB, application/x-zip-compressed)
2020-10-20 12:25 EDT, Laurent Redor CLA
no flags Details
ELKLayoutProblems.zip (53.68 KB, application/x-zip-compressed)
2020-10-20 13:59 EDT, Laurent Redor CLA
no flags Details
bugzilla539778_arrangeContainer.png: The result in 6.4.0 (compared with before). (53.93 KB, image/png)
2020-12-17 03:09 EST, Laurent Redor CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Madiot CLA 2018-10-04 03:10:01 EDT
Created attachment 276122 [details]
The default diagram layout

When a diagram is created with an ELK algorithm, the layout is automatically applied to first level diagram elements, but not to nodes contained in containers (screenshot init.png)

The user has to click on the "Arrange All" button to apply the layout to sub-nodes (screenshot arrange-all.png)
Comment 1 Frédéric Madiot CLA 2018-10-04 03:10:49 EDT
Created attachment 276123 [details]
The diagram after clicking on "arrange all"
Comment 2 Frédéric Madiot CLA 2018-10-04 03:16:25 EDT
Created attachment 276124 [details]
The odesign and a sample model

The domain model is here: http://eclipse.org/sirius/resources/mindstorms-tutorial/solution1.zip
Comment 3 Pierre Guilet CLA 2018-11-19 13:27:34 EST
The model project is missing to reproduce
Comment 4 Laurent Redor CLA 2019-10-31 07:13:49 EDT
There are several problems:
* First of all, currently "stap to" features are not supported by ELK layouts. So you have to disable these preferences by default (Preferences/Sirius/Sirius Diagram/Rulers And Grid).
* There is a bug concerning some specific kind of edit parts (AbstractDNodeContainerCompartmentEditPart and AbstractDNodeListCompartmentEditPart). For these edit parts, the method org.eclipse.sirius.diagram.ui.business.api.query.EditPartQuery.getDiagramDescription() returns null. And so the ELK Layout associated with the diagram description is not retrieved and a default layout is used.
Comment 5 Eclipse Genie CLA 2019-10-31 11:02:06 EDT
New Gerrit change created: https://git.eclipse.org/r/151843
Comment 6 Laurent Redor CLA 2019-10-31 11:03:42 EDT
The above gerrit is a proposition of fix (maybe for Sirius 6.3.1). It is too late for Sirius 6.3.0.
Comment 7 Laurent Redor CLA 2019-10-31 11:10:58 EDT
Steps to validate:
* Ensure that Graphviz is installed on your computer (if not install it through http://graphviz.org/download/)
* Correctly configure Graphviz (preference "Eclipse Diagram Layout/Graphviz/Path to 'dot' executable".
* Import meta-mode and modeler projects in your workspace (from mindstorms-mmAndModeler.zip)
* Launch a runtime
* Import sample project in your runtime (from mindstorms-sample.zip)
* Open session from project fr.obeo.dsl.tuto.mindstorms.sample
* Disable the "snap to" features in the preferences (Preferences/Sirius/Sirius Diagram/Rulers And Grid). They are currently not supported by ELK layouts.
* Create a new "Choreography Diagram" under "Choreogrpay Main"
* Expected: All nodes must be correctly layouted (as the existing diagram).
Comment 8 Laurent Redor CLA 2019-10-31 11:11:17 EDT
Created attachment 280481 [details]
mindstorms-mmAndModeler.zip
Comment 9 Laurent Redor CLA 2019-10-31 11:11:33 EDT
Created attachment 280482 [details]
mindstorms-sample.zip
Comment 10 Eclipse Genie CLA 2019-11-06 10:20:33 EST
New Gerrit change created: https://git.eclipse.org/r/152159
Comment 11 Laurent Redor CLA 2019-11-13 05:28:38 EST
Created attachment 280618 [details]
TestElkLayout.zip

Steps to validate
* Ensure that Graphviz is installed on your computer (if not, install it through http://graphviz.org/download/)
* Correctly configure Graphviz (preference "Eclipse Diagram Layout/Graphviz/Path to 'dot' executable").
* Import project TestElkLayout (form TestElkLayout.zip)
* Open session from project TestElkLayout
* Disable the "snap to" features in the preferences (Preferences/Sirius/Sirius Diagram/Rulers And Grid). They are currently not supported by ELK layouts.
* Create a new "SimpleDiagram" under the "root" package
* Expected: All nodes must be correctly layouted: C1, C2, C3 and C4 on the same line and following each other (as the existing diagram "expectedDiagram"). It must not be as the diagram "diagramWithPb".
Comment 12 Laurent Redor CLA 2020-03-25 08:49:22 EDT
Currently, this issue is interrupted.
Comment 13 Laurent Redor CLA 2020-10-20 09:53:58 EDT
Created attachment 284523 [details]
ELKLayoutProblems.zip

Another steps to validate is:
* Import project ELKLayoutProblems_A (from ELKLayoutProblems.zip)
* On root package create a new ContainerNodeAndBorderNodeDiagram
* Expected: The result is like in diagram "containerNodeAndBorderNodeDiagram" from "ELKLayoutProblems_resultA"
* On root package create a new ContainerNodeAndBorderNodeDiagramWithELK
* Expected: The result is like in diagram "containerNodeAndBorderNodeDiagramWithELK" from "ELKLayoutProblems_resultA"
(before this issue, an arrange all was necessary to have the same result)
Comment 14 Laurent Redor CLA 2020-10-20 10:14:45 EDT
This gerrit https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/151843 (merged in branch 6.1.x through https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/152159) seems finally not necessary after works done for bug 568037 (concerning "arrange selection"). A small part of the original gerrit has been moved to https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171014.

The problem detected about the several "arranges" is no longer problematic. The behavior is now similar between ELK and classic layout.
Comment 15 Laurent Redor CLA 2020-10-20 12:24:49 EDT
When diagram contains edges between nodes of several hierarchy, the above gerrit finally seems necessary.

Steps to validate:
* Import ELKLayoutProblems_E (from ELKLayoutProblems.zip)
*  On root package create a new ContainerNodeAndBorderNodeDiagramWithELK
* Expected: The result is like in diagram "Expected_ContainerNodeAndBorderNodeDiagramWithELK"
(before this issue, an arrange all was necessary to have the same result).
Comment 16 Laurent Redor CLA 2020-10-20 12:25:07 EDT
Created attachment 284526 [details]
ELKLayoutProblems.zip
Comment 17 Laurent Redor CLA 2020-10-20 13:58:50 EDT
There is another problem when the new diagram contains hidden elements (hidden labels of border nodes for exemple). In this case, a InitializeHiddenElementsCommand is executed during AbstractDDiagramEditPart activation (before the launchArrangeCommandOnOpening launched by the SiriusCanonicalLayoutHandler in DDiagramEditorImpl.initializeGraphicalViewer()). This execution triggers an arrange all but without considering the specific aspect of ELK. So we are agian in a case where several arrange are launched.
We can ignore this operation 
Layout is not necessary in this case of operation because it will be done later by SiriusCanonicalLayoutHandler.launchArrangeCommandOnOpening. It allows to:
* launch less arrange commands (perf)
* avoid problem for ELK layout.

Steps to validate:
* Import ELKLayoutProblems_E (from ELKLayoutProblems.zip)
* On root package create a new ContainerNodeAndBorderNodeDiagramWithELKWithHiddenLabel
* Expected: The result is like in diagram "Expecetd_ContainerNodeAndBorderNodeDiagramWithELKWithHiddenLabel"
(before this issue, an arrange all was necessary to have the same result).
Comment 18 Laurent Redor CLA 2020-10-20 13:59:06 EDT
Created attachment 284527 [details]
ELKLayoutProblems.zip
Comment 19 Eclipse Genie CLA 2020-10-29 14:24:36 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171468
Comment 22 Laurent Redor CLA 2020-11-06 05:03:43 EST
There are several steps to validate:
* comment 11
* comment 13
* comment 15
* comment 17
Comment 23 Pierre-Charles David CLA 2020-12-04 04:23:40 EST
Available in Sirius 6.4.0, see https://download.eclipse.org/sirius/updates/releases/6.4.0/ for details.
Comment 24 Laurent Redor CLA 2020-12-17 03:09:59 EST
Created attachment 285063 [details]
bugzilla539778_arrangeContainer.png: The result in 6.4.0 (compared with before).