|Custom Diagram Layout ('arrange-all') does not work as expected [message #1801555]
||Tue, 22 January 2019 13:54
| Joerg Hermann
Registered: September 2012
I have created a custom layout implementation of the layout, where I tried to follow the concept described in the class LineLayoutProvider.
In my case, I need to place containers and border nodes attached to these containers by some semantic logic; i.e. the containers are placed in a kind of grid (positions are determined by internal properties) and the border nodes are located in groups and sorted by their name within these groups.
I divided the layout operation into two phases, 1st applying the location and size of the container nodes, and 2nd applying the location of the border nodes.
Here I'm running into 2 issues:
- Relocating and resizing of the containers to their new position:
Applying the new location worked fine, but the new size was not accepted (it appeared to keep the original size).
The implementation is similar to the LineLayoutProvider by creating ChangeBoundsRequest with type RequestConstants.REQ_MOVE and RequestConstants.REQ_RESIZE, respectively.
After debugging, I found that the new size was written to the Node, but reverted
afterwards by the SnapToGrid logic. After disabling the the 'SnapToGrid' Option.
this step worked properly as well.
This is a workaround for me, but I would appreciate to know a clean way to solve this.
- Applying the locations for the border nodes appears to work incrementally only.
I.e. I need to run the arrange-all rouhgly 5 to 10 times. Each iteration improves the
appearance. At the end everything is located as intended.
I found that the location of the bordernode figure is updated with the relocation
of the parent figure, keeping the original relative location within the parent.
There is another update to the figure with a slight vertical movement of the bordernode, bit not by the amount that was specified in the Request.
I assumed that the REQ_MOVE needs to be relative to this parent position.
I suspect as well that there is an interaction with the BorderNodeLocator, but I could not figure out how to avoid this.
I would very much appreciate any hints (or if any of my above assumptions are wrong; any help is welcome).
thanks & best regards, Joerg
Powered by FUDForum
. Page generated in 0.01784 seconds