Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Invalid figure bounds.
Invalid figure bounds. [message #214880] Tue, 25 April 2006 00:28 Go to next message
Erik Johnson is currently offline Erik JohnsonFriend
Messages: 36
Registered: July 2009
Member
Hi-
I'm having an issue getting my editpart/figures to move properly because the
bounds of the figure are returning (0,0,0,0) in most cases.

I'm implementing copy/paste, and I'm trying to get paste so that the added
parts are relative to the top left corner of the container's viewport. When
I select parts and copy from editor A (lets say the parts are in the region
(1000, 1000, 200, 200)) and I paste into editor B where the viewport top
left is at (0,0), then I want the pasted parts to be added to the editor
with a slight offset, say 50, so that the bounds of the pasted parts are
(50, 50, 200, 200). What I do currently is calculate the delta between the
visible top left and the children, and issue a move children request after
the data has been added to the model. (NOTE: I've noticed that when the
container does refresh children, it creates the figures for the pasted data
and that the constraints on the figure are the same as the constraints from
the source editor).

What I've found as I've stepped through, when the figure canvas adds the new
figures, the initial constraints on each figure are correct (ie. with my
example above, the parts are all in that region starting at (1000, 1000)).
However, when I create the move request to move the parts, the bounds of the
added parts are now all returning (0,0,0,0)--it seems as if the constraints
that the parts are created with are lost.

The other issue, is that if I have a message box interrupt the paste
operation after the parts have been added to the canvas, the parts show up
in editor B at the original location copied from editor A, and then when I
dismiss the message box, which resumes the operation and creates the move
request, and then I see that the bounds of the figures are returning valid
rectangles.

So, I guess the question is, how can I reliably obtain valid bounds for a
figure that is added to the canvas? Or how would I delay firing off the
move children request until after the figures have been provided valid
bounds?

This is using Eclipse/GEF 3.1
Thanks,
Erik
Re: Invalid figure bounds. [message #214998 is a reply to message #214880] Tue, 25 April 2006 17:06 Go to previous message
Erik Johnson is currently offline Erik JohnsonFriend
Messages: 36
Registered: July 2009
Member
NOTE: I was able to get this working by calling validate() on the canvas
figure.


"Erik Johnson" <ejohnson@avaya.com> wrote in message
news:e2jqf5$98u$1@utils.eclipse.org...
> Hi-
> I'm having an issue getting my editpart/figures to move properly because
> the bounds of the figure are returning (0,0,0,0) in most cases.
>
> I'm implementing copy/paste, and I'm trying to get paste so that the added
> parts are relative to the top left corner of the container's viewport.
> When I select parts and copy from editor A (lets say the parts are in the
> region (1000, 1000, 200, 200)) and I paste into editor B where the
> viewport top left is at (0,0), then I want the pasted parts to be added to
> the editor with a slight offset, say 50, so that the bounds of the pasted
> parts are (50, 50, 200, 200). What I do currently is calculate the delta
> between the visible top left and the children, and issue a move children
> request after the data has been added to the model. (NOTE: I've noticed
> that when the container does refresh children, it creates the figures for
> the pasted data and that the constraints on the figure are the same as the
> constraints from the source editor).
>
> What I've found as I've stepped through, when the figure canvas adds the
> new figures, the initial constraints on each figure are correct (ie. with
> my example above, the parts are all in that region starting at (1000,
> 1000)). However, when I create the move request to move the parts, the
> bounds of the added parts are now all returning (0,0,0,0)--it seems as if
> the constraints that the parts are created with are lost.
>
> The other issue, is that if I have a message box interrupt the paste
> operation after the parts have been added to the canvas, the parts show up
> in editor B at the original location copied from editor A, and then when I
> dismiss the message box, which resumes the operation and creates the move
> request, and then I see that the bounds of the figures are returning valid
> rectangles.
>
> So, I guess the question is, how can I reliably obtain valid bounds for a
> figure that is added to the canvas? Or how would I delay firing off the
> move children request until after the figures have been provided valid
> bounds?
>
> This is using Eclipse/GEF 3.1
> Thanks,
> Erik
>
Previous Topic:Nice GEF example
Next Topic:IBM Redbook NetworkEditor
Goto Forum:
  


Current Time: Thu Sep 19 08:26:39 GMT 2024

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

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

Back to the top