Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Polygon Figure disappears when moved
Polygon Figure disappears when moved [message #178511] Wed, 20 April 2005 16:37 Go to next message
Eclipse UserFriend
Originally posted by: jduley.mail.arc.nasa.gov

Hi,
I have a GEF application that has nodes that I create from the palette.
One of the node figure types is a polygon (triangle). When I first
drag the polygon onto the canvas, it displays correctly. As soon as I
drag it to another location, it disappears. Any idea what is going on?
BTW, I have tried using both the org.eclipse.draw2d.Polygon and the
org.eclipse.draw2d.PolygonDecoration and the same thing happens with both.
Jason
Re: Polygon Figure disappears when moved [message #178527 is a reply to message #178511] Wed, 20 April 2005 17:11 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
You should use Polygon, not PolygonDecoration. Are you updating the
constraint in refreshVisuals()?

"Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
news:d460hd$rcr$1@news.eclipse.org...
> Hi,
> I have a GEF application that has nodes that I create from the palette.
> One of the node figure types is a polygon (triangle). When I first
> drag the polygon onto the canvas, it displays correctly. As soon as I
> drag it to another location, it disappears. Any idea what is going on?
> BTW, I have tried using both the org.eclipse.draw2d.Polygon and the
> org.eclipse.draw2d.PolygonDecoration and the same thing happens with both.
> Jason
Re: Polygon Figure disappears when moved [message #178541 is a reply to message #178527] Wed, 20 April 2005 17:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jduley.mail.arc.nasa.gov

Yes I am:

//begin refreshVisuals snippet
MyFig f = (MyFigure)getFigure();
Point location = f.getLocation();
MyDiagramPart parent = (MyDiagramPart) getParent();
Rectangle constraint = new Rectangle(location.x, location.y, -1, -1);
parent.setLayoutConstraint(this, f, constraint);
//end snippet



Pratik Shah wrote:
> You should use Polygon, not PolygonDecoration. Are you updating the
> constraint in refreshVisuals()?
>
> "Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
> news:d460hd$rcr$1@news.eclipse.org...
>
>>Hi,
>>I have a GEF application that has nodes that I create from the palette.
>> One of the node figure types is a polygon (triangle). When I first
>>drag the polygon onto the canvas, it displays correctly. As soon as I
>>drag it to another location, it disappears. Any idea what is going on?
>> BTW, I have tried using both the org.eclipse.draw2d.Polygon and the
>>org.eclipse.draw2d.PolygonDecoration and the same thing happens with both.
>>Jason
>
>
>
Re: Polygon Figure disappears when moved [message #178549 is a reply to message #178541] Wed, 20 April 2005 17:51 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
When you say drag the polygon, you don't mean reparent it, right? Just look
at the figure before and after and see what has changed. That should give
you a clue.

Apparently, you're not just using Polygon, but subclassing it. What does
your Polygon subclass, MyFigure, do?

"Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
news:d464es$13o$1@news.eclipse.org...
> Yes I am:
>
> //begin refreshVisuals snippet
> MyFig f = (MyFigure)getFigure();
> Point location = f.getLocation();
> MyDiagramPart parent = (MyDiagramPart) getParent();
> Rectangle constraint = new Rectangle(location.x, location.y, -1, -1);
> parent.setLayoutConstraint(this, f, constraint);
> //end snippet
>
>
>
> Pratik Shah wrote:
> > You should use Polygon, not PolygonDecoration. Are you updating the
> > constraint in refreshVisuals()?
> >
> > "Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
> > news:d460hd$rcr$1@news.eclipse.org...
> >
> >>Hi,
> >>I have a GEF application that has nodes that I create from the palette.
> >> One of the node figure types is a polygon (triangle). When I first
> >>drag the polygon onto the canvas, it displays correctly. As soon as I
> >>drag it to another location, it disappears. Any idea what is going on?
> >> BTW, I have tried using both the org.eclipse.draw2d.Polygon and the
> >>org.eclipse.draw2d.PolygonDecoration and the same thing happens with
both.
> >>Jason
> >
> >
> >
Re: Polygon Figure disappears when moved [message #178557 is a reply to message #178549] Wed, 20 April 2005 18:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jduley.mail.arc.nasa.gov

Pratik,
No, I am not reparenting it, simply moving it to a new location.
Apparantly, when I move the node and the triangle disappears, I can move
the node back to the original location and the trianlge is there again.
I guess what is happening is the node figure is moving but the
triangle it contains is not moving but staying at it's original
location. I have other nodes that contain rectangles and ellipses and
this is not occuring. Do I need to do something different given this is
a polygon? Also, I tried the Triangle class and it works fine. I would
like to discover what is happening with this polygon implementation
though. Thanks.
Jason



Pratik Shah wrote:
> When you say drag the polygon, you don't mean reparent it, right? Just look
> at the figure before and after and see what has changed. That should give
> you a clue.
>
> Apparently, you're not just using Polygon, but subclassing it. What does
> your Polygon subclass, MyFigure, do?
>
> "Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
> news:d464es$13o$1@news.eclipse.org...
>
>>Yes I am:
>>
>>//begin refreshVisuals snippet
>>MyFig f = (MyFigure)getFigure();
>>Point location = f.getLocation();
>>MyDiagramPart parent = (MyDiagramPart) getParent();
>>Rectangle constraint = new Rectangle(location.x, location.y, -1, -1);
>>parent.setLayoutConstraint(this, f, constraint);
>>//end snippet
>>
>>
>>
>>Pratik Shah wrote:
>>
>>>You should use Polygon, not PolygonDecoration. Are you updating the
>>>constraint in refreshVisuals()?
>>>
>>>"Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
>>>news:d460hd$rcr$1@news.eclipse.org...
>>>
>>>
>>>>Hi,
>>>>I have a GEF application that has nodes that I create from the palette.
>>>> One of the node figure types is a polygon (triangle). When I first
>>>>drag the polygon onto the canvas, it displays correctly. As soon as I
>>>>drag it to another location, it disappears. Any idea what is going on?
>>>> BTW, I have tried using both the org.eclipse.draw2d.Polygon and the
>>>>org.eclipse.draw2d.PolygonDecoration and the same thing happens with
>
> both.
>
>>>>Jason
>>>
>>>
>>>
>
>
Re: Polygon Figure disappears when moved [message #178565 is a reply to message #178511] Wed, 20 April 2005 20:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You cannot use polygon as you would a normal figure. It is intended for use
with PolylineConnection.

You must call setPoints on a polygon. You cannot call setBounds(). Also, it
does not implement translate.

"Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
news:d460hd$rcr$1@news.eclipse.org...
> Hi,
> I have a GEF application that has nodes that I create from the palette.
> One of the node figure types is a polygon (triangle). When I first drag
> the polygon onto the canvas, it displays correctly. As soon as I drag it
> to another location, it disappears. Any idea what is going on? BTW, I
> have tried using both the org.eclipse.draw2d.Polygon and the
> org.eclipse.draw2d.PolygonDecoration and the same thing happens with both.
> Jason
Re: Polygon Figure disappears when moved [message #178648 is a reply to message #178557] Thu, 21 April 2005 03:12 Go to previous message
Rudolf Hornig is currently offline Rudolf HornigFriend
Messages: 12
Registered: July 2009
Junior Member
Polygon is different than the rest of the figures in a way that you
should NOT set its bounds. You have to translate each point in it's
point list to move it around. Bacause layout managers use also setBounds
they cannot move / layout a figure either.
If you are subclassing from Polygon you may do a little dirty trick and
override the setBounds method to translate all the polygon's points as
necessary...
Rudolf

Jason Duley wrote:
> Pratik,
> No, I am not reparenting it, simply moving it to a new location.
> Apparantly, when I move the node and the triangle disappears, I can move
> the node back to the original location and the trianlge is there again.
> I guess what is happening is the node figure is moving but the triangle
> it contains is not moving but staying at it's original location. I have
> other nodes that contain rectangles and ellipses and this is not
> occuring. Do I need to do something different given this is a polygon?
> Also, I tried the Triangle class and it works fine. I would like to
> discover what is happening with this polygon implementation though.
> Thanks.
> Jason
>
>
>
> Pratik Shah wrote:
>
>> When you say drag the polygon, you don't mean reparent it, right?
>> Just look
>> at the figure before and after and see what has changed. That should
>> give
>> you a clue.
>>
>> Apparently, you're not just using Polygon, but subclassing it. What does
>> your Polygon subclass, MyFigure, do?
>>
>> "Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
>> news:d464es$13o$1@news.eclipse.org...
>>
>>> Yes I am:
>>>
>>> //begin refreshVisuals snippet
>>> MyFig f = (MyFigure)getFigure();
>>> Point location = f.getLocation();
>>> MyDiagramPart parent = (MyDiagramPart) getParent();
>>> Rectangle constraint = new Rectangle(location.x, location.y, -1, -1);
>>> parent.setLayoutConstraint(this, f, constraint);
>>> //end snippet
>>>
>>>
>>>
>>> Pratik Shah wrote:
>>>
>>>> You should use Polygon, not PolygonDecoration. Are you updating the
>>>> constraint in refreshVisuals()?
>>>>
>>>> "Jason Duley" <jduley@mail.arc.nasa.gov> wrote in message
>>>> news:d460hd$rcr$1@news.eclipse.org...
>>>>
>>>>
>>>>> Hi,
>>>>> I have a GEF application that has nodes that I create from the
>>>>> palette.
>>>>> One of the node figure types is a polygon (triangle). When I first
>>>>> drag the polygon onto the canvas, it displays correctly. As soon as I
>>>>> drag it to another location, it disappears. Any idea what is going
>>>>> on?
>>>>> BTW, I have tried using both the org.eclipse.draw2d.Polygon and the
>>>>> org.eclipse.draw2d.PolygonDecoration and the same thing happens with
>>
>>
>> both.
>>
>>>>> Jason
>>>>
>>>>
>>>>
>>>>
>>
>>
Previous Topic:GEF printing
Next Topic:How to create GEF TreeViewer in a editor
Goto Forum:
  


Current Time: Wed Feb 08 08:26:49 GMT 2023

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

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

Back to the top