[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: draw2d: label follows figure

But the image and label will be part of one figure, and perimeter of handles will go around both image and label. Ok, this is a better picture of what I am talking about: http://farm1.static.flickr.com/146/361592242_a221ec83c1.jpg?v=0

So only image is selectable, dragable and can be connected to or from, label is just a satellite that follows this image figure always at the same location.

I don't know may be this is not even possible?

thanks,
Alex

Nhu Le wrote:
If you want a label that is always at the same location wrt the figure, then you have to create your own figure with some transparent border to put the label (to create the illusion that the label is outside the figure). Look into getHandleBounds() of interface HandleBounds.

If you want a label that can be moved anywhere on the screen (like in the case of a label of a port for a component) then you may want to create another layer for your labels and create a label locator class (extends AbstractLocator). The parent-child figure relationship will obviously not like usual but since the label should be the leaf of the relationship tree, you can probably create a simple (like getOwner()???) just so that you can get to the figure from the label (to replace getParent()).

Nhu

Aleksandr Kravets wrote:
Hello,

In my GEF application I have a figure which is basically an ImageFigure. I am looking for a way to create a label that follows that figure. I tried using DelegatingLayout on my figure, but of course the label is positioned in the figure, may be there is a way to offset the positioning of the label so it's outside the figure?

Thanks for your help,
Alex