Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » parent element and child element relationship in graphiti
parent element and child element relationship in graphiti [message #1062046] Wed, 05 June 2013 14:42 Go to next message
abdallah Q is currently offline abdallah QFriend
Messages: 14
Registered: May 2013
Junior Member
Hi All Smile,

I'm new to garphiti and am working on a big project. i have an issue , what am trying to do is that when I creat the parent element,the childs element should be created automatically inside the parent element as shown in the following diagram

index.php/fa/15150/0/

is there any way to do it in graphiti?



Re: parent element and child element relationship in graphiti [message #1062054 is a reply to message #1062046] Wed, 05 June 2013 15:06 Go to previous messageGo to next message
Andrej K is currently offline Andrej KFriend
Messages: 26
Registered: March 2013
Location: germany
Junior Member
hi!
do you mean something like this?:
public class Add...Feature extends AbstractAddShapeFeature {

...

 @Override
	public PictogramElement add(IAddContext context) {

        IGaService gaService = Graphiti.getGaService();
        RoundedRectangle roundedRectangle;
        
        {/*do something*/}

            link(parentShape, addedClass);
        }
        Shape imageShape = peCreateService.createShape(containerShape, false);
        { /*do something*/
            link(imageShape, addedClass);
        }  

        Shape textShape = peCreateService.createShape(containerShape, false);
        {
         /*do something*/
        
         link(textShape, addedClass);
        }
}



after this I have an parent-element with few elements... few icons, text, colors...
Re: parent element and child element relationship in graphiti [message #1062138 is a reply to message #1062054] Thu, 06 June 2013 07:56 Go to previous messageGo to next message
abdallah Q is currently offline abdallah QFriend
Messages: 14
Registered: May 2013
Junior Member
hey Andre,

1st of all thank you for your fast reply and for your help Smile
what am trying to say when i create the parent element, the child-elements should be embedded and created by default inside the container-shape of the parent.
in my project the parent element should have exactly one of each child-element types and i have 3 types of child-element.
any idea Smile ?

Re: parent element and child element relationship in graphiti [message #1062255 is a reply to message #1062138] Thu, 06 June 2013 18:19 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 601
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Abdallah,

This depends on what you really asking for. A graphiti editor normally
works by creating one or more diagram elements for each underlying model
element. This is done using add features, like what Andre suggested.
This code then ensures that child shapes for a child model element is
inserted into the parent shape for the parent model element. The
activation of add features can be triggered/called in several ways:
- from a create feature, to ensure a shape is created for a new model
element
- from an update feature, to ensure a shape is created for a more
element (that somehow appeared)
- from an add feature, usually for the parent, to ensure shapes for all
children are created

If you want to create model elements (automatically), you use create
features, but these are normally triggered by user actions, e.g.
dragging an element from the palette etc.

Hope this helps.

Hallvard

On 06.06.13 00.56, abdallah qoraan wrote:
> hey Andre,
>
> 1st of all thank you for your fast reply and for your help :) what am
> trying to say when i create the parent element, the child-elements
> should be embedded and created by default inside the container-shape of
> the parent.
> in my project the parent element should have exactly one of each
> child-element types and i have 3 types of child-element.
> any idea :) ?
>
>
Previous Topic:Graphiti as RCP
Next Topic:Generate Diagram from Domain model file
Goto Forum:
  


Current Time: Sat Dec 20 20:10:43 GMT 2014

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

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