Home » Eclipse Projects » GEF » Polygon Figure disappears when moved
Polygon Figure disappears when moved [message #178511] |
Wed, 20 April 2005 12:37  |
Eclipse User |
|
|
|
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 #178541 is a reply to message #178527] |
Wed, 20 April 2005 13:44   |
Eclipse User |
|
|
|
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 13:51   |
Eclipse User |
|
|
|
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 14:03   |
Eclipse User |
|
|
|
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 #178648 is a reply to message #178557] |
Wed, 20 April 2005 23:12  |
Eclipse User |
|
|
|
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
>>>>
>>>>
>>>>
>>>>
>>
>>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 14:46:35 EDT 2025
Powered by FUDForum. Page generated in 0.04145 seconds
|