Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to set the center of a newly created Figure at the Mouse Location?
How to set the center of a newly created Figure at the Mouse Location? [message #195362] Wed, 02 July 2008 11:32 Go to next message
Eclipse UserFriend
Originally posted by: rolfes.daniel.web.de

Hi,

I create a figure from the palette onto the diagram. The mouse location
and the upper-left point of the newly created element will be the same
after the creation.
But I would like the mouse location to be the center of the newly
created element.
How can I achieve this?

Thanks,
Daniel
Re: How to set the center of a newly created Figure at the Mouse Location? [message #195672 is a reply to message #195362] Thu, 03 July 2008 13:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rolfes.daniel.web.de

Hi,

I've searched the newsgroup for solutions and there were suggestions to
set a breakpoint to SetBoundsCommand. I did the following in the
LayoutPolicy in the "protected Command getCreateCommand(CreateRequest
request)" method:

req.setLocation(//a fixed position));

This works fine.

My problem is that the location depends on the size of the Figures I
want to create. So I figured I have to somehow get to the corresponding
EditPart or Figure to get the size. The SetBoundsCommand is afaiu
invoked while the Mouse is moved (mouse_move). At this point the
EditPart and the Figure are not even created. I think they will be
created during the "Mouse Click" (mouse_up).
My problem is quite similiar to this one:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg11496.html

So as i understand, what I need is a place where the mouse location is
known and I am able to get to the created EditPart or Figure.
After that I can use setLocation() on the created Figure, or is this the
wrong idea?

Could someone please point me in the right direction?

Thanks,
Daniel


D. Rolfes schrieb:
> Hi,
>
> I create a figure from the palette onto the diagram. The mouse location
> and the upper-left point of the newly created element will be the same
> after the creation.
> But I would like the mouse location to be the center of the newly
> created element.
> How can I achieve this?
>
> Thanks,
> Daniel
Re: How to set the center of a newly created Figure at the Mouse Location? [message #197182 is a reply to message #195672] Tue, 15 July 2008 21:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rolfes.daniel.web.de

Hi,
could anyone help me out on this, please?

D. Rolfes schrieb:
> Hi,
>
> I've searched the newsgroup for solutions and there were suggestions to
> set a breakpoint to SetBoundsCommand. I did the following in the
> LayoutPolicy in the "protected Command getCreateCommand(CreateRequest
> request)" method:
>
> req.setLocation(//a fixed position));
>
> This works fine.
>
> My problem is that the location depends on the size of the Figures I
> want to create. So I figured I have to somehow get to the corresponding
> EditPart or Figure to get the size. The SetBoundsCommand is afaiu
> invoked while the Mouse is moved (mouse_move). At this point the
> EditPart and the Figure are not even created. I think they will be
> created during the "Mouse Click" (mouse_up).
> My problem is quite similiar to this one:
> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg11496.html
>
> So as i understand, what I need is a place where the mouse location is
> known and I am able to get to the created EditPart or Figure.
> After that I can use setLocation() on the created Figure, or is this the
> wrong idea?
>
> Could someone please point me in the right direction?
>
> Thanks,
> Daniel
>
>
> D. Rolfes schrieb:
>> Hi,
>>
>> I create a figure from the palette onto the diagram. The mouse
>> location and the upper-left point of the newly created element will be
>> the same after the creation.
>> But I would like the mouse location to be the center of the newly
>> created element.
>> How can I achieve this?
>>
>> Thanks,
>> Daniel
Re: How to set the center of a newly created Figure at the Mouse Location? [message #199946 is a reply to message #197182] Sun, 03 August 2008 18:47 Go to previous message
Eclipse UserFriend
Originally posted by: rolfes.daniel.web.de

Hi,
i've still not managed this problem.
My problem:
I create a figure from the palette onto the diagram. The mouse
location and the upper-left point of the newly created element will
be the same after the creation.
But I would like the mouse location to be the center of the newly
created element.


Thanks,
Daniel

D. Rolfes schrieb:
> Hi,
> could anyone help me out on this, please?
>
> D. Rolfes schrieb:
>> Hi,
>>
>> I've searched the newsgroup for solutions and there were suggestions
>> to set a breakpoint to SetBoundsCommand. I did the following in the
>> LayoutPolicy in the "protected Command getCreateCommand(CreateRequest
>> request)" method:
>>
>> req.setLocation(//a fixed position));
>>
>> This works fine.
>>
>> My problem is that the location depends on the size of the Figures I
>> want to create. So I figured I have to somehow get to the
>> corresponding EditPart or Figure to get the size. The SetBoundsCommand
>> is afaiu invoked while the Mouse is moved (mouse_move). At this point
>> the EditPart and the Figure are not even created. I think they will be
>> created during the "Mouse Click" (mouse_up).
>> My problem is quite similiar to this one:
>> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg11496.html
>>
>> So as i understand, what I need is a place where the mouse location is
>> known and I am able to get to the created EditPart or Figure.
>> After that I can use setLocation() on the created Figure, or is this
>> the wrong idea?
>>
>> Could someone please point me in the right direction?
>>
>> Thanks,
>> Daniel
>>
>>
>> D. Rolfes schrieb:
>>> Hi,
>>>
>>> I create a figure from the palette onto the diagram. The mouse
>>> location and the upper-left point of the newly created element will
>>> be the same after the creation.
>>> But I would like the mouse location to be the center of the newly
>>> created element.
>>> How can I achieve this?
>>>
>>> Thanks,
>>> Daniel
Previous Topic:GMF + swing
Next Topic:can I add information to the semantic model without show them in the diagram?
Goto Forum:
  


Current Time: Wed Apr 24 21:55:34 GMT 2024

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

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

Back to the top