Creating, Deleting and Modifying Elements
Creating elements
Creating a model element
// Get a reference to top-level project
var project = app.repository.select("@Project")[0]
// Create a UMLModel element as a child of project
var model1 = app.factory.createModel({ id: "UMLModel", parent: project })
// Create a UMLClass element as a child of the model
var class1 = app.factory.createModel({ id: "UMLClass", parent: model1 })
// Create a UMLAttribute element and add to the field 'attributes' of the class
var attr1 = app.factory.createModel({ id: "UMLAttribute", parent: class1, field: "attributes" })
// Create a UMLClass with options
var options = {
id: "UMLClass",
parent: model1,
modelInitializer: function (elem) {
elem.name = "MyClass";
elem.isAbstract = true;
}
}
var class2 = app.factory.createModel(options);Creating a diagram
Creating a model element and a view element at once
Creating a view element of an existing model element
Adding tags to an element
Deleting elements
Modifying elements
Change property value
Examples
Sequence Diagram
Last updated