Andrej K Messages: 26 Registered: March 2013 Location: germany
I have 2 questions, maybe somebody can give me an idea how i can do this
I've created new "testFeature" extended from AbstractCustomFeature and can call it in my Diagram. How can i get a List which contains all Elements from the Diagram?(i want to update their names and colors at start and later)
My second question is:
I'm trying to add some Elements to the Diagram without drag and drop them from the palette.
For example i have some Elements saved in the Diagram and my "model say i miss 3 Elements in the Diagram". I want to write an Custom Feature, which draw/put missing Elements in the Graphiti Diagram with just one/two clicks, maybe i need to use Zest at this part? but at the beginning i just want to put few elements without drop them from the Palette, how can i do this?
Michael Wenz Messages: 1699 Registered: July 2009 Location: Walldorf, Germany
what exactly do you mean with "all Elements from the Diagram"? In case you
are talking about the Graphiti pictogram elements, you can simply retrieve
the sahpes contained directly in the diagram by calling getChildren on the
diagram instance. In case one of the returned shapes is a ContainerShape it
might again have children.
In order to add objects via drag&drop you can simply use an add feature that
adds the object representation to the diagram. Depending on where you drag
from, you might need to add an additional drag target listener to the
editor. The tutorial implements adding EClasses from the project explorer.
Have you seen that?
i think i know how to change the Name (code from "updatefeature" helps)... don't know if it works for Colors & Icons/pictures later.
Now i can change the Names of Elements but, problem is the condition of my IF is true just for Objects i created after the load. Objects/Elements which where created saved and loaded became not realized
for example i load my Diagram and have Object_1 and Object_2
then i add Object_3 and Object_4
(all 4 Objects are Tasks)
then I execute my testFeature and get all 4 Objects, but just Object_3 and 4 go into my IF Order and i can change the Names of them
How it could be?Why the IF Order don't realize loaded Elements?What I'm missing`?