In order to create new elements in diagram it is neccessary to describe graphical presentation of new elements. To do this following construction has to be added to the config file. In this chapter every step will be shown on the base of sample config file.
Graphical presentation definition startes from the header :
view.map.*.{element_unique_name}.isTopLevel() =
Where:
| view.map.* | Predefined construction |
| element_unique_name | Element name, defined in previous section |
| isTopLevel() | This construction mean that all of following operations will be produced if element on the top level of the diagram (usially) |
For example:
view.map.*.sdEntity.isTopLevel() =
The next line sets shape of new element:
\ setGraphicObject("{shape_name}");
\
setLayoutConstraints( {parameter}, [parameter], ...
);
Where:
| setGraphicObject | Functions which sets shape "shape_name" of element. The predefined shapes are: Cube, RectangleVisible, Circle, RoundRectangle, Oval, Folder, Note, Actor and others |
| setLayoutConstraints | Sets parameters of the element presentation. This function is optional. |
| parameter | Parameters are name-described. See the examlpe below. |
For example:
\ setGraphicObject("Cube");
\
setLayoutConstraints(minWidth(20),minHeight(20),
\
preferredWidth(100),preferredHeight(100),
\
canShiftX(true),canShiftY(true));
By this optional step we will set some useful features and compartments to graphical presentation of element. At first we will add ability to show unique name of element on it's presentation.
\ name = addCompartment("RectangleInvisible","Name");
\
name->setLayoutConstraints(horizontalAlign("left"),verticalAlign("top"),
\
widthAlign("parentDefined"));
Here we register new compartment with name
"Name" and shape "RectangleInvisible". Then set layouts for it.
At the next step we add element's name to the
compartment:
\ nameLabel =
addToCompartment(label(getProperty("$name")),"Name");
Here function addToCompartment add new label to the
compartment with name "Name". Function getProperty returns value of "$name" for
this element ( defined at the beginning of config file as the uniqueName
for the element )
This line adds the ability to edit element's name in the label.
property:= "$name" shows which property of element has to be updated.
\
nameLabel->setInplaceEditor({property:="$name",default:=true});
Following two lines sets
properties forthelabel.
\ nameLabel->setAlignment("Center");
\
nameLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true));
This last line enables the element to have a links to an
another elements.
\ setCanHaveLinks()