Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » getBounds() within a GEF diagram
getBounds() within a GEF diagram [message #195666] Mon, 12 September 2005 19:41 Go to next message
Nick Allen is currently offline Nick AllenFriend
Messages: 23
Registered: July 2009
Junior Member
I have a figure drawn in a GEF diagram using FreeflowLayout.
IFigure.getBounds() seems to always return Rectangle(0,0,0,0). When I
use an alternative approach to get the bounds through the layout manager
I receive the correct bounds
(IFigure.getParent().getLayoutManager().getConstraint(figure )). Why the
discrepency?

Thanks,
Nick
Re: getBounds() within a GEF diagram [message #195674 is a reply to message #195666] Mon, 12 September 2005 20:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

getBounds() is returning the current bounds. getContraint() is returning
the bounds that the figure will be once the layout manager gets a chance to
lay the child out.

"Nick Allen" <nwa@bitwiser.org> wrote in message
news:dg4lm4$af$1@news.eclipse.org...
> I have a figure drawn in a GEF diagram using FreeflowLayout.
> IFigure.getBounds() seems to always return Rectangle(0,0,0,0). When I
> use an alternative approach to get the bounds through the layout manager
> I receive the correct bounds
> (IFigure.getParent().getLayoutManager().getConstraint(figure )). Why the
> discrepency?
>
> Thanks,
> Nick
Re: getBounds() within a GEF diagram [message #195695 is a reply to message #195674] Tue, 13 September 2005 00:52 Go to previous messageGo to next message
Nick Allen is currently offline Nick AllenFriend
Messages: 23
Registered: July 2009
Junior Member
The problem I am trying to solve has arisen from my unit testing. One
test aims to determine whether I am able to set the location of a model
element.

In my test case, I add the model to the diagram via a command, which I
then execute on the command stack. I can see that a property-change
event is being propagated from my model to its EditPart and that the
model is being updated properly. I then check to make sure that the
figure's location has been updated. Calling getBounds() on the Figure
returns the default value of (0,0,0,0). I can see from my debugger that
the layout manager is never calling Figure.setBounds(...).

When I run the plugin manually everything works fine. The layout
manager does call Figure.setBounds(...) and Figure.getBounds() returns a
correct value.

What else do I need to add to my unit tests to ensure that the layout
manager's layout() method is called so that subsequently my figure's
setBounds method is called?

Any help is appreciated.
Re: getBounds() within a GEF diagram [message #195774 is a reply to message #195695] Tue, 13 September 2005 15:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

If you have a LWS, then try invoking
figure.getUpdateManager().performUpdate(). Otherwise you can make the root
figure layout on your own by invoking figure.valdiate().

"Nick Allen" <nwa@bitwiser.org> wrote in message
news:dg57ss$n2e$1@news.eclipse.org...
> The problem I am trying to solve has arisen from my unit testing. One
> test aims to determine whether I am able to set the location of a model
> element.
>
> In my test case, I add the model to the diagram via a command, which I
> then execute on the command stack. I can see that a property-change
> event is being propagated from my model to its EditPart and that the
> model is being updated properly. I then check to make sure that the
> figure's location has been updated. Calling getBounds() on the Figure
> returns the default value of (0,0,0,0). I can see from my debugger that
> the layout manager is never calling Figure.setBounds(...).
>
> When I run the plugin manually everything works fine. The layout
> manager does call Figure.setBounds(...) and Figure.getBounds() returns a
> correct value.
>
> What else do I need to add to my unit tests to ensure that the layout
> manager's layout() method is called so that subsequently my figure's
> setBounds method is called?
>
> Any help is appreciated.
Re: getBounds() within a GEF diagram [message #195815 is a reply to message #195774] Tue, 13 September 2005 16:23 Go to previous messageGo to next message
Nick Allen is currently offline Nick AllenFriend
Messages: 23
Registered: July 2009
Junior Member
Pratik Shah wrote:
> If you have a LWS, then try invoking
> figure.getUpdateManager().performUpdate(). Otherwise you can make the root
> figure layout on your own by invoking figure.valdiate().

That does the trick. Thanks for your help, Pratik.
Re: getBounds() within a GEF diagram [message #195872 is a reply to message #195815] Tue, 13 September 2005 22:00 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You can also call EditPartViewer.flush()

"Nick Allen" <nwa@bitwiser.org> wrote in message
news:dg6ueq$cg4$1@news.eclipse.org...
> Pratik Shah wrote:
>> If you have a LWS, then try invoking
>> figure.getUpdateManager().performUpdate(). Otherwise you can make the
>> root
>> figure layout on your own by invoking figure.valdiate().
>
> That does the trick. Thanks for your help, Pratik.
Previous Topic:Labeled Connection Routing problem
Next Topic:new Font() problem
Goto Forum:
  


Current Time: Tue Sep 24 03:11:53 GMT 2024

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

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

Back to the top