Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » child shape inside parent shape
child shape inside parent shape [message #1060938] Wed, 29 May 2013 08:54 Go to next message
abdallah Q is currently offline abdallah QFriend
Messages: 14
Registered: May 2013
Junior Member
Hi all,

I'm workibng on a project using Graphiti. i've been searching to find any tutorial that can help me to deal with the containershape but i couldnt find anyone.

i'm trying to create a shape (which is the 'childShape' in the attached diagram) inside another shape (which is the 'ParentShape' in the attached diagram) and be able to connect two shapes of child type.

index.php/fa/15083/0/

is there any way to do it using graphiti?
Re: child shape inside parent shape [message #1061022 is a reply to message #1060938] Wed, 29 May 2013 14:31 Go to previous messageGo to next message
Vladimir D is currently offline Vladimir DFriend
Messages: 22
Registered: January 2013
Junior Member
Hi Abdallah,

you can specify that your childShape can be created only inside a parentShape. You can do this by overriding canCreate() method of your childShape create feature, and it should be something like this:

public boolean canCreate(ICreateContext context) {
	return getBusinessObjectForPictogramElement(context.getTargetContainer()) instanceof ParentShape;
}


After that, by overriding create method, you can add your childShape to your parentShape in the business model.
Re: child shape inside parent shape [message #1062039 is a reply to message #1061022] Wed, 05 June 2013 14:21 Go to previous messageGo to next message
abdallah Q is currently offline abdallah QFriend
Messages: 14
Registered: May 2013
Junior Member
thank you Vladimir ,its working now Smile

[Updated on: Wed, 05 June 2013 14:22]

Report message to a moderator

Re: child shape inside parent shape [message #1696648 is a reply to message #1061022] Wed, 27 May 2015 15:52 Go to previous messageGo to next message
Li li is currently offline Li liFriend
Messages: 3
Registered: May 2015
Junior Member
Hi:
I still have no idea about the codes,could you show me a simple example how to deal with this situation?

Vladimir D wrote on Wed, 29 May 2013 14:31
Hi Abdallah,

you can specify that your childShape can be created only inside a parentShape. You can do this by overriding canCreate() method of your childShape create feature, and it should be something like this:

public boolean canCreate(ICreateContext context) {
	return getBusinessObjectForPictogramElement(context.getTargetContainer()) instanceof ParentShape;
}


After that, by overriding create method, you can add your childShape to your parentShape in the business model.

Re: child shape inside parent shape [message #1696649 is a reply to message #1062039] Wed, 27 May 2015 15:54 Go to previous message
Li li is currently offline Li liFriend
Messages: 3
Registered: May 2015
Junior Member
Hi:
Can I have a look of your code?I dont know how to deal with this situation.
Thanks in advance
abdallah Q wrote on Wed, 05 June 2013 14:21
thank you Vladimir ,its working now Smile

Previous Topic:Disable/Remove SVN context menu items appearing in DiagramEditor
Next Topic:Connection rendering in Graphiti
Goto Forum:
  


Current Time: Thu Mar 28 12:04:10 GMT 2024

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

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

Back to the top