Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » External design label forced to be affixed to parent side ?
External design label forced to be affixed to parent side ? [message #174621] Wed, 27 February 2008 15:51 Go to next message
Eclipse UserFriend
Originally posted by: mopr.xxxxx.org

I have added an external design label to a node (N). The node N
is affixed to the side of its parent node (PN).

I want the label to be moveable freely. But GMF generates
the label to be affixed to the side of node N, even though I have set
the property "Affixed Parent Side" of the diagram label in .gmfgraph
to NONE.

How can I turn this off and allow to move the label freely?

Thanks so much in advance!!!
Oliver
Re: External design label forced to be affixed to parent side ? [message #174862 is a reply to message #174621] Thu, 28 February 2008 16:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

There is a way to get this done, by modifying the code. I don't know, if
this should be done like this, but it seems to work:

In the edit part, search for

protected EditPolicy createChildEditPolicy(EditPart child) {
if (child instanceof IBorderItemEditPart) {
....

There, just don't install BorderItemSelectionEditPolicy for your label
edit part. Now, you're able to drag the label around. But
BorderItemLocator still forces your label to stick at the parent. So
you'll need to override BorderItemLocator#locateOnParent(Point
suggestedLocation,int suggestedSide, IFigure borderItem), in a way, it
returns the drag position. Or write your own locator. For example:

private Point locateOnParent(Point suggestedLocation, int suggestedSide,
IFigure borderItem) {

return suggestedLocation;
}

Maybe there is a more sophisticated way... I don't know.

regards
Jan

Oliver schrieb:
> I have added an external design label to a node (N). The node N
> is affixed to the side of its parent node (PN).
>
> I want the label to be moveable freely. But GMF generates
> the label to be affixed to the side of node N, even though I have set
> the property "Affixed Parent Side" of the diagram label in .gmfgraph
> to NONE.
>
> How can I turn this off and allow to move the label freely?
>
> Thanks so much in advance!!!
> Oliver
Re: External design label forced to be affixed to parent side ? [message #174893 is a reply to message #174862] Thu, 28 February 2008 18:21 Go to previous message
Eclipse UserFriend
Originally posted by: mopr.xxxxx.org

Hello Jan,

great, thanks for the detailed info!!

Cheers,
Oliver



Jan Herriger schrieb:
> There is a way to get this done, by modifying the code. I don't know, if
> this should be done like this, but it seems to work:
>
> In the edit part, search for
>
> protected EditPolicy createChildEditPolicy(EditPart child) {
> if (child instanceof IBorderItemEditPart) {
> ....
>
> There, just don't install BorderItemSelectionEditPolicy for your label
> edit part. Now, you're able to drag the label around. But
> BorderItemLocator still forces your label to stick at the parent. So
> you'll need to override BorderItemLocator#locateOnParent(Point
> suggestedLocation,int suggestedSide, IFigure borderItem), in a way, it
> returns the drag position. Or write your own locator. For example:
>
> private Point locateOnParent(Point suggestedLocation, int suggestedSide,
> IFigure borderItem) {
>
> return suggestedLocation;
> }
>
> Maybe there is a more sophisticated way... I don't know.
Previous Topic:Error while creating generator model
Next Topic:runExclusive for GMF Commands
Goto Forum:
  


Current Time: Thu Apr 25 17:22:42 GMT 2024

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

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

Back to the top