Auto Resizing Containers [message #1761693] |
Thu, 11 May 2017 10:21  |
Eclipse User |
|
|
|
Hi,
I am currently using Sirius to create my own editor.
I need a node to display two labels, and I found out the only way is to create Containers instead of Nodes.
So I created Containers, and created two sub-nodes inside the container to display the contents that I want.
I have two questions if you could please answer:
1. How to automatically position the nodes (one at the top left corner, one at the centre of the container) and resize the nodes based on the content they displays
2. How to resize the container based on the size of the sub-nodes
The style of the Container uses an image that I provided.
Thank you very much
William
|
|
|
|
|
Re: Auto Resizing Containers [message #1770636 is a reply to message #1769998] |
Tue, 15 August 2017 08:12   |
Eclipse User |
|
|
|
I made some progress on that but I am afraid I still need your help.
In the localChangesAboutToCommit(Collection<Notification>), I collect all the container nodes (those that are instances of Bounds) and then in the doExecute method I call the setWidth() and setHeight() methods to set the specific dimensions I need (I also tried to create a new setCommand like this: Command setCommand = new SetCommand(domain, myBound, NotationPackage.eINSTANCE.getSize_Width(), 200);).
When I create a new container node, it is created with the custom dimensions I set, the contained subnodes' labels are wrapped as they should be however, after a second or so the dimensions are reset to fit the subnodes' labels in one line. I guess that another command is called after mine in the doExecute method that resets the dimensions.
I tried to debug this, it must be something happening inside the someAreVisible(List<MWindow> windows) method of the PartRendering class however, there is no chance to identify what is that, as the loop in there is executed hundereds of times. Any idea?
|
|
|
Re: Auto Resizing Containers [message #1770683 is a reply to message #1770636] |
Wed, 16 August 2017 04:34  |
Eclipse User |
|
|
|
Hi Thanos,
It seems you might put some breakpoints in:
- org.eclipse.gmf.runtime.notation.impl.NodeImpl.setLayoutConstraint(LayoutConstraint)
- org.eclipse.gmf.runtime.notation.impl.BoundsImpl.setWidth(int)
- org.eclipse.gmf.runtime.notation.impl.BoundsImpl.setHeight(int)
If you enable them just after your SetCommand creation from localChangesAboutToCommit, you should be able to see you bounds update and then who cancels your changes.
Regards,
Maxime
|
|
|
Powered by
FUDForum. Page generated in 0.03787 seconds