Components

Component classes constitute the application.

AppContext

The global application context. An instance of this class can be accessed via the global app variable. Do not try to create an instance using new keyword.

new AppContext()

Extends EventEmitter

Example
var appName = app.name
console.log(appName)
Instance Members
name
version
type
menu
contextMenu
commands
project
repository
preferences
selections
engine
factory
diagrams
toolbox
editorsHolder
toolbar
dialogs
toast
panelManager
commandPalette
elementPickerDialog
elementListPickerDialog
elementListEditorDialog
tagEditorDialog
tagValueEditorDialog
getAppPath()
getUserPath()

ProjectManager

Project Manager

new ProjectManager()

Extends EventEmitter

Instance Members
getProject()
getFilename()
newProject()
closeProject()
save(fullPath)
load(fullPath)
loadAsTemplate(fullPath)
loadFromJson(data)
importFromFile(parent, fullPath)
importFromJson(parent, data)
exportToFile(elem, fullPath)
Events
projectCreated
beforeProjectClose
projectClosed
projectSaved
projectLoaded
imported
exported

CommandManager

Manages global application commands that can be called from menu items, key bindings, or subparts of the application.

new CommandManager()

Extends EventEmitter

Instance Members
commands
commandNames
register(id, commandFn, name)
execute(id, args)
Events
commandRegistered
beforeExecuteCommand

Repository

Repository maintains a set of elements.

Reponsibilities:

  • Applies operations. (Undo/Redo)
  • Query for retrieve elements.
new Repository()

Extends EventEmitter

Instance Members
doOperation(operation)
undo()
redo()
clear()
isModified()
isElement(elem)
select(selector)
get(id)
getInstancesOf(_typeName)
find(predicate)
findAll(predicate)
search(keyword, typeFilter)
lookupAndFind(namespace, name, typeFilter)
getRefsTo(elem, iterator)
getRelationshipsOf(model, iterator)
getViewsOf(model)
getOperationBuilder()
Events
reordered
relocated
created
deleted
updated
beforeExecuteOperation
operationExecuted
beforeUndo
undo
beforeRedo
redo

OperationBuilder

OperationBuilder is used to build an operation

new OperationBuilder()

Extends EventEmitter

Instance Members
getTimestamp()
begin(name, bypass, opName)
end()
discard()
getOperation()
insert(elem)
remove(elem)
fieldAssign(elem, field, val)
fieldInsert(elem, field, val)
fieldInsertAt(elem, field, val, pos)
fieldRemove(elem, field, val)
fieldRemoveAt(elem, field, val, pos, value)
fieldReorder(elem, field, val, pos)
fieldRelocate(elem, field, oldParent, newParent)

Engine

Engine has fundamental operations to manipulate model and view elements.

new Engine()
Instance Members
addModel(parent, field, model)
addViews(diagram, views)
addModelAndView(diagram, model, view, parent, parentField, containerView)
setProperty(elem, field, value)
setProperties(elem, fieldValueMap)
setElemsProperty(elems, field, value, views)
deleteElements(models, views)
addItem(elem, field, val)
removeItem(elem, field, val)
moveUp(parent, field, elem)
moveDown(parent, field, elem)
relocate(elem, newOwner, field)
moveViews(editor, views, dx, dy)
moveParasiticView(editor, view, alpha, distance)
resizeNode(editor, node, left, top, right, bottom)
modifyEdge(editor, edge, points)
reconnectEdge(editor, edge, points, newParticipant, newParticipantModel, isTailSide)
moveViewsChangingContainer(editor, views, dx, dy, containerView, containerModel)
setFillColor(editor, views, color)
setLineColor(editor, views, color)
setFont(editor, views, face, size, color)
setFontColor(editor, views, color)
setFontFace(editor, views, fontFace)
setFontSize(editor, views, fontSize)
setStereotypeDisplay(editor, views, stereotypeDisplay)
setLineStyle(editor, views, lineStyle)
setAutoResize(editor, views, autoResize)
layoutDiagram(editor, diagram, direction, separations, edgeLineStyle)

SelectionManager

Selection Manager

new SelectionManager()

Extends EventEmitter

Instance Members
getSelectedModels()
getSelectedViews()
deselectAll()
select(models, views)
selectModel(model)
selectViews(views)
getSelected()
Events
selectionChanged

PreferenceManager

PreferenceManager only works in browser (it uses global localStorage object).

new PreferenceManager()

Extends EventEmitter

Instance Members
get(key, defaultValue)
set(key, value)

Factory

Factory creates model, view and diagram elements

new Factory()

Extends EventEmitter

Instance Members
createDiagram(options)
createModel(options)
createModelAndView(options)
createViewOf(options)
createViewAndRelationships(editor, x, y, model, containerView, viewType)
Events
diagramCreated
elementCreated

