Das Projekt enthält bereits alle Komponenten, die in das Diagramm eingefügt werden sollen.
Für jeden Knoten, der eine Projektkomponente repräsentiert, wird ein Command benötigt, der beim Ziehen einer Komponente aus dem Projektbaum in das Diagramm ausgeführt wird.
- Fügen Sie unterhalb der Konfiguration des Knotens für Room die folgenden Zeilen für die Commands ein.
<!-- Commands -->
<!-- Commands to create nodes out of the project tree -->
<command xsi:type="createNodeForInstance" src="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Floor')" id="add_Floor" />
<command xsi:type="createNodeForInstance" src="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Room')" id="add_Room" />
- Speichern Sie die Diagrammkonfiguration ([Strg] + [S]).
Der Command wird mit dem xsi-Typ bestimmt, hier wird der Wert createNodeForInstance angewendet, da eine Instanz als Knoten in das Diagramm eingefügt wird.
Als Typ der Instanzen wird mit dem Attribut src="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Floor')" die Instanz einer Etage (Floor) und mit src="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Room')" die Instanz eines Raums (Room) bestimmt.
Da alle Konfigurationselemente eine ID benötigen, erhalten unsere ersten Commands die IDs add_Floor und add_Room.
<?xml version="1.0" encoding="UTF-8"?>
<diagramEditor xmlns="http://www.mind8.com/Diagram"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="diagram"
title="IT_SolutionMap" packageable="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Building')"
router="router" version="1" acceptedChildren="Floor">
<router id="router">
<routerClass xsi:type="baseRouters"
class="com.mind8.graph2d.router.ShortestPath" />
</router>
<!-- Nodes -->
<!-- Nodes of building components which inherit their properties -->
<node id="abstract_Buildingcomponent">
<figureContainer figure="com.mind8.graph2d.figure.Container">
<properties>
<property id="resizable">
<read value="true" />
</property>
<property id="showScrollBars">
<read value="false" />
</property>
<property id="showLabel">
<read value="true" />
</property>
<property id="boLineStyle">
<read value="4" />
</property>
<property id="boWidth">
<read value="4" />
</property>
<property id="boColor">
<read value="62,12,144" />
</property>
<property id="selectedBoColor">
<read value="255,0,10" />
</property>
<property id="fColor">
<read value="50,50,50" />
</property>
<property id="selectedFColor">
<read value="10,36,106" />
</property>
<property id="bColor">
<read value="255,255,255" />
</property>
<property id="transparency">
<read value="80" />
</property>
<property id="tooltip">
<read value="=$Tooltip" />
</property>
</properties>
</figureContainer>
</node>
<!-- Inherits properties of "abstract_Buildingcomponent" -->
<node id="Floor" super="abstract_Buildingcomponent"
valid="=isInstanceEO() and isInstanceOf('IT_Architecture.Levelcomponents.Floor')" acceptedChildren="Room">
<figurePolygon figure="com.mind8.graph2d.figure.container.Polygon">
<properties>
<property id="prefWidth">
<read value="2000" />
</property>
<property id="prefHeight">
<read value="2000" />
</property>
<property id="bendpointsCount">
<read value="4" />
</property>
<property id="bendpointsModifiable">
<read value="true" />
</property>
</properties>
</figurePolygon>
<property id="text">
<read value="=$Tooltip" />
<write key="value" receiver="=parameter('Number')" />
</property>
</node>
<!-- Inherits properties of "abstract_Buildingcomponent" -->
<node id="Room" super="abstract_Buildingcomponent"
valid="=isInstanceEO() and isInstanceOf('IT_Architecture.Levelcomponents.Room')">
<figurePolygon figure="com.mind8.graph2d.figure.container.Polygon">
<properties>
<property id="boLineStyle">
<read value="1" />
</property>
<property id="prefWidth">
<read value="400" />
</property>
<property id="prefHeight">
<read value="400" />
</property>
<property id="bendpointsCount">
<read value="4" />
</property>
<property id="bendpointsModifiable">
<read value="true" />
</property>
</properties>
</figurePolygon>
<property id="text">
<read value="=$Tooltip" />
</property>
</node>
<!-- Commands -->
<!-- Commands to create nodes out of the project tree -->
<command xsi:type="createNodeForInstance" src="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Floor')" id="add_Floor" />
<command xsi:type="createNodeForInstance" src="=isInstanceOf('IT_ModularSystem.Buildingcomponents.Room')" id="add_Room" />
</diagramEditor>