Auto Resizing Containers [message #1761693] |
Thu, 11 May 2017 14:21 |
|
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
Research Associate
Department of Computer Science
University of York
|
|
|
Re: Auto Resizing Containers [message #1761908 is a reply to message #1761693] |
Thu, 11 May 2017 16:10 |
|
Hi Willliam,
To answer:
1- You should define your own GMF layout. It's really difficult and contribute this layout in Sirius.
2- The "Auto Size" function do that automatically. The Auto Size is available in the tabbar on the right when your container is selected.
Regards,
|
|
|
|
Re: Auto Resizing Containers [message #1770636 is a reply to message #1769998] |
Tue, 15 August 2017 12:12 |
Athanasios Zolotas Messages: 52 Registered: November 2016 Location: York |
Member |
|
|
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 08:34 |
|
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.03617 seconds