Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Auto Resizing Containers
Auto Resizing Containers [message #1761693] Thu, 11 May 2017 14:21 Go to next message
Ran Wei is currently offline Ran WeiFriend
Messages: 119
Registered: September 2012
Location: York, UK
Senior Member
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 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
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 #1769998 is a reply to message #1761908] Mon, 07 August 2017 12:14 Go to previous messageGo to next message
Athanasios Zolotas is currently offline Athanasios ZolotasFriend
Messages: 52
Registered: November 2016
Location: York
Member
Hi Jullen,

Regarding your answer on the second question: The auto-resizing functionality actually resizes the width of the container to fit the contained element without wrapping the content (see 1st screenshot). Is it possible to wrap the contents (like in 2nd screenshot)?

Thanks,
Thanos

Screenshot 1:
http://i66.tinypic.com/2r2sx9f.png

Screenshot 2:
https://i.imgur.com/uIU5bTH.png
Re: Auto Resizing Containers [message #1770636 is a reply to message #1769998] Tue, 15 August 2017 12:12 Go to previous messageGo to next message
Athanasios Zolotas is currently offline Athanasios ZolotasFriend
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 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
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
Previous Topic:[GMF][Sirius][RoutingStyle] Avoid Obstruction feature
Next Topic:Clearing text field after hitting enter
Goto Forum:
  


Current Time: Thu Apr 25 07:20:50 GMT 2024

Powered by FUDForum. Page generated in 0.03617 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top