Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Set Location of a Node
Set Location of a Node [message #188713] Thu, 22 May 2008 07:30 Go to next message
Eclipse UserFriend
Originally posted by: carlos.munoz.justinmind.com

Hi everyone,

When I create a type of Node, my application must create another type and
locate it in an specific place of the diagram.

I have cerate the second Node, but i don't know how to locate it where I
want in the diagram.
I have use the SetBoundsCommand but ther's no result. The Node is located
in the center of the diagram always.

Anyone knows how can I do this??

Thanks and sorry, my english isn't good, I'm from Spain.
Re: Set Location of a Node [message #189831 is a reply to message #188713] Wed, 28 May 2008 12:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi Carlos,

if I'm not wrong, in the Request you build (CreateViewRequest) to
create a new Node you can specify the location where the new View will
be created. Have you tried that?

Cheers,
Javi
--


Carlos Muñoz escribió:
> Hi everyone,
>
> When I create a type of Node, my application must create another type
> and locate it in an specific place of the diagram.
>
> I have cerate the second Node, but i don't know how to locate it where I
> want in the diagram.
> I have use the SetBoundsCommand but ther's no result. The Node is
> located in the center of the diagram always.
>
> Anyone knows how can I do this??
>
> Thanks and sorry, my english isn't good, I'm from Spain.
>
Re: Set Location of a Node [message #189898 is a reply to message #189831] Thu, 29 May 2008 03:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: carlos.munoz.justinmind.com

The CreateViewElement doesn't have a parameter for the location.

I tried this:

CompositeTransactionalCommand cc = new CompositeTransactionalCommand(
domain, DiagramUIMessages.AddCommand_Label);

PreferencesHint hint = new PreferencesHint(node.getName());

CreateViewAndElementRequest reqVEC = new
CreateViewAndElementRequest(ActivityScenariosElementTypes.Sc enarioPage_1001,
hint);

Iterator iter = reqVEC.getViewDescriptors().iterator();

CreateViewRequest.ViewDescriptor viewDescriptor =
(CreateViewRequest.ViewDescriptor)iter.next();

Point rectangle = new Point(1000,1000);

cc.compose(new SetBoundsCommand(domain,
DiagramUIMessages.SetLocationCommand_Label_Resize,
viewDescriptor,
rectangle));

try {
cc.execute(null, null);
...


is a SetBoundsCommand, but this is doing nothing.
Re: Set Location of a Node [message #190589 is a reply to message #189898] Mon, 02 June 2008 12:46 Go to previous message
Eclipse UserFriend
Try reqVEC.setLocation(Point)

CreateViewRequest inherits setLocation from CreateRequest.

- Rich


On 5/29/08 3:17 AM, in article
1ad4112d2a32385e03d44f0ae3c70e39$1@www.eclipse.org, "Carlos Muñoz"
<carlos.munoz@justinmind.com> wrote:

> The CreateViewElement doesn't have a parameter for the location.
>
> I tried this:
>
> CompositeTransactionalCommand cc = new CompositeTransactionalCommand(
> domain, DiagramUIMessages.AddCommand_Label);
>
> PreferencesHint hint = new PreferencesHint(node.getName());
>
> CreateViewAndElementRequest reqVEC = new
> CreateViewAndElementRequest(ActivityScenariosElementTypes.Sc enarioPage_1001,
> hint);
>
> Iterator iter = reqVEC.getViewDescriptors().iterator();
>
> CreateViewRequest.ViewDescriptor viewDescriptor =
> (CreateViewRequest.ViewDescriptor)iter.next();
>
> Point rectangle = new Point(1000,1000);
>
> cc.compose(new SetBoundsCommand(domain,
> DiagramUIMessages.SetLocationCommand_Label_Resize,
> viewDescriptor,
> rectangle));
>
> try {
> cc.execute(null, null);
> ..
>
>
>
> is a SetBoundsCommand, but this is doing nothing.
>
Previous Topic:New wizard
Next Topic:No more handles [gtk_init_check() failed]
Goto Forum:
  


Current Time: Mon Jun 02 01:53:04 EDT 2025

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

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

Back to the top