Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » creating nested shapes(How to create a shape inside another shape)
creating nested shapes [message #717419] Sat, 20 August 2011 14:23 Go to next message
vrm  is currently offline vrm Friend
Messages: 31
Registered: June 2011
Member
My editor need to support drawing a rectangle shape inside another rectangle shape,like the concept of UML 2.0 composite structure diagram.

http://www.google.co.uk/imgres?q=Composite+classes+in+UML&hl=en&gbv=2&tbm=isch&tbnid=djWJdC2UFxHExM:&imgrefurl=http://www.primordion.com/Xholon/doc/tutorial.html&docid=WcX5yDUp9B9gOM&w=330&h=119&ei=7MFPTtaYO5O1hAedjaH4Bg&zoom=1&iact=hc&vpx=418&vpy=306&dur=326&hovh=95&hovw=263&tx=115&ty=28&page=3&tbnh=75&tbnw=208&start=23&ndsp=16&ved=1t:429,r:1,s:23&biw=1138&bih=555

I suppose in the canAdd() for the nested Element,I need to check if context.getTargetContainer() belongs to the container shape of the parent element.
Is that right ? if not ,how can this be done ?Any sample code would be helpful.
Re: creating nested shapes [message #718434 is a reply to message #717419] Wed, 24 August 2011 10:27 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Yes, that's right. You will need to check if the passed targetContainer is
allowed as parent for the object to add. Simply do a instanceof check (e.g.
instanceOf ContainerShape) and a check for any additional properties or
other stuff that identifies your graphical object.

HTH,
Michael

"vrm" <forums-noreply@eclipse.org> wrote in message
news:j2ofck$ahp$1@news.eclipse.org...
> My editor need to support drawing a rectangle shape inside another
> rectangle shape,like the concept of UML 2.0 composite structure diagram.
>
>
>
> I suppose in the canAdd() for the nested Element,I need to check if
> context.getTargetContainer() belongs to the container shape of the parent
> element.
> Is that right ? if not ,how can this be done ?Any sample code would be
> helpful.
Re: creating nested shapes [message #723110 is a reply to message #718434] Wed, 07 September 2011 16:29 Go to previous message
Sébastien  Gandon is currently offline Sébastien GandonFriend
Messages: 181
Registered: July 2009
Senior Member
just to add that you also require the canCreate method of the CreateFeature to also return true accordingly to you criteria.
Previous Topic:Editor marked dirty after loading default diagramm on startup
Next Topic:Exception using a ContainerShape for grouping
Goto Forum:
  


Current Time: Wed Nov 26 16:39:39 GMT 2014

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

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