Core

Description

Core classes is defined in this module. We don't recommend to instantiate instance of classes defined in this module in your extension.

(This module is not well documented)

Variables Summary

Functions Summary

Classes Summary

Variables

Public API

ATTR_KIND_PRIM

Attribute Kind

Public API

DIRECTION_TB

Diagram Layout Direction

Public API

DK_HORZ

Direction Kind

Public API

EP_HEAD

Edge Position

Public API

ES_FLAT

Line End Style

LAYOUT_MARGIN_LEFT

Constants for Layout

Public API

LM_SOLID

Line Mode

Public API

LS_RECTILINEAR

Line Style

Public API

MM_NONE

Move Mode

Public API

SK_NO

Selectable Kind

Public API

SZ_NONE

Sizing Mode

Public API

TK_STRING

TagKind

Functions

Public API

findByName

Find element by name in a given array.

array Array.<Element>
name string
Returns: Element
Public API

getCommonType

Return a generalized type of given elements.

elems Array.<Element>
Returns: constructor
Public API

getNewName

Find an available name in a given array. (e.g. Class1, Class2, ... )

array Array.<Element>
prefix string
Prefix for name
Returns: string
Return a new name
Public API

getSuperType

Return a super type of a given type.

subType constructor
Returns: constructor
- superType of subType

Classes

Properties

_id

gloly unique identifier

Type: string

_parent

reference to its parent

Type: object

Methods

assignFrom

Load it's state data from memento

memento object

assignTo

Store it's state data to memento

memento object

canContain

Return true only if it can contain a given element.

elem Element
Returns: Boolean

canContainKind

Return true only if it can contain the kind of elements

kind string
Returns: Boolean

canCopy

Return true only if it could be copied.

Returns: Boolean

canDelete

Return true only if it could be deleted alone.

Returns: Boolean

canPaste

Return true only if it can accomodate elements in clipboard based on a given kind and copyContext.

kind string
copyContext {field:string}
Returns: Boolean

diff

Return differences between it's state data and data stored in memento.

memento object
Returns: Array.<{elem:Element,f:string,n:?,o:?}>
`{f: Field name, n: New value, o: Old value}`
Public API

findByName

Find by name in child elements

name string,Array.<string>
Returns: Element

getChildNodes

Return all child nodes to be shown in Explorer.

sort boolean
Returns: Array.<Element>

getChildren

Return all children.

Returns: Array.<Element>

getClass

Return Class. (equivalent to type[element.getClassName()])

Returns: constructor

getClassName

Return Class name.

Returns: string

getDisplayClassName

Return class name for display (e.g. "Class" rather than "UMLClass").

Returns: string

getMetaAttributes

Return Meta Attributes.

Returns: Array.<{name:string,kind:string,type:string}>

getMetaClass

Return Meta Class.

Returns: Object

getNodeIcon

Return CSS class name of icon for this object. (Shown in Explorer)

Returns: string
- iconClass명 (e.g. 'icon-UMLClass')

getNodeText

Return textual string for this object. (Shown in Explorer)

Returns: string
Text (e.g. '<>Class1')

getOrdering

Return ordering priority number. (Lower value comes first in Explorer)

index number
Returns: Number

getParentField

Return name of parent's field containing this object.

Returns: string
Field name (e.g. 'ownedElements')

isOneOfTheContainers

Return true only if a given elem is one of the container.

elem Element
Returns: boolean

load

Read it's state data from Reader.

reader Reader

lookdown

Look down an element along parent-children chains.

pathName Array.<string>
Returns: Element

lookup

Find an element by name. Find through ownedElements chain, and then lookup through _parent chain.

name string
typeFilter constructor
namespace Element
Lookup only inside of namespace
Returns: Element
Return the first matched element.

save

Write it's state data to writer.

writer Writer

traverse

Traverse all nodes in the tree structure. (Breadth-First Traversal)

fun function(elem:Element)

traverseDepthFirst

Traverse all nodes in the tree structure. (Depth-First Traversal)

fun function(elem:Element)

traverseField

Traverse a specific field chains. (Breadth-First Traversal)

field string
Field name to traverse (e.g. 'ownedElements')
fun function

traverseFieldDepthFirst

Traverse a specific field chains. (Depth-First Traversal)

field string
Field name to traverse (e.g. 'ownedElements')
fun function

traverseUp

Traverse up along with the _parent chain.

fun function

Properties

name

Type: string

ownedElements

Type: Array.<Model>

Methods

canContain Overrides parent implementation

Return true only if it can contain a given element.

