-
Notifications
You must be signed in to change notification settings - Fork 35
View
Note
Methods described in this section are are available only on Views - ArchiMate, Sketch and Canvas Views.
.add(element)
.add(relationship)
.createConnection()
.createObject()
.createViewReference()
.isAllowedConceptForViewpoint()
.openInUI()
.viewpoint
Create and return a new diagram object referencing an ArchiMate element with given bounds.
This method only applies to ArchiMate Views.
element
is an existing ArchiMate element.
autoNest
optional boolean parameter. If true the diagram object will be nested inside of any existing diagram object whose bounds surrounds the new object's bounds.
Setting width or height to -1 uses the default width and height as set in Archi's Preferences.
add(element, x, y, width, height)
add(element, x, y, width, height, autoNest)
Example:
var object= archimateView.add(businessActor, 10, 200, 150, 75);
var object= archimateView.add(businessRole, 10, 200, -1, -1, true);
Create and return a new visual object referencing an ArchiMate relationship.
relationship
is an existing ArchiMate relationship.
add(relationship, sourceDiagramComponent, targetDiagramComponent)
Example:
var object1 = archimateView.add(actor, 10, 10, 150, 70);
var object2 = archimateView.add(role, 200, 10, 150, 70);
var connection = archimateView.add(relationship, object1, object2);
Create and return a new non-ArchiMate connection between two objects in a View.
createConnection(source, target);
source
- the source object
target
- the target object
Connections can not be created between two ArchiMate objects.
Example:
var selectedView = $('view').get(0); // Get first view in the model
var note = selectedView.createObject("diagram-model-note", 10, 200, -1, -1); // Add a note
var group = selectedView.createObject("diagram-model-group", 10, 300, -1, -1); // Add a group
var connection = selectedView.createConnection(note, group); // Create and add a connection
connection.name = "My Connection"; // Give it a name
Create and return a new visual object of type with given bounds.
type
can be one of diagram-model-note
(or note
) or diagram-model-group
(or group
)
autoNest
optional boolean parameter. If true the diagram object will be nested inside of any existing diagram object whose bounds surrounds the new object's bounds.
Setting width or height to -1 uses the default width and height as set in Archi's Preferences.
createObject(type, x, y, width, height)
createObject(type, x, y, width, height, autoNest)
Example:
var note = archimateView.createObject("diagram-model-note", 10, 200, 200, 100, true);
note.setText("This is a note.\n\nHello World!");
var group = archimateView.createObject("diagram-model-group", 10, 200, -1, -1);
Create and return a new View reference object with given bounds.
view
is an existing View (diagram model)
autoNest
optional boolean parameter. If true the diagram object will be nested inside of any existing diagram object whose bounds surrounds the new object's bounds.
Setting width or height to -1 uses the default width and height as set in Archi's Preferences.
createViewReference(view, x, y, width, height)
createViewReference(view, x, y, width, height, autoNest)
Example:
var view1 = $('view').get(0); // Get first view in the model
var view2 = $('view').get(1); // Get next view in the model
var viewRef = view1.createViewReference(view2, 10, 10, 200, 55); // Create and add a view reference
archimateView.isAllowedConceptForViewpoint(conceptName)
Return true if the given concept is allowed in the current Viewpoint of an ArchiMate View.
Example:
var isallowed = archimateView.isAllowedConceptForViewpoint("business-actor"));
Open the given View in the UI. If the View's model is not currently open in the UI, it is opened before the View is opened.
theView.openInUI();
Get/set the Viewpoint of an ArchiMate View.
Allowed viewpoint identifier strings that can be set:
application_cooperation
application_usage
business_process_cooperation
capability
goal_realization
implementation_deployment
implementation_migration
information_structure
layered
migration
motivation
organization
outcome_realization
physical
product
project
requirements_realization
resource
service_realization
stakeholder
strategy
technology
technology_usage
Setting the viewpoint identifier to the empty string "" sets it to no viewpoint.
The returned viewpoint JS object consists of the viewpoint ID and the human readable name.
Example:
archimateView.viewpoint = "implementation_deployment";
var vp = archimateView.viewpoint;
var id = vp.id;
var name = vp.name;
If you value and use Archi please consider making a donation. Thanks!