Most of you aren’t developing GEF applications on top of Eclipse RCP – in your case move along there’s nothing to see here. However if you’re one of the three people out doing GEF development, sit down I have story to tell.
I wanted a label attached to my figures that was wider than the parent figure. The label should be tied to the parent – but not be included in the parents grab handle. The previously suggested solution that I found was to stack the original figure and label in a composite (using a Flow/Toolbar Layout to position the children). Sadly that just created the Ugly Duckling (left figure) and not the Elegant one (see right).

After some more digging I discovered an interface HandleBounds (dig the crazy name), its tailor made for this situation:
HandleBounds Identifies figures which use an alternative rectangle to place their handles. Normally, handles will appear around a GraphicalEditPart’s figure’s bounds. However, if that figure has an irregular shape, it may implement this interface to indicate that some rectangle other than its bounding rectangle should be used to place handles.
If you ignore the word irregular this solution is tailor made for our problem.
Read More…
Recent Comments