Home » Modeling » GMF (Graphical Modeling Framework) » how to change the border item's direction?
|
Re: how to change the border item's direction? [message #97429 is a reply to message #97396] |
Fri, 26 January 2007 16:38   |
Eclipse User |
|
|
|
Jade,
I'm not sure if you can fix this easier using the generator, but you can
definitely fix this by customizing the generated code.
If your lollipop editpart is an AbstractBorderItemEditPart, you can call
getBorderItemLocator().getCurrentSideOfParent() to figure out which side
of the shape the lollipop is on and then rotate the lollipop figure
accordingly.
Regards,
Cherie
Jade Xiao wrote:
> hi, everyone:1
> I have implement the lollipop-like figure is the border item of the
> node (rectangle), see graph1. it can be side-affixed while it moved, but the
> lollipop can't change its direction in different sides. In fact, I want it
> to be like this, see graph2. So, how can I do it? any good suggestion?
> Thanks in advance. Best wishes! Merci.
>
> Jade
>
>
>
|
|
| |
Re: how to change the border item's direction? [message #143567 is a reply to message #105989] |
Fri, 20 July 2007 05:30   |
Eclipse User |
|
|
|
Hi all,
I have a similar case, and I partially found a solution (but maybe not
the best). I add some code in the refreshBounds() method to update my
figure (here I just change the color for testing purpose), but I still
have two remaining problems :
1. I need the following snippet of code in order to update the
currentSideOfParent property : getBorderItemLocator().relocate(getFigure());
Otherwise, the getBorderItemLocator().getCurrentSideOfParent() method
only returns the initial side (before the move is performed). Is there a
better way to do that.
2. My second problem is that the figure is not well initialized during
the first creation of the Figure (when I open the diagram).
Here is the code I used in my "PortEditPart" :
@Override
protected void refreshBounds() {
// Call relocate() to update the CurrentSideOfParent property
getBorderItemLocator().relocate(getFigure());
// Depending on the border the figure is attached, use a different figure
switch (getBorderItemLocator().getCurrentSideOfParent()) {
case PositionConstants.WEST:
getFigure().setForegroundColor(ColorConstants.orange);
break;
case PositionConstants.NORTH:
getFigure().setForegroundColor(ColorConstants.gray);
break;
case PositionConstants.EAST:
getFigure().setForegroundColor(ColorConstants.red);
break;
case PositionConstants.SOUTH:
getFigure().setForegroundColor(ColorConstants.yellow);
break;
default:
break;
}
super.refreshBounds();
}
Any help is welcome,
Regards,
Jacques
exquisitus a écrit :
> Jade Xiao a écrit :
>> hi, everyone:1
>> I have implement the lollipop-like figure is the border item of
>> the node (rectangle), see graph1. it can be side-affixed while it
>> moved, but the lollipop can't change its direction in different sides.
>> In fact, I want it to be like this, see graph2. So, how can I do it?
>> any good suggestion?
>> Thanks in advance. Best wishes! Merci.
>>
>> Jade
>>
>>
>
> Hi Jade,
>
> Did you successfuly realize what you wanted ? I have the same problem
> and I dont see how to do this...
>
> Regards
> Sylvain
>
>
|
|
|
Re: how to change the border item's direction? [message #162044 is a reply to message #143567] |
Thu, 22 November 2007 07:07  |
Eclipse User |
|
|
|
Hi All,
I have the same problem as Jacques describe with initialization, and also a
problem near the corners. The latter seems related to the snap-to-grid
feature.
Going back to the initial question of this thread (26-1-2007): How to rotate
the lollipop figure? Anybody a hint where to look? I already tried to
transform a polygon figure (see thread "How to rotate a border item" on
21-11-2007), but somehow the modifications are not displayed.
Kind regards,
Jaap
"Jacques LESCOT" <jacques.lescot@anyware-tech.com> wrote in message
news:f7pvai$o75$1@build.eclipse.org...
> Hi all,
>
> I have a similar case, and I partially found a solution (but maybe not the
> best). I add some code in the refreshBounds() method to update my figure
> (here I just change the color for testing purpose), but I still have two
> remaining problems :
>
> 1. I need the following snippet of code in order to update the
> currentSideOfParent property :
> getBorderItemLocator().relocate(getFigure());
> Otherwise, the getBorderItemLocator().getCurrentSideOfParent() method only
> returns the initial side (before the move is performed). Is there a better
> way to do that.
>
> 2. My second problem is that the figure is not well initialized during the
> first creation of the Figure (when I open the diagram).
>
> Here is the code I used in my "PortEditPart" :
>
>
> @Override
> protected void refreshBounds() {
> // Call relocate() to update the CurrentSideOfParent property
> getBorderItemLocator().relocate(getFigure());
>
> // Depending on the border the figure is attached, use a different figure
> switch (getBorderItemLocator().getCurrentSideOfParent()) {
> case PositionConstants.WEST:
> getFigure().setForegroundColor(ColorConstants.orange);
> break;
> case PositionConstants.NORTH:
> getFigure().setForegroundColor(ColorConstants.gray);
> break;
> case PositionConstants.EAST:
> getFigure().setForegroundColor(ColorConstants.red);
> break;
> case PositionConstants.SOUTH:
> getFigure().setForegroundColor(ColorConstants.yellow);
> break;
> default:
> break;
> }
>
> super.refreshBounds();
> }
>
> Any help is welcome,
> Regards,
> Jacques
>
>
> exquisitus a
|
|
|
Goto Forum:
Current Time: Sun Apr 27 03:07:05 EDT 2025
Powered by FUDForum. Page generated in 0.02999 seconds
|