Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to change the border item's direction?
how to change the border item's direction? [message #97396] Fri, 26 January 2007 10:53 Go to next message
Eclipse UserFriend
Originally posted by: xs.xiaosai.gmail.com

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



  • Attachment: gragh2.bmp
    (Size: 318.94KB, Downloaded 184 times)
  • Attachment: gragh1.BMP
    (Size: 149.43KB, Downloaded 161 times)
Re: how to change the border item's direction? [message #97429 is a reply to message #97396] Fri, 26 January 2007 16:38 Go to previous messageGo to next message
Eclipse UserFriend
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 #105989 is a reply to message #97396] Wed, 21 February 2007 13:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sylvain.maillard.univ-nantes.fr

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 #143567 is a reply to message #105989] Fri, 20 July 2007 05:30 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:command execution in a property update dialog
Next Topic:diagram partitioning / double click function doesnt work
Goto Forum:
  


Current Time: Sun Apr 27 03:07:05 EDT 2025

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

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

Back to the top