Bug 582089 - Wrong figure auto-size layout of RegionContainer and layout of Region contents
Summary: Wrong figure auto-size layout of RegionContainer and layout of Region contents
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 7.0.8   Edit
Assignee: Maxime Porhel CLA
QA Contact: Maxime Porhel CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 582091 582090
  Show dependency tree
 
Reported: 2023-06-20 04:18 EDT by Maxime Porhel CLA
Modified: 2023-06-25 08:31 EDT (History)
1 user (show)

See Also:


Attachments
Case 4 (639.91 KB, image/png)
2023-06-20 04:34 EDT, Maxime Porhel CLA
no flags Details
Cases 1, 2, 3 (501.09 KB, image/png)
2023-06-20 04:35 EDT, Maxime Porhel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2023-06-20 04:18:40 EDT
Steps to reproduce: 
* With 
  * Sirius 7.0.x or 7.1.x
  * With BPMN Designer (https://github.com/ObeoNetwork/BPMN-Designer)
  * Import the Travel Agency sample
* Case #1
  * Create a Collaboration diagram
  * Select the tool "Participant et un processus existant"
  * Single click on the diagram 
  * Select "Travel Agency" in the wizard.
  * Layout "KO" :
    * Region content is centered, 
    * RegionContainer notation node is in auto-size but but figure has the default dimension
    * Layout is not stable (Figure are well auto-sized) after a close/reopen diagram (or addition of a new child in the Region)
* Case #2
  * From previous diagram
  * Select the particpant, unset its process from the properties views
  * Check that the participant is in auto-size and emtpy on the diagram
  * Layout "KO" :
    * RegionContainer notation node is in auto-size but but figure has the default dimension
    * Layout is not stable (Figure are well auto-sized) after a close/reopen diagram (or addition of a new child in the Region)
* Case #3
  * Create a new Collaboration diagram
  * Layout OK: Participant is created with Region content layouted, RegionContainer layout is stable and correctly auto-sized.
* Case #4
  * From any previous case, 
  * Move nodes inside the region to right or bottom
  * Scroll bars appears
  * Close and reopen the diagram : no more scrollbars and figure are correctly resized.
  * Layout KO: in auto-size, the RegionContainer should adapt its size to the Region contents.
Comment 1 Maxime Porhel CLA 2023-06-20 04:26:24 EDT
Note: 
- Single click creation : 
  - clicked location used as hint to place the created node. 
  - Created container in auto size.
- click and drag creation :
  - first click location used as hint to place the node
  - drawn rectangle used as hint for the created node/container bounds : fixed size
Comment 2 Maxime Porhel CLA 2023-06-20 04:34:58 EDT
Created attachment 289108 [details]
Case 4
Comment 3 Maxime Porhel CLA 2023-06-20 04:35:18 EDT
Created attachment 289109 [details]
Cases 1, 2, 3
Comment 4 Maxime Porhel CLA 2023-06-20 04:39:36 EDT
Three proposed fixes for 7.0.8 - disabled by default but activable with system properties
Comment 5 Maxime Porhel CLA 2023-06-20 04:39:54 EDT
Do not apply center layout on Region content at creation time

System property to enable the behavior:
    -Dorg.eclipse.sirius.diagram.ui.internal.region.content.canonical.layout.standard=true

When the Region is created in the same operation, it will be layouted in
its RegionContainer. If the regions container is created it will be
centered or placed where the user clicked.
The goal of the "centered" layout is to regroup "externally" created
views (by the precommit canonical refresh) when they have no location
hint in the SiriusDataLayoutManager. This is done to ease the retrieval
of such elements created as secondary effect of a user action. The main
created view would take the clicked location as hint.

This seems to be unnecessary when there are several level of created
views. The top level created elements will be centered, but centering
their center can appear to require more layout work by the user than a
first default arrange. This also allows to have a consistent layout for
those elements compared to a diagram creation.
Comment 6 Maxime Porhel CLA 2023-06-20 04:42:18 EDT
(In reply to Maxime Porhel from comment #5)
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/202597 [582089] Do not apply center layout on Region content at creation time
Comment 7 Maxime Porhel CLA 2023-06-20 04:42:40 EDT
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/202598 

Use model constraint to layout Regions

System property to enable the behavior:
-Dorg.eclipse.sirius.diagram.ui.internal.region.autosize.figure.optimized=true

We use to store the computed constraint during layout, but this make the
figures unable to adapt their size to the content in auto-size.
Behavior is wrong for the user: if he close and reopen the diagram (or
do some undo redo, or add new content) : the layout changes.
Comment 8 Maxime Porhel CLA 2023-06-20 04:43:08 EDT
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/202599 

Enable individual auto-size action and status for Regions

System property to enable the behavior:
-Dorg.eclipse.sirius.diagram.ui.internal.region.autosize.action.optimized=true

When auto-size is called on RegionContainer : it put all regions in
auto-size.

When auto-size is called on a single regions (or selected regions), it
enables auto-size for the selection.

Without the system preference: no individual status.action, everything
is delegated to the RC.
Comment 9 Maxime Porhel CLA 2023-06-20 05:04:37 EDT
Video to show auto-size pathes effect:
   https://www.youtube.com/watch?v=_pyhCiSK-V8

(created content was still centered for this video)
Comment 10 Maxime Porhel CLA 2023-06-20 05:35:57 EDT
Steps to validates
* Replay cases #1
Comment 11 Maxime Porhel CLA 2023-06-20 05:50:31 EDT
Steps to validate

- Replay cases #1 and #2
  - check that the RegionContainer layout and the region content layout are the same than case #3
  - le location of the RegionContainer depends the click location
  - close and reopen diagram: no change
- Case #4: 
  - from a diagram in auto-size: move region content to the right or bottom : size of the Region container self adapts. Close and open the diagram : layout is stabme
  - if you move sub node to the top or left : you will have scroll bars, as in standard containers. Not in the scope of this ticket.
  - auto-size action:
    - open the process definition table
    - add a new process 
    - create a new process diagram
    - the process is in auto-size (with sized defined in the VSM) 
    - add a 2 additional new Lane/Corridor in the process
    - each newly created region has a fixed size (auto-size icon enabled in tabbar on seletion), the RC too.
    - check that clicking on autosize of a single region affects only this region
    - manually resize the RC (width) and each regions
    - auto-size action on the RC : all region are sized to the creation size, auto-size action is grayed for all region and RC
    - undo : auto-size action is enabled on all regions and RC
    - auto-size one regions: widht is auto-sized for all regions, they key their fixed height excepted for the selected region.
Comment 12 Maxime Porhel CLA 2023-06-23 09:59:20 EDT
Verified on Sirius 7.0.8 build deployed with activation of the three properties.
Comment 13 Pierre-Charles David CLA 2023-06-25 08:31:58 EDT
Available in Sirius Desktop 7.0.8: https://projects.eclipse.org/projects/modeling.sirius/releases/sirius-desktop-7.0.8