Professional Documents
Culture Documents
StarUML Documentation - Part21
StarUML Documentation - Part21
StarUML Documentation - Part21
var options1 = {
id: "UMLClass",
parent: diagram1._parent,
diagram: diagram1,
x1: 100,
y1: 100,
x2: 200,
y2: 200
}
var classView1 = app.factory.createModelAndView(options1)
You will see the one more class view element at (500, 500).
Modifying elements
Sequence Diagram
Here is an example to create a Sequence Diagram including two Lifelines and a Message.
// Create a Lifeline
var options1 = {
id: "UMLLifeline",
parent: diagram1._parent,
diagram: diagram1,
x1: 50,
y1: 20,
x2: 50,
y2: 20
}
var lifelineView1 = app.factory.createModelAndView(options1)
We need to distinguish between selected views and selected models. If you select the Book
class in a diagram, then there is a selected view ( UMLClassView ) and a selected model
( UMLClass ). If you select the Author class in Model Explorer, then there is a selected model
( UMLClass ) and no selected views.
To scroll automatically so as to show the element, pass true value as the second parameter.
app.modelExplorer.select(book, true)
To select a view element in diagram, use app.diagrams . You can find more functions about
selection in API Reference.
app.diagrams.selectInDiagram(view1)