elem Element
Returns: Boolean

canContainDiagram

Determines whether a given diagram can be contained or not.

diagram Diagram
Returns: Boolean

canContainDiagramKind

Determines whether a given diagram type name can be contained or not.

kind string
Returns: Boolean

canRelocateTo

Determines whether this object can be relocated to a given element.

model Model
Returns: Boolean

getPath

Get path to from a given base

base Model
Returns: Array.<string>

getPathname

Return full pathname

Returns: string

getViewType

Get a corresponding view type

Returns: constructor
Constructor

Tag

(extends Element)

Tag

Properties

Properties

checked

Type: boolean

kind

Type: TagKind

number

Type: number

reference

Type: Model

value

Type: *
Constructor

ExtensibleModel

(extends Model)

ExtensibleModel

Properties
Methods

Properties

documentation

Type: string

tags

Type: Array.<Tag>

Methods

getTag

Return a specific tag by name

tagName string
Returns: Tag,undefined

getTagValue

Return value of a specific tag

tagName string
Returns: Boolean,undefined

hasTag

Return whether element has a specific tag

tagName string
Returns: Boolean
Constructor

Relationship

(extends ExtensibleModel)

Relationship

Constructor

DirectedRelationship

(extends Relationship)

DirectedRelationship

Properties

Properties

source

Type: Model

target

Type: Model
Constructor

RelationshipEnd

(extends ExtensibleModel)

RelationshipEnd

Properties

Properties

reference

Type: Model
Constructor

UndirectedRelationship

(extends Relationship)

UndirectedRelationship

Properties

Properties

end1

Type: RelationshipEnd

end2

Type: RelationshipEnd

Properties

containedViews

Type: Array.<View>

containerChangeable

Type: boolean

containerExtending

Type: boolean

containerView

Type: View

enabled

Type: boolean

fillColor

Type: string

font

Type: Font

fontColor

Type: string

lineColor

Type: string

model

Type: Model

parentStyle

Type: boolean

selectable

Type: number

selected

Type: boolean

showShadow

Type: boolean

subViews

Type: Array.<View>

visible

Type: boolean

zIndex

Type: number

Methods

addContainedView

Add a contained view.

view View

addSubView

Add a sub view.

view View

arrange

Arrange this view object.

canvas Canvas

arrangeObject

Arrange this view object.

canvas Canvas

assignStyleToCanvas

Assign styles to canvas.

canvas Canvas

canContainView

canContainViewKind

containsPoint

Determines whether this view contains a point (x, y)

canvas Canvas
x number
y number
Returns: boolean

draw

Draw view object.

canvas Canvas

drawContainingBox

drawObject

Draw view object.

canvas Canvas

drawSelection

Draw selection of this view object.

canvas Canvas
abstract

drawShadow

Draw shadow.

canvas Canvas

eraseContainingBox

getBoundingBox

Return a bounding box.

canvas Canvas
Rect

getDiagram

Return a diagram containg this view object.

Returns: View

getViewAt

Return a sub view located at (x, y).

canvas Canvas
x number
y number

initialize

Initialize view object.

canvas Canvas
abstract

isOneOfTheContainerViews

move

Move view object including all sub views by (dx, dy)

canvas Canvas
dx number
dy number

moveObject

Move this view object by (dx, dy).

canvas Canvas
dx number
dy number

overlapRect

Determines whether this view overlaps a given rect

canvas Canvas
rect Rect
Returns: boolean

removeContainedView

Remove a contained view.

view View

removeSubView

Remove a sub view

view View

setup

Setup view object (styles and attributes)

canvas Canvas

size

Compute it's size

canvas Canvas

sizeObject

Compute it's size

canvas Canvas

traverse

Traverse all sub views recursively (Breadth-First Traversal)

fun function

traverseDepthFirst

Traverse all sub views recursively (Depth-First Traversal)

fun function

update

Update view object from a corresponding model object.

canvas Canvas

Properties

autoResize

Type: Boolean

height

Type: number

left

Type: number

minHeight

Type: number

minWidth

Type: number

movable

Type: number

sizable

Type: number

top

Type: number

width

Type: number

Methods

arrangeObject

drawObject

drawSelection

getBottom

getBoundingBox

getCenter

getRight

initialize

moveObject

setBottom

setRight

sizeObject

Properties

SELF_EDGE_HORIZ_INTERVAL

EdgeView Constants

head

Type: View

lineStyle

Type: number

tail

Type: View

Methods

arrangeObject

canConnectTo

Return true only if this edge can be connected the view

view View
isTail boolean
Try to connect to tail-side or not
Returns: boolean

containedIndex

containsPoint

disToOrthoLine

disToPoint

drawLineEnd

drawObject

drawSelection

getBoundingBox

initialize

moveObject

recalcOblique

recalcPoints

recalcRectilinear

reducePoints

selectedPoint

Constructor

LabelView

(extends NodeView)

LabelView

Properties
Methods

Properties

direction

Type: number

horizontalAlignment

Type: number

text

Type: string

underline

Type: string

verticalAlignment

Type: number

wordWrap

Type: boolean

Methods

arrange

Arrange LabelView

canCopy Overrides parent implementation

LabelView cannot be copied alone.

Returns: Boolean

canDelete Overrides parent implementation

LabelView cannot be deleted alone.

Returns: Boolean

draw

Draw LabelView

sizeObject

Constructor

ParasiticView

(extends NodeView)

ParasiticView

Methods

Methods

canCopy Overrides parent implementation

ParasiticView cannot be copied alone.

Returns: Boolean

canDelete Overrides parent implementation

ParasiticView cannot be deleted alone.

Returns: Boolean
Constructor

NodeParasiticView

(extends ParasiticView)

NodeParasiticView

Constructor

EdgeParasiticView

(extends ParasiticView)

EdgeParasiticView

Constructor

NodeLabelView

(extends NodeParasiticView)

NodeLabelView

Properties

Properties

underline

Type: string
Constructor

EdgeLabelView

(extends EdgeParasiticView)

EdgeLabelView

Properties

Properties

underline

Type: string
Constructor

NodeNodeView

(extends NodeParasiticView)

NodeNodeView

Constructor

EdgeNodeView

(extends EdgeParasiticView)

EdgeNodeView

Properties

defaultDiagram

Type: boolean

ownedViews

Type: Array.<View>

selectedViews

Type: Array.<View>

visible

Type: boolean

Methods

canAcceptModel

Determine whether to accept to create a view of a given model drag-and-dropped from Explorer.

model Model
Returns: Boolean

canCopyViews

Return true only if all selected views could be copied.

Returns: Boolean

canDeleteViews

Return true only if all selected views could be deleted.

Returns: Boolean

canPasteViews

Determine whether views in clipboard can be pasted in this diagram.

views Array.<View>
Returns: Boolean

drawDiagram

Draw Diagram

  1. setup all views (breadth-first)
  2. update all views (breadth-first)
  3. compute size of views (depth-first)
  4. arrange views (breadth-first)
  5. draw views (breadth-first)
canvas Canvas
drawSelection nullable boolean

getBottomViewAt

Find View at specific position (x, y) in depth-first manner

canvas Canvas
x number
y number
Returns: View

getViewAt

Find a view at specific position (x, y)

canvas Canvas
x number
y number
shallow boolean
Find only in first level
Returns: View

getViewOf

Get a view of a specific model

model Model
viewType nullable constructor
Returns: View

layout

Layout diagram automatically

direction string
Rank Direction ( "TB" | "BT" | "LR" | "RL" )
separations {node:number,edge:number,rank:number}
Constructor

Project

(extends ExtensibleModel)

Project

Constructor

Writer

Writer Class for storing Elements into JSON data.

Properties
Methods

Properties

current

Type: Object<string, ?> - 현재 저장중인 데이터

Methods

write

Write primitive value

name string
value string,number,boolean,null

writeCustom

Write a Custom Object (Custom Object have it's own method to store itself)

name string
value {__write: function()}

writeObj

Write an Object

name string
value Element

writeObjArray

Write an Array of Objects

name string
value Array.<Element>

writeRef

Write a Reference

name string
value Element

writeRefArray

Write an Array of Reference

name string
value Array.<Element>

writeVariant

Write a Variant (Primitive or Reference)

name string
value number,string,boolean,Element
Constructor

Reader

Reader Class

data Object
ctors Object.<string,constructor>
Methods

Methods

read

Read primitive type

name string
Returns: number,string,boolean,null

readCustom

Read a custom object

typeName string
name string
Returns: {__read: function(Object)}

readObj

Read an Object

name string
Returns: Element

readObjArray

Read an Array of Object

name string
Returns: Array.<Element>

readRef

Read a reference to an Object. The returned {$ref} object should be resolved later.

name string
Returns: {$ref:string}

readRefArray

Read an array of reference.

name string
Returns: Array.<{$ref:string}>

readVariant

Read Variant

name string
Returns: {$ref:string},null,number,boolean,string