Skip to main content



      Home
Home » Eclipse Projects » GEF » Coordinate movement of separate EditPart figures
Coordinate movement of separate EditPart figures [message #165168] Fri, 21 January 2005 18:16 Go to next message
Eclipse UserFriend
I would like to have a part "follow" other parts around when they are
dragged, specifically I want it to appear in the middle of the actual
connection points on the other ends of its connections. I have made the
slave part a listener of the parts it is interested in so that I can
move it when I get a change of the location or bounds on the master
parts but the change notification comes through before the figures get
re-rendered so I don't know where they have moved to. I can figure out
how far they have moved or how much they have resized through the old
and new values of the event but this is only an approximation - if the
drag operation causes the underlying canvas to scroll I am way off.

Is there a way for me to delay the positioning of the dependent figure
until I know where it has to go? Would I need to override the getBounds
method on the figure? Perhaps create my own LayoutManager for the
container part?

Thanks,
Barry
Re: Coordinate movement of separate EditPart figures [message #165548 is a reply to message #165168] Tue, 25 January 2005 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You could create figure listeners for the other figure's you are trying to
follow.

You could also just create a two-pass validation in your diagram figure.
After it does the normal layout, have it go back and allow these special
figures determine their own positions. This would be the easiest way to do
it. The second pass could use a Locator which has access to the editpart,
and therefore the connections and other nodes.

"Barry Lay" <blay@laysercomputing.com> wrote in message
news:css2g6$c3$1@www.eclipse.org...
>I would like to have a part "follow" other parts around when they are
>dragged, specifically I want it to appear in the middle of the actual
>connection points on the other ends of its connections. I have made the
>slave part a listener of the parts it is interested in so that I can move
>it when I get a change of the location or bounds on the master parts but
>the change notification comes through before the figures get re-rendered so
>I don't know where they have moved to. I can figure out how far they have
>moved or how much they have resized through the old and new values of the
>event but this is only an approximation - if the drag operation causes the
>underlying canvas to scroll I am way off.
>
> Is there a way for me to delay the positioning of the dependent figure
> until I know where it has to go? Would I need to override the getBounds
> method on the figure? Perhaps create my own LayoutManager for the
> container part?
>
> Thanks,
> Barry
Re: Coordinate movement of separate EditPart figures [message #165850 is a reply to message #165548] Thu, 27 January 2005 01:27 Go to previous messageGo to next message
Eclipse UserFriend
Randy Hudson wrote:
> You could create figure listeners for the other figure's you are trying to
> follow.
>
I though of that but it sounded like trouble.

> You could also just create a two-pass validation in your diagram figure.
> After it does the normal layout, have it go back and allow these special
> figures determine their own positions. This would be the easiest way to do
> it. The second pass could use a Locator which has access to the editpart,
> and therefore the connections and other nodes.
>
It sounds like you are suggesting that I create my own layout manager.
The background is currently using XYLayout. If I understand your
suggestion, I override its layout method to iterate through the
dependent child Figures after placing the non-dependent ones. The
dependent Figures would have Locators as part of their contraints rather
than Rectangles so that I can set their bounds based on their master
parts. The constraint type would tell me which pass to include the
child in.

Did I understand you correctly?

Thanks.

> "Barry Lay" <blay@laysercomputing.com> wrote in message
> news:css2g6$c3$1@www.eclipse.org...
>
>>I would like to have a part "follow" other parts around when they are
>>dragged, specifically I want it to appear in the middle of the actual
>>connection points on the other ends of its connections.
Re: Coordinate movement of separate EditPart figures [message #165971 is a reply to message #165850] Thu, 27 January 2005 11:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> It sounds like you are suggesting that I create my own layout manager. The
> background is currently using XYLayout. If I understand your suggestion,
> I override its layout method to iterate through the dependent child
> Figures after placing the non-dependent ones. The dependent Figures would
> have Locators as part of their contraints rather than Rectangles so that I
> can set their bounds based on their master parts. The constraint type
> would tell me which pass to include the child in.
>
> Did I understand you correctly?

No, your way sounds even better. Go with it.
Re: Coordinate movement of separate EditPart figures [message #166140 is a reply to message #165971] Fri, 28 January 2005 18:05 Go to previous messageGo to next message
Eclipse UserFriend
Randy Hudson wrote:
> No, your way sounds even better. Go with it.
>
Ok, I now have a XYDegelatingLayout that takes either a Rectangle or a
Locator as a constraint and it all seems to be working as desired, right
up until the contents part scrolls. I will have to look into how that
works now.

Thanks very much for your help.
Barry
Re: Coordinate movement of separate EditPart figures [message #166374 is a reply to message #166140] Mon, 31 January 2005 10:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

All children are in the same coordinate system, so you shouldn't be
transforming any coordinates.

What are you seeing when you scroll?

"Barry Lay" <blay@laysercomputing.com> escreveu na mensagem
news:ctegf1$vpp$1@www.eclipse.org...
> Randy Hudson wrote:
>> No, your way sounds even better. Go with it.
> Ok, I now have a XYDegelatingLayout that takes either a Rectangle or a
> Locator as a constraint and it all seems to be working as desired, right
> up until the contents part scrolls. I will have to look into how that
> works now.
>
> Thanks very much for your help.
> Barry
Re: Coordinate movement of separate EditPart figures [message #166378 is a reply to message #166374] Mon, 31 January 2005 14:43 Go to previous messageGo to next message
Eclipse UserFriend
Randy Hudson wrote:
> All children are in the same coordinate system, so you shouldn't be
> transforming any coordinates.
>
> What are you seeing when you scroll?

When the container part is scrolled the dependent part seems to be off
by the amount of the scroll but its connections appear to be pointing to
where it should be.

I have a custom connection anchor that uses getOwner().getBounds() in
its getLocation method which seems to be Ok but the locator relocate
method does a setBounds() on the figure which is off. I guess that I
either have a timing problem or I have to handle the connection and
primary layers differently somehow. With simple tracing I can see that
the relocate call happens before the getLocation (which is good) but I
don't know how it all relates to the scrolling.
Re: Coordinate movement of separate EditPart figures [message #166862 is a reply to message #166378] Thu, 03 February 2005 11:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Barry Lay" <blay@laysercomputing.com> escreveu na mensagem
news:ctm1pk$frs$1@www.eclipse.org...
> Randy Hudson wrote:
>> All children are in the same coordinate system, so you shouldn't be
>> transforming any coordinates.
>>
>> What are you seeing when you scroll?
>
> When the container part is scrolled the dependent part seems to be off by
> the amount of the scroll but its connections appear to be pointing to
> where it should be.
>
> I have a custom connection anchor that uses getOwner().getBounds() in its
> getLocation method which seems to be Ok but the locator relocate

Anchors must return absolute locations. This is the bug.

> method does a setBounds() on the figure which is off. I guess that I
> either have a timing problem or I have to handle the connection and
> primary layers differently somehow. With simple tracing I can see that
> the relocate call happens before the getLocation (which is good) but I
> don't know how it all relates to the scrolling.
Re: Coordinate movement of separate EditPart figures [message #167218 is a reply to message #166862] Sun, 06 February 2005 17:38 Go to previous message
Eclipse UserFriend
Randy Hudson wrote:
> Anchors must return absolute locations. This is the bug.

Thank you. Translating to/from absolute for the anchor methods cleared
up the problem. I assume that "absolute" means relative to the edit
viewer (not the Eclipse main window or the desktop window).
Previous Topic:How to make Figure transparent partly?
Next Topic:Dynamically change the anchor points.
Goto Forum:
  


Current Time: Fri Jun 20 01:41:25 EDT 2025

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

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

Back to the top