Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » problems with XYlayout
problems with XYlayout [message #148711] Fri, 31 August 2007 13:42 Go to next message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi friends

I am using the XYLayout class in a parent Node to place its child
node in any place. In this case, when we drag a child node outside the
parent node , child node will be disappear from the canvas ,

1 how to restrict child node only dragged on inside the parent figure?

thanks in
advance

biju
Re: problems with XYlayout [message #148727 is a reply to message #148711] Sat, 01 September 2007 07:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jr.joergreuter.ch

When I was working with an early milestone of GMF release 1 child objects
automatically "returned" to their original place when dropped outside of a
container . Now I work with release 2.0 and behavior is exactly as you
described.

I do not know what happened and it could be that I have changed something in
my code. I assume that a different command is returned from one of the edit
parts edit policies (Probably PRIMARY_DRAG_ROLE) during the Lifecycle of
DragEditPartsTracker. There is also a DragEditPartsTrackerEx Class that
overwrites getPrimaryDragEditPolicy.

Regards
J
Re: problems with XYlayout [message #151884 is a reply to message #148711] Fri, 21 September 2007 03:01 Go to previous messageGo to next message
Li Ding is currently offline Li DingFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

I got similar problem here. When moving a node outside its container, the
node and all connections to/from it are disappeared. Do you have any
progress ?

Li
Re: problems with XYlayout [message #760613 is a reply to message #151884] Sat, 03 December 2011 13:58 Go to previous message
Piotr Trojanek is currently offline Piotr TrojanekFriend
Messages: 7
Registered: October 2010
Junior Member
My solution is to install a XYLayout with a modified getConstraint() method:

this.setLayoutManager(new XYLayout() {
	
	// Disallow to drag child nodes out of the figure
	@Override
	public Object getConstraint(IFigure figure) {
		Rectangle result = (Rectangle) constraints.get(figure);
		if (result == null) {
			result = new Rectangle(0, 0, -1, -1);
		} else {
			if(result.x < 0) {
				result.x = 0;
			}
			if(result.y < 0) {
				result.y = 0;
			}						
		}
		return result;
	}
});

--
Piotr.
Previous Topic:[GMF] Adding options to DropDown-Menu of a Node
Next Topic:Nested objects' connection handles not working within a compartment
Goto Forum:
  


Current Time: Tue Apr 23 07:10:18 GMT 2024

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

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

Back to the top