tracking-code-which-will-go-to-the-HEAD DefaultPlugin

Class

DefaultPlugin

DefaultPlugin(propsopt)

Default plugin structure.
Constructor

# new DefaultPlugin(propsopt)

Default constructor.
Parameters:
Name Type Attributes Description
props object <optional>
Object that contains all properties to set.
event object <optional>
Event manager.
event.next function <optional>
Function to emit event.
configuration DefaultConfiguration <optional>
Plugin configuration.
pluginData DefaultData <optional>
Plugin data storage.
pluginDrawer DefaultDrawer <optional>
Plugin drawer.
pluginMetadata DefaultMetadata <optional>
Plugin metadata.
pluginParser DefaultParser <optional>
Plugin parser.
pluginRenderer DefaultRender <optional>
Plugin renderer.

View Source models/DefaultPlugin.js, line 11

Members

DefaultConfiguration

# configuration

Plugin configuration.

View Source models/DefaultPlugin.js, line 37

DefaultData

# data

Plugin data storage.

View Source models/DefaultPlugin.js, line 42

Methods

# addComponent(parentId, definition, path, event) → {string}

Create new component with draw option if passed as param.
Parameters:
Name Type Description
parentId string Id of parent container, null for root.
definition ComponentDefinition Component definition.
path string Component path.
event object Event that contain mouse position.

View Source models/DefaultPlugin.js, line 245

Component id.
string

# arrangeComponentsPosition(id, keepPosition)

Reorganize nodes layout algorithmically. This method does not refresh the view. You have to await it and trigger a redraw.
Parameters:
Name Type Description
id string The container within which we need to organize the children, and if null specified, all components will be reorganized.
keepPosition boolean If true, rearrange only components without a specified position; otherwise, rearrange all components.

View Source models/DefaultPlugin.js, line 190

# draw()

Draws all data in the html element defined by the id.

View Source models/DefaultPlugin.js, line 105

# exportSvg(id) → {string}

Export viewport as svg.
Parameters:
Name Type Description
id string Viewport id.

View Source models/DefaultPlugin.js, line 207

Svg content.
string

# getComponentPosition(rootId, drawOption) → {object}

Get the coordinates to use for component draw options.
Parameters:
Name Type Description
rootId string Html id, without '#'.
drawOption ComponentDrawOption The options used to draw this Component.
x number Position X.
y number Position Y.

View Source models/DefaultPlugin.js, line 227

The coordinates for new component.
object

# getModels(filesopt) → {Array.<string>}

Get models from all project files.
Parameters:
Name Type Attributes Description
files Array.<FileInformation> <optional>
Projects files.

View Source models/DefaultPlugin.js, line 147

List of folder and file paths that represent a model.
Array.<string>

# init()

Init method, to call once before all plugin usages.

View Source models/DefaultPlugin.js, line 72

# initDrawer(id, readOnly)

Init drawing context of plugin.
Parameters:
Name Type Description
id string Html id of div that will be the drawing container.
readOnly boolean If false, indicate if user can make action or modify the scene.

View Source models/DefaultPlugin.js, line 98

# initResources(resourcesopt)

Set resources in plugin.
Parameters:
Name Type Attributes Description
resources object <optional>
Object that contains resources.

View Source models/DefaultPlugin.js, line 89

# isParsable(fileInformation) → {boolean}

Indicate if this parser can parse this file.
Parameters:
Name Type Description
fileInformation FileInformation File information.

View Source models/DefaultPlugin.js, line 138

- Boolean that indicates if this file can be parsed or not.
boolean

# parse(diagram, file, inputsopt)

Convert the content of files into plugin data. Configuration file is used for setting up the components' configuration.
Parameters:
Name Type Attributes Description
diagram FileInformation Diagram file information.
file FileInput Configuration file of components.
inputs Array.<FileInput> <optional>
File inputs you want to parse.

View Source models/DefaultPlugin.js, line 116

# render(diagram, configurationFile, files) → {Array.<FileInput>}

Return all generated files from plugin data. Configuration file is used for saving the components' configuration.
Parameters:
Name Type Description
diagram FileInformation Diagram file information.
configurationFile FileInput Configuration file of components.
files Array.<FileInput> File inputs you want to render.

View Source models/DefaultPlugin.js, line 161

All generated files including the configuration file.
Array.<FileInput>

# resize(id)

Resize the container to its minimum size.
Parameters:
Name Type Description
id string Container id.

View Source models/DefaultPlugin.js, line 198