External design label forced to be affixed to parent side ? [message #174621] |
Wed, 27 February 2008 15:51 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03119 seconds