Menu Manager

new MenuManager()
Instance Members

ContextMenuManager

Context Menu Manager

new ContextMenuManager()
Instance Members
popup(selector)

DiagramManager

Diagram Manager manages working diagrams

new DiagramManager()

Extends EventEmitter

Instance Members
openDiagram(diagram)
updateDiagram(diagram)
closeDiagram(diagram)
getWorkingDiagrams()
saveWorkingDiagrams()
restoreWorkingDiagrams()
closeOthers()
closeAll()
setCurrentDiagram(diagram, skipEvent)
getCurrentDiagram()
nextDiagram()
previousDiagram()
selectAll()
deselectAll()
selectInDiagram(view)
repaint()
setZoomLevel(value)
getZoomLevel()
toggleGrid()
showGrid()
hideGrid()
isGridVisible()
getViewportSize(x)
scrollTo(x, y, animation)
getScrollPosition()
getDiagramArea()
Events
workingDiagramAdd
workingDiagramUpdate
workingDiagramRemove
repaint
currentDiagramChanged

Font

Font

new Font(face: any, size: any, style: any)
Parameters
face (any)
size (any)
style (any)
Static Members
FS_NORMAL
FS_BOLD
FS_ITALIC
FS_BOLD_ITALIC
Instance Members
face
size
style

UI Components

User interface components.

DialogManager

DialogManager

new DialogManager()
Instance Members
showInputDialog(message, initialValue)
showTextDialog(message, text)
showSelectRadioDialog(message, options, items)
showSelectDropdownDialog(message, options, items)
showColorDialog(color)
showFontDialog(font)
showSimpleDialog(message)
showConfirmDialog(message)
showAlertDialog(message)
showInfoDialog(message)
showOpenDialog(title, defaultPath, filters, options)
showSaveDialog(title, defaultPath, filters)
showSaveConfirmDialog(filename)
showErrorDialog(message)

Dialog

new Dialog($dlg: $.Element, promise: Promise)
Parameters
$dlg ($.Element) The dialog jQuery element
promise (Promise) A promise that will be resolved with the ID of the clicked button when the dialog is dismissed. Never rejected.
Instance Members
getElement()
getPromise()
close()
then(callback)

EditorsHolderView

EditorsHolder contains StyleEditorView, PropertyEditorView, and DocumentationEditorView

new EditorsHolderView()
Instance Members
toggle()
show()
hide()
isVisible()

ElementPickerDialog

Element Picker Dialog

new ElementPickerDialog()
Instance Members
expand(elem, expandAllParents)
select(elem, scrollTo)
showDialog(title, selected, type)

ElementListEditorDialog

Element List Editor Dialog

new ElementListEditorDialog()
Instance Members
showDialog(elem, field)

ElementListPickerDialog

Element List Picker Dialog

new ElementListPickerDialog()
Instance Members
showDialog(title, elems)

Panel

Represents a panel below the editor area (a child of ".content"). Don'y try to instantiate, use PanelManager.createBottomPanel().

new Panel($panel: jQueryObject, minSize: number)
Parameters
$panel (jQueryObject) The entire panel, including any chrome, already in the DOM.
minSize (number) Minimum height of panel in px.
Instance Members
isVisible()
setVisible(visible)

PanelManager

PanelManager

new PanelManager()
Instance Members
createBottomPanel(id, $panel, minSize)

TagEditorDialog

Tag Editor Dialog

new TagEditorDialog()
Instance Members
showDialog(elem)

TagValueEditorDialog

Tag Value Editor Dialog

new TagValueEditorDialog()
Instance Members
showDialog(tag, attr)

ToastManager

ToastManager

new ToastManager()
Instance Members
info(message)
warning(message)
error(message)

ToolbarView

Toolbar

new ToolbarView()
Instance Members
toggle()
show()
hide()
isVisible()

ToolboxView

Toolbox View

new ToolboxView()

Extends EventEmitter

Instance Members
groups
items
activeItem
activeItemLocked
setActiveItemLock(locked)
selectItem(itemId)
expandGroup(groupId)
collapseGroup(groupId)
toggle()
show()
hide()
isVisible()

Elements

Element classes constitute a software model.

Element

Element

new Element()
Static Members
AK_PRIM
AK_ENUM
AK_REF
AK_REFS
AK_OBJ
AK_OBJS
AK_VAR
AK_CUSTOM
getSuperType(subType)
getCommonType(elems)
getNewName(array, prefix)
mergeProps(elems, prop)
Instance Members
_id
_parent
getDisplayClassName()
getClass()
getClassName()
getMetaClass()
getMetaAttributes()
getParentField()
getNodeIcon()
getNodeText(options)
getOrdering(index)
getChildNodes(sort)
getChildren()
traverse(fun)
traverseDepthFirst(fun)
traverseField(field, fun)
traverseFieldDepthFirst(field, fun)
traverseUp(fun)
lookup(name, typeFilter, namespace)
findByName(name)
lookdown(pathName)
isOneOfTheContainers(elem)
canContainKind(kind)
canContain(elem)
canCopy()
canDelete()
canHide()
canPaste(kind, copyContext)

Model

Model

new Model()

Extends Element

Instance Members
name
ownedElements
getViewType()
getPath(base)
getPathname()
canContain(elem)
canContainDiagramKind(kind)
canContainDiagram(diagram)
canRelocateTo(model)

Tag

Tag

new Tag()

Extends Model

Static Members
TK_STRING
TK_REFERENCE
TK_BOOLEAN
TK_NUMBER
Instance Members
kind
value
reference
checked
number
hidden

Hyperlink

new Hyperlink()

Extends Model

Instance Members
reference
url

ExtensibleModel

ExtensibleModel

new ExtensibleModel()

Extends Model

Instance Members
documentation
tags
hasTag(tagName)
getTag(tagName)
getTagValue(tagName)

Relationship

Relationship

new Relationship()

Extends ExtensibleModel

DirectedRelationship

DirectedRelationship

new DirectedRelationship()

Extends Relationship

Instance Members
target
source

RelationshipEnd

RelationshipEnd

new RelationshipEnd()

Extends ExtensibleModel

Instance Members
reference

UndirectedRelationship

UndirectedRelationship

new UndirectedRelationship()

Extends Relationship

Instance Members
end1
end2

View

View

new View()

Extends Element

Static Members
SK_NO
SK_YES
SK_PROPAGATE
Instance Members
model
subViews
containerView
containedViews
visible
enabled
selected
selectable
lineColor
fillColor
fontColor
font
showShadow
traverse(fun)
traverseDepthFirst(fun)
getDiagram()

NodeView

NodeView

new NodeView()

Extends View

Static Members
SZ_NONE
SZ_HORZ
SZ_VERT
SZ_RATIO
SZ_FREE
MM_NONE
MM_HORZ
MM_VERT
MM_FREE
Instance Members
left
top
width
height
minWidth
minHeight
sizable
movable
autoResize
getRight()
setRight(value)
getBottom()
setBottom(value)
getCenter()

EdgeView

EdgeView

new EdgeView()

Extends View

Static Members
LM_SOLID
LM_DOT
LM_DASH
LS_RECTILINEAR
LS_OBLIQUE
LS_ROUNDRECT
LS_CURVE
LS_DIRECT
ES_FLAT
ES_STICK_ARROW
ES_SOLID_ARROW
ES_TRIANGLE
ES_FILLED_TRIANGLE
ES_DIAMOND
ES_FILLED_DIAMOND
ES_ARROW_DIAMOND
ES_ARROW_FILLED_DIAMOND
ES_PLUS
ES_CIRCLE
ES_CIRCLE_PLUS
ES_CROWFOOT_ONE
ES_CROWFOOT_MANY
ES_CROWFOOT_ZERO_ONE
ES_CROWFOOT_ZERO_MANY
Instance Members
head
tail
lineStyle

LabelView

LabelView

new LabelView()

Extends NodeView

Static Members
DK_HORZ
DK_VERT
Instance Members
underline
text
horizontalAlignment
verticalAlignment
direction
wordWrap

ParasiticView

ParasiticView

new ParasiticView()

Extends NodeView

Instance Members
alpha
distance

NodeParasiticView

NodeParasiticView

new NodeParasiticView()

Extends ParasiticView

Instance Members
hostNode

EdgeParasiticView

EdgeParasiticView

new EdgeParasiticView()

Extends ParasiticView

Static Members
EP_HEAD
EP_MIDDLE
EP_TAIL
Instance Members
hostEdge
edgePosition

NodeLabelView

NodeLabelView

new NodeLabelView()

Extends NodeParasiticView

Instance Members
underline
wordWrap

EdgeLabelView

EdgeLabelView

new EdgeLabelView()

Extends EdgeParasiticView

Instance Members
underline
wordWrap

NodeNodeView

NodeNodeView

new NodeNodeView()

Extends NodeParasiticView

EdgeNodeView

EdgeNodeView

new EdgeNodeView()

Extends EdgeParasiticView

Diagram

Diagram

new Diagram()

Extends ExtensibleModel

Static Members
LD_TB
LD_BT
LD_LR
LD_RL
Instance Members
visible
defaultDiagram
ownedViews
selectedViews
getViewOf(model, viewType)

Project

Project

new Project()

Extends ExtensibleModel

FreelineEdgeView

FreelineEdgeView

new FreelineEdgeView()

Extends EdgeView

Unique token used to indicate user-driven cancellation of Save As (as opposed to file IO error)