Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to change alignment of a node's external label?
How to change alignment of a node's external label? [message #1004689] Wed, 23 January 2013 17:10 Go to next message
Stephen Slaboda is currently offline Stephen Slaboda
Messages: 8
Registered: November 2012
Junior Member
Hi all,

I've followed the instructions at the end of this article, where I update the EditPart of the node with an external label, and it does move the label to where I tell it. However, the label always seems to be left-aligned. Is there a deterministic way to make the label lie at a different alignment (for example, I want my label to start below the southwest edge of the node, rather than end below the southeast edge of the node). My current settings of
BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
locator.setBorderItemOffset(new Dimension(0, -5));

put the label at an acceptable distance from the bottom of the node, but it aligns the end of the label to the southeast corner of the node.

I have tried using the size of the figure and the size of the BorderItemLocator to determine the correct offset, but at least in the addBorderItem method, the BorderItemLocator doesn't seem to have a size. I also noticed that in the locator a lot of updating is done regarding the X/Y coordinates, so I wonder if this is a very complicated task to handle?

Thanks,
-Stephen
Re: How to change alignment of a node's external label? [message #1005443 is a reply to message #1004689] Fri, 25 January 2013 13:24 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

this should do the trick.

http://code.google.com/a/eclipselabs.org/p/melanie/source/browse/de.uni_mannheim.informatik.swt.models.plm.diagram/custom-src/de/uni_mannheim/informatik/swt/models/plm/diagram/custom/borders/CenteredBorderItemLocator.java

Ralph
Previous Topic:How can i make a shortcut that can't be contained in the root element?
Next Topic:How to connect two editor.
Goto Forum:
  


Current Time: Wed Sep 17 23:53:39 GMT 2014

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

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