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. |
Members
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. |
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. |
# draw()
Draws all data in the html element defined by the id.
# exportSvg(id) → {string}
Export viewport as svg.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
Viewport id. |
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. |
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. |
List of folder and file paths that represent a model.
Array.<string>
# init()
Init method, to call once before all plugin usages.
# 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. |
# initResources(resourcesopt)
Set resources in plugin.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
resources |
object
|
<optional> |
Object that contains resources. |
# isParsable(fileInformation) → {boolean}
Indicate if this parser can parse this file.
Parameters:
Name | Type | Description |
---|---|---|
fileInformation |
FileInformation
|
File information. |
- 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. |
# 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. |
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. |