API / geotoolkit / flowcharts / shapes / DiagramWidget / DiagramWidget
shapes.DiagramWidget.DiagramWidget
A basic widget that displays visuals, provides tools for manipulation, and API for persistence, copy/paste, delete, selection and other functions.
↳
DiagramWidget
Constructors
Methods
Constructors
• new DiagramWidget(options?)
| Name | Type | Description |
|---|---|---|
Optional options | Options | settings for the widget |
BaseWidget.constructor
Methods
▸ addBaseLayer(baseLayer): DiagramWidget
Add baseLayer to container
this
▸ addChild(node): DiagramWidget
Add a child node
this
▸ addCssClass(cssclass): DiagramWidget
Adds new css class to node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ addInvalidateHandler(handler): DiagramWidget
Add invalidate handler
Deprecated
since 4.0, use Node.on instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
BaseWidget.addInvalidateHandler
▸ addOverlay(overlay): DiagramWidget
Add overlay to container
this
▸ addVisual(visual, modelLocation?, center?, startPolylineCreation?): Component
Adds the specified visual to the model
| Name | Type | Description |
|---|---|---|
visual | Component | a shape to add |
Optional modelLocation | Point | a point where the visual will be added. Default value is (0,0) |
Optional center | boolean | flag indicating if the visual should have center point at the given location |
Optional startPolylineCreation | boolean | starts manipulator for polygon/polyline creation |
the newly added visual
▸ adjustPosition(area?, vAlign?, hAlign?): DiagramWidget
Adjust position of node to specified area
| Name | Type | Description |
|---|---|---|
Optional area | Rect | specified area. Default to Parent Model Limits |
Optional vAlign | string | vertical alignment. It can be "top", "bottom", "center". Defaults to "top". |
Optional hAlign | string | horizontal alignment It can be "left", "right", "center". Defaults to "left". |
this
▸ Protected applyOpacity(context): DiagramWidget
This method is called to apply opacity if it is specified on the rendering context. The default implementation sets global alpha on the rendering context
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
this
▸ Protected applyResponsiveStyle(): void
Apply a responsive style rules it is exists
void
BaseWidget.applyResponsiveStyle
▸ bringToFront(node): DiagramWidget
Changes z-order for the specified array of visuals, placing them "closer" to an observer. If array consists of more than 1 visual, then visual with 0 index will be placed "under" visual with Nth index.
this
▸ changeBaseLayerOrder(overlay, order, anchor?): DiagramWidget
Changes the z-order of the baseLayer.
| Name | Type | Description |
|---|---|---|
overlay | Node | |
order | NodeOrder | position to be added |
Optional anchor | Node | anchor node to specify changeOrder with respect to this node |
this
BaseWidget.changeBaseLayerOrder
▸ changeChildOrder(node, order, anchor?): DiagramWidget
changes the z-order of the nodes being rendered.
| Name | Type | Description |
|---|---|---|
node | Node | any child added in the Composite node |
order | NodeOrder | position to be added |
Optional anchor | Node | anchor node to specify changeOrder with respect to this node |
this
▸ changeOverlayOrder(overlay, order, anchor?): DiagramWidget
Changes the z-order of the overlay.
| Name | Type | Description |
|---|---|---|
overlay | Node | child overlay |
order | NodeOrder | position to be added |
Optional anchor | Node | anchor node to specify changeOrder with respect to this node |
this
▸ checkCollision(context): boolean
Check culling Returns true if object is inside of renderable area
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
boolean
true if node is collided
▸ clearBaseLayers(disposeBaseLayers?): DiagramWidget
Remove all child baseLayers from group
| Name | Type | Description |
|---|---|---|
Optional disposeBaseLayers | boolean | automatically dispose baseLayers. If it is true then method dispose is called for each baseLayer, false by default |
this
▸ clearCache(): DiagramWidget
Clear cache
this
▸ clearChildren(disposeChildren?): DiagramWidget
Remove all child nodes from this composite group
| Name | Type | Description |
|---|---|---|
Optional disposeChildren | boolean | automatically dispose children. If it is true then method dispose is called for each child. |
this
▸ clearOverlays(disposeOverlays?): DiagramWidget
Remove all child overlays from group
| Name | Type | Description |
|---|---|---|
Optional disposeOverlays | boolean | automatically dispose overlays. If it is true then method dispose is called for each overlay, false by default |
this
▸ clearSelection(): DiagramWidget
De-selects currently selected shapes
this
All subclasses should override copyConstructor or provide custom implementation for this method
clone
▸ connectStyle(style, type, callback): DiagramWidget
Connects style.
This convenience method subscribes a listener to given style for the specified type.
And automatically un-subscribes listener if node is disposed to prevent memory leaks
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ connectTool(tool): DiagramWidget
Connect a new tool with a toolname to the widget
| Name | Type | Description |
|---|---|---|
tool | AbstractTool | AbstractTool[] | tool associated with the widget |
this
▸ Protected copyConstructor(src, deepCopy?): DiagramWidget
Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.
this
▸ copySelection(): string
Copies Selection into object
string
well-formed JSON string
▸ copyVisuals(visuals): string
Serializes the given visuals into a well-formed object
| Name | Type | Description |
|---|---|---|
visuals | Node[] | array of visuals to copy |
string
well-formed JSON string
▸ cutSelection(): string
Cuts selection out of scene and returns a copy of it as JSON string
string
well-formed JSON string
▸ cutVisuals(visuals): string
Serialized the given visuals into a well-formed objects and cuts the visuals out of scene.
| Name | Type | Description |
|---|---|---|
visuals | Node[] | Array of visuals to delete |
string
well-formed JSON string
▸ deleteSelection(): DiagramWidget
Deletes all selected visuals from the scene
this
▸ deleteVisual(shapeToRemove): DiagramWidget
Deletes the specified visual from model, if this shape exists on top
| Name | Type | Description |
|---|---|---|
shapeToRemove | Node | a shape to remove |
this
▸ deleteVisuals(visuals): DiagramWidget
Deletes visuals from the scene
| Name | Type | Description |
|---|---|---|
visuals | Node[] | visuals to delete |
this
▸ disconnectStyle(style, type, callback): DiagramWidget
Disconnect style
This convenience method un-subscribes a listener to given style for the specified type.
| Name | Type | Description |
|---|---|---|
style | EventDispatcher | connect style |
type | string | type of event or property |
callback | AttributeCallback<EventDispatcher> | function to be called |
this
▸ disconnectTool(tool): DiagramWidget
Disconnect the tool from the widget
| Name | Type | Description |
|---|---|---|
tool | AbstractTool | AbstractTool[] | tool to disconnect |
this
▸ dispose(): void
Dispose node. Clear all listeners and disconnect style to avoid memory leaks
void
▸ Protected drawBorder(localContext, bounds?): DiagramWidget
Draws a rectangle at the bounding box (in parent coordinates)
| Name | Type | Description |
|---|---|---|
localContext | RenderingContext | The local rendering context |
Optional bounds | Rect | group bounds |
this
▸ enableClipping(doClip): DiagramWidget
Enables or disables clipping of this node. If enabled, shapes will not be rendered outside of its bounds.
| Name | Type | Description |
|---|---|---|
doClip | boolean | enable clipping on this node |
this
▸ enableEventPropagation(enable): DiagramWidget
Enable event propagation from the node hierarchy from bottom to top
This option is similar to DOM Event bubbling, which allows to get any event from child node. By default it is disabled for better performance.
Example
import {Group} from '@int/geotoolkit/scene/Group';
import {Events as SceneEvents} from '@int/geotoolkit/scene/Node';
const parentGroup = new Group()
.setName('ParentGroup')
.enableEventPropagation(true);
const childGroup = new Group()
.setName('ChildGroup');
parentGroup.addChild(childGroup);
parentGroup.on(SceneEvents.Invalidate, (eventName, sender, args) => {
// Got notifications from all children of parent group
});
childGroup.invalidate();| Name | Type | Description |
|---|---|---|
enable | boolean | enable |
this
BaseWidget.enableEventPropagation
▸ enablePickingChildren(enable): DiagramWidget
Enables or disables picking children
| Name | Type | Description |
|---|---|---|
enable | boolean | enable picking children |
this
BaseWidget.enablePickingChildren
▸ enumerateNodes(callback, target?): void
Executes a provided function once for each child node
| Name | Type | Description |
|---|---|---|
callback | Callback<Node> | provided function |
Optional target | QueryBuilder<any> | target to pass to callback as a second parameter |
void
▸ execute(delegate): DiagramWidget
Executes delegate and return the result. It allows us to keep all initialization calls in one place,
and we do not need to scroll up or down in IDE to find how and where it was initialized.
Example
// All setters (.setName() for example) returns reference to the this.
// In order to modify inner object like LineStyle or Pattern, to get this object (property) we should call getter to get object reference.
// Then modify it as shown below in Option 1 or you can use execute methods shown in Option 2.
import {Group} from '@int/geotoolkit/scene/Group';
import {Rect} from '@int/geotoolkit/util/Rect';
// Option 1
const group = new Group()
.setName('MyGroup')
.setBounds(new Rect(0, 0, 42, 16))
.enableClipping(true)
.setTag({'type': 'sometype'});
group.getLineStyle().setPattern('pattern');
return group;
// Options 2 ( using execute method )
return group
.execute(function () {
this.getLineStyle()
.setPattern("pattern");
});| Name | Type | Description |
|---|---|---|
delegate | (this: DiagramWidget) => void | Function to execute |
The result if any or this
▸ execute<T>(delegate): T
| Name |
|---|
T |
| Name | Type |
|---|---|
delegate | (this: DiagramWidget) => T |
T
▸ Protected filter(context): boolean
Filter node
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
boolean
flag filter flag ("true" to render node; "false" otherwise)
▸ flattenVisuals<T>(restoredItems): T[]
Unfolds an array of visuals and their children into a flat (single-dimension) array of nodes. geotoolkit.scene.Group instances are also added to the collection
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
restoredItems | T[] | all restored nodes as flat array |
T[]
an array of restored nodes
▸ getActiveTool(): string
Gets a currently active tool
string
the name of currently active tool
▸ getAnimationStyle(): AnimationStyle
Return animation style
animationStyle current animation style
▸ getAnnotation(location): Group<Node>
Gets annotation at specified location
| Name | Type | Description |
|---|---|---|
location | AnnotationLocation | Enum of annotation locations used to specify direction to insert |
▸ getAutoModelLimitsMode(): boolean
Get Model Limits Logics to use when no Model Limits have been set set to true: will use parents width and height, starting at 0 set to false: will use parents bounds
boolean
mode
BaseWidget.getAutoModelLimitsMode
▸ getAutoModelLimitsStrategy(): ModelLimitsStrategy
Get Model Limits Logics Strategy
strategy
BaseWidget.getAutoModelLimitsStrategy
▸ getBaseLayer(index): Node
Return baseLayer at specified index
| Name | Type | Description |
|---|---|---|
index | number | index at which to get the baseLayer for |
track
▸ getBaseLayers<S>(predicate, modify?): Iterator<Node>
Return iterator by baseLayers nodes
| Name | Type |
|---|---|
S | extends Node<S> |
| Name | Type | Description |
|---|---|---|
predicate | (value: Node) => value is S | a filter function |
Optional modify | boolean | An option to specify if the iterator supports adding/removing items from the collection. false by default. |
▸ getBaseLayers(filter?, modify?): Iterator<Node>
Returns an iterator for child baseLayers. The iterator does not support adding or deleting items from overlays by default. If it is necessary to modify a collection of overlays, pass true as the last parameter.
Example
// Gets a writable iterator
const it = node.getOverlays(null, true);| Name | Type | Description |
|---|---|---|
Optional filter | (node: Node) => boolean | A filter function. Returns all overlays if null. |
Optional modify | boolean | An option to specify if the iterator supports adding/removing items from the collection. false by default. |
An iterator for child overlays.
▸ getBaseLayersCount(): number
Returns amount of baseLayers
number
▸ getBounds(): Rect
Get the bounds in the parents model space. If bounds are not set, then parent model limits are used.
current bounds
▸ getCache(): Cache
Return cache strategy to be used to cache children nodes
cache
▸ getChild(i): Node
Return node by index
| Name | Type | Description |
|---|---|---|
i | number | index of the node |
▸ getChildren<S>(predicate, modify?): Iterator<S>
Return iterator by child nodes
| Name | Type |
|---|---|
S | extends Node<S> |
| Name | Type | Description |
|---|---|---|
predicate | (value: Node) => value is S | a filter function |
Optional modify | boolean | An option to specify if the iterator supports adding/removing items from the collection. false by default. |
Iterator<S>
▸ getChildren(filter?, modify?): Iterator<Node>
Returns an iterator for child nodes. The iterator does not support adding or deleting items from children by default. If it is necessary to modify a collection of children, pass true as the last parameter.
Example
// Gets a writable iterator
const it = node.getChildren(null, true);| Name | Type | Description |
|---|---|---|
Optional filter | (node: Node) => boolean | A filter function. Returns all nodes if null. |
Optional modify | boolean | An option to specify if the iterator supports adding/removing items from the collection. false by default. |
An iterator for child nodes.
▸ getChildrenCount(): number
Return number of child nodes
number
▸ getClassName(): string
string
▸ getClipStyle(): ClipStyle
Gets the current clipping style
clipping style
▸ getContentOrientation(): Orientation
Return content orientation
content orientation
BaseWidget.getContentOrientation
▸ getContentsArea(transformation?): Rect
Return area without paddings. Model limits are mapped to content area, where children are layout.
| Name | Type | Description |
|---|---|---|
Optional transformation | Transformation | scene transformation |
▸ getContentsTransform(): Transformation
getContentsTransform() retrieves the world transformation of the node.
transformation from model coordinates to bounds of the group
BaseWidget.getContentsTransform
▸ getCss(): CssStyle
Return CSS style
▸ getCssClass(): string
Returns css class name to be used to apply CSS style
string
the css class name
▸ getCssClasses(): string[]
Gets list of css class names which applied to this node
string[]
▸ getCssTransform(): string
Returns CSS transformation
string
▸ getData(data?): object
get options
| Name | Type | Description |
|---|---|---|
Optional data | unknown | how to extract data, null by default |
object
▸ getDesiredHeight(): string | number
Returns desired height of the group as a layoutable object This method is a helper method to get access to getLayoutStyle()
string | number
desired height ("undefined" by default)
▸ getDesiredWidth(): string | number
Returns desired width of the group as a layoutable object. This method is a helper method to get access to getLayoutStyle()
string | number
desired width ("undefined" by default)
▸ getDeviceLimits(): Rect
Return device limits
▸ getDiagramLimits(): Rect
Gets primary model limits
▸ getFillStyle(): FillStyle
Return fill style
fillStyle current fill style
▸ getId(): string | number
Returns the associated identifier of the node
string | number
The node's id
▸ getInfiniteMode(): boolean
Return infinity mode flag
boolean
flag
▸ Protected getInvalidateMethod(): AttributeCallback<EventDispatcher>
Gets invalidate method
AttributeCallback<EventDispatcher>
method to invalidate this object
BaseWidget.getInvalidateMethod
▸ getLayout(): Layout
Returns layout associated with the group
layout
▸ getLayoutStyle(): LayoutStyle<string | number>
return desired layout style
LayoutStyle<string | number>
▸ getLineStyle(): LineStyle
Return border style
▸ getLocalTransform(): Transformation
Retrieves the transformation of bounds to parent
transform the local transform.
▸ getMarginsStyle(): SpaceStyle<string | number>
Return margins style
SpaceStyle<string | number>
Returns the Model that is being used for shapes storage, diagram saving and loading
a primary model
▸ getModelLimits(): Rect
Gets model limits, the limits of this groups inside space
the current model limits
▸ getName(): string
Returns the node name
string
The node name
▸ getOnSelectionChangeEvent(): LiteEvent
Event that raises on selection change
▸ getOpacity(): number
Returns current node opacity
number
opacity
▸ getOpacityBlendMode(): BlendMode
Returns current node opacity
opacity blend mode
BaseWidget.getOpacityBlendMode
▸ getOverlay(index): Node
Return overlay at specified index
| Name | Type | Description |
|---|---|---|
index | number | index at which to get the overlay for |
track
▸ getOverlayAt(index): Node
Return overlay at specified index
Deprecated
since 4.2 use getOverlay instead
| Name | Type | Description |
|---|---|---|
index | number | index at which to get the overlay for |
track
▸ getOverlayLayer(): Layer<Node>
Returns manipulator overlay to draw shapes that should move with the model
▸ getOverlays<S>(predicate, modify?): Iterator<Node>
Return iterator by overlays nodes
| Name | Type |
|---|---|
S | extends Node<S> |
| Name | Type | Description |
|---|---|---|
predicate | (value: Node) => value is S | a filter function |
Optional modify | boolean | An option to specify if the iterator supports adding/removing items from the collection. false by default. |
▸ getOverlays(filter?, modify?): Iterator<Node>
Returns an iterator for child overlays. The iterator does not support adding or deleting items from overlays by default. If it is necessary to modify a collection of overlays, pass true as the last parameter.
Example
// Gets a writable iterator
const it = node.getOverlays(null, true);| Name | Type | Description |
|---|---|---|
Optional filter | (node: Node) => boolean | A filter function. Returns all overlays if null. |
Optional modify | boolean | An option to specify if the iterator supports adding/removing items from the collection. false by default. |
An iterator for child overlays.
▸ getOverlaysCount(): number
Returns amount of overlays
number
▸ getPaddingStyle(): SpaceStyle<string | number>
Return padding style
SpaceStyle<string | number>
padding
▸ getParent(): Node
Return parent node
parent node
▸ getPreferredSize(): Rect
Return preferred size to layout children
▸ getProperties(context?): OptionsOut
Gets all the properties pertaining to this object See Group.getProperties for details Keep in mind that widgets does not return scene-graph information
| Name | Type | Description |
|---|---|---|
Optional context | ISerializationContext | serialization context |
properties
▸ getProperty(name): any
Gets dynamic property by name. These properties can be used as a property bags
| Name | Type | Description |
|---|---|---|
name | string | property name |
any
▸ getPropertyKeys(): string[]
Returns known properties keys
string[]
▸ getRenderingFilter(): IFilter
Return filter to be used for rendering and picking
current filter
▸ getResponsiveStyle(): ResponsiveStyle
Return responsive style
▸ getRoot(): Node
Returns root node.
If node doesn't have parent then it returns itself.
the root node
▸ getScale(): Object
Gets current widget scale
Object
current scale
| Name | Type |
|---|---|
x | number |
y | number |
▸ getScaleScrollStrategy(): Delegate
Gets scale scroll strategy
scale scroll strategy
BaseWidget.getScaleScrollStrategy
▸ getSceneTransform(): Transformation
Returns transformation from node to root scene
a transformation from node to root scene
▸ getSelection(): Node[]
Gets active selection
Node[]
an array of selected shapes
▸ getTag(): any
Returns the object associated with the node by user.
any
The node's user-object
▸ getTool(): CompositeTool
Returns root tool associated to this widget
▸ getToolByName<T>(toolName): Tools[T]
Returns the tool matching the given name.
This function also accepts tool 'path' instead of absolute name.
For example:
getToolByName("compositeTool.panningTools.trackPanning.TrackPanning")
Would return the same tool as
getToolByName("TrackPanning")
As long as there is only one tool named "TrackPanning" in this composite
See listToolsNames()
| Name | Type |
|---|---|
T | extends string |
| Name | Type | Description |
|---|---|---|
toolName | T | The tool name or path |
Tools[T]
▸ getToolByType(toolType): AbstractTool
Returns the tool matching the given type. or null if nothing is matching the tool type
For example:
getToolByType(geotoolkit.controls.tools.Selection)
Would return the same tool as
getToolByName("pick")
| Name | Type | Description |
|---|---|---|
toolType | ClassType<any> | toolType of the tool |
▸ getVisible(): boolean
Return visibility of the node
boolean
true if node is visible
▸ getVisibleDeviceLimits(ignoreModelLimits?): Rect
Return visible device limits
| Name | Type | Description |
|---|---|---|
Optional ignoreModelLimits | boolean | flag defines whether to ignore ModelLimits or not |
BaseWidget.getVisibleDeviceLimits
▸ getVisibleModelLimits(ignoreModelLimits?): Rect
Return visible model limits
| Name | Type | Description |
|---|---|---|
Optional ignoreModelLimits | boolean | flag defines whether to ignore ModelLimits or not |
BaseWidget.getVisibleModelLimits
▸ getWorldTransform(): Transformation
Retrieves the local transformation of the node which represents multiplication of parent to bounds and contents transformations.
▸ getZIndex(): number
Returns node z-index (null if not set)
number
▸ groupVisuals(visuals, groupName?): DiagramWidget
Groups the given visuals into a group. This method cuts off the visuals from primary model, creates a new group and places this group into the model and selects the newly created group
| Name | Type | Description |
|---|---|---|
visuals | Node[] | an array of visuals to group |
Optional groupName | string | a name for the new group |
this
▸ hasCssClass(cssClass): boolean
Check if node has specified css class
| Name | Type | Description |
|---|---|---|
cssClass | string | css class name |
boolean
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
▸ indexOfBaseLayer(baseLayer): number
Return index of overlay ( index of the specified child or -1 if baseLayer is not found)
| Name | Type | Description |
|---|---|---|
baseLayer | Node | baseLayer to check index |
number
▸ indexOfChild(node): number
Return index of child ( index of the specified child or -1 if node is not found)
| Name | Type | Description |
|---|---|---|
node | Node | node to check index |
number
▸ indexOfOverlay(overlay): number
Return index of overlay ( index of the specified child or -1 if overlay is not found)
| Name | Type | Description |
|---|---|---|
overlay | Node | overlay to check index |
number
▸ Protected initializeTools(): DiagramWidget
function call in the constructor to initialize tools in the widget
this
▸ insertBaseLayer(index, baseLayer): DiagramWidget
Insert child baseLayer at specified index
| Name | Type | Description |
|---|---|---|
index | number | specified index |
baseLayer | Node | a baseLayer to add |
this
▸ insertChild(index, node): DiagramWidget
Insert child node at specified index
| Name | Type | Description |
|---|---|---|
index | number | specified index |
node | Node | a child node to add |
this
▸ insertOverlay(index, overlay): DiagramWidget
Insert child overlay at specified index
| Name | Type | Description |
|---|---|---|
index | number | specified index |
overlay | Node | a overlay to add |
this
▸ invalidate(bounds?, force?): DiagramWidget
Invalidate node
| Name | Type | Description |
|---|---|---|
Optional bounds | Rect | optional rectangular area to be invalidated, or force flag if rectangle is empty |
Optional force | boolean | optional boolean parameter that can force invalidation |
this
▸ invalidateLayout(propagate?): DiagramWidget
Notify that layout is invalidated. Send event Events.LayoutInvalidated
| Name | Type | Description |
|---|---|---|
Optional propagate | boolean | propagate invalidate layout to parent |
this
▸ invalidateParent(bounds?, force?): DiagramWidget
Invalidate parent area
| Name | Type | Description |
|---|---|---|
Optional bounds | Rect | area to invalidate |
Optional force | boolean | force |
this
▸ isClippingEnabled(): boolean
Returns if clipping is enabled or not for this node.
boolean
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isEventPropagationEnabled(): boolean
Return true if event propagation is enabled from child to parent
boolean
BaseWidget.isEventPropagationEnabled
▸ isHorizontalFlip(): boolean
Return true if the representation is flipped horizontally
boolean
flip
▸ isLayoutInvalidated(): boolean
Return true if layout is invalid
boolean
BaseWidget.isLayoutInvalidated
▸ isNotificationEnabled(): boolean
return state of notification
boolean
current notification state
BaseWidget.isNotificationEnabled
▸ isPickingChildrenEnabled(): boolean
Returns if picking children is enabled or not for this node.
boolean
pickingChildren
BaseWidget.isPickingChildrenEnabled
▸ isSelectable(): boolean
Returns true if node can be picked/selected.
boolean
The selectable flag
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ isVerticalFlip(): boolean
Return true if the representation is flipped vertically
boolean
flip
▸ listToolsNames(): string[]
List all the tools contained in this composite. Prepend their parent tools parent using a '.'.
string[]
▸ loadDiagram(data): void
Restores a diagram from the given string, which contains object. This object normally generated by saveDiagram() method
| Name | Type | Description |
|---|---|---|
data | string | well-formed JSON-string |
void
▸ loadTemplate(template, registry?): void
Load template loads the saved visual properties of the current template. It is only a visual representation of the current widget. It does not contain any data
| Name | Type | Description |
|---|---|---|
template | string | template to be applied to current widget |
Optional registry | Registry | registry |
void
▸ moveTo(area, vAlign?, hAlign?): DiagramWidget
MoveTo position of node to specified area
| Name | Type | Description |
|---|---|---|
area | Rect | specified area |
Optional vAlign | string | vertical alignment. It can be "top", "bottom", "center". |
Optional hAlign | string | horizontal alignment It can be "left", "right", "center". |
this
▸ notify<E>(type, source, args?): DiagramWidget
Notify listeners of the Node
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event |
source | Group<Node> | source who called the event |
Optional args | EventMap<Node>[E] | event arguments |
this
▸ Protected notifyRoot(event, source, args?): Node
Notify an even to root node
| Name | Type | Description |
|---|---|---|
event | string | type of event |
source | Node | source who called the event |
Optional args | any | event arguments |
this
▸ off<E>(type?, callback?): DiagramWidget
Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: DiagramWidget, args: EventMap<Node>[E]) => void | function to be called |
this
▸ on<E>(type, callback): DiagramWidget
Attach listener on event that will be called whenever the specified event is delivered to the target
If the callback function is already in the list of event listeners for this target, the function is not added a second time.
If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: DiagramWidget, args: EventMap<Node>[E]) => void | to be called |
this
▸ Protected onBoundsChanged(bounds): DiagramWidget
Occurs when bounds has been changed
| Name | Type | Description |
|---|---|---|
bounds | Rect | bound of the node in the parent coordinates |
this
▸ Protected onChildAdded(child): void
This method is called it child or children are added
void
▸ Protected onChildRemoved(child): void
This method is called it child or children are removed
| Name | Type | Description |
|---|---|---|
child | Node | removed child |
void
▸ Protected onParentChanged(node): DiagramWidget
This method is called when parent changes. Do not call it directly.
| Name | Type | Description |
|---|---|---|
node | Node | node to change parent |
this
▸ Protected onVisibilityChanged(): void
This method is called if visibility is changed. Send event Events.VisibilityChanged
void
BaseWidget.onVisibilityChanged
▸ paste(data, modelOrigin): void
Pastes the previously copied visuals from JSON string
| Name | Type | Description |
|---|---|---|
data | string | well-formed JSON data string, previously obtained with copy/cut/save methods |
modelOrigin | Point | model origin point |
void
▸ Protected postRendering(context, callback?): void
To be called after rendering, used for PDF output
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
Optional callback | () => void | callback to be called after rendering |
void
▸ Protected preRendering(context, callback?): void
Occurs before child rendering
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
Optional callback | () => void | callback to be called after rendering of geometry |
void
▸ rebuild(force?, changes?): DiagramWidget
Rebuild node. This method resets state, cache, and invalidate node.
| Name | Type | Description |
|---|---|---|
Optional force | boolean | optional boolean parameter that can force invalidation |
Optional changes | StateChanges | optional parameter to specify a reason of changes |
this
▸ registerAnimationStyle(root): void
Register animation style.
| Name | Type | Description |
|---|---|---|
root | Node | root node for node |
void
BaseWidget.registerAnimationStyle
▸ removeBaseLayer(baseLayer): DiagramWidget
Remove child baseLayer
this
▸ removeChild(node, disposeChildren?): DiagramWidget
Remove child node
| Name | Type | Description |
|---|---|---|
node | Node | Node[] | node or array of nodes to be removed |
Optional disposeChildren | boolean | automatically dispose children. If it is true then method dispose is called for each child. |
this
▸ removeCssClass(cssclass): DiagramWidget
Removes css class from node
| Name | Type | Description |
|---|---|---|
cssclass | string | string[] | css class name('s) |
this
▸ removeInvalidateHandler(handler): DiagramWidget
Remove invalidate handler
Deprecated
since 4.0, use Node.off instead
| Name | Type | Description |
|---|---|---|
handler | Function | handler to be notified about invalidation |
this
BaseWidget.removeInvalidateHandler
▸ removeOverlay(overlay): DiagramWidget
Remove child overlay
this
▸ render(context): void
Render group
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render group |
void
▸ renderAsync(context, callback): void
Render node in asynchronous mode. This implementation doesn't support cache for now.
| Name | Type | Description |
|---|---|---|
context | RenderingContext | The rendering context to be used to draw the node |
callback | () => void | callback function |
void
▸ Protected renderBackground(context, bounds): DiagramWidget
Render background
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render background |
bounds | Rect | group bounds |
this
▸ Protected renderBaseLayers(context): DiagramWidget
Render baseLayers on bottom of cache. This method does nothing, but can be implemented to render graphics on bottom of cache and between borders
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render baseLayers |
this
▸ Protected renderBaseLayersAsync(context, callback): void
Render baseLayers on bottom of cache in asynchronous mode. This method calls renderBaseLayers
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render overlays |
callback | () => void | callback function |
void
BaseWidget.renderBaseLayersAsync
▸ Protected renderChildren(context): void
Render children
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
void
▸ Protected renderChildrenAsync(context, callback): void
Render children async
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
callback | () => void | callback function to be called then all children are rendered |
void
BaseWidget.renderChildrenAsync
▸ Protected renderContent(context): void
render to specified context. This method calls preRendering, renderChildren, postRendering
| Name | Type | Description |
|---|---|---|
context | RenderingContext | Rendering Context |
void
▸ Protected renderContentAsync(context, callback): void
Render children in asynchronous mode
| Name | Type | Description |
|---|---|---|
context | RenderingContext | The rendering context to be used to draw the node |
callback | () => void | callback function to be called then all children are rendered |
void
▸ Protected renderOverlays(context): DiagramWidget
Render overlays on top of cache. This method does nothing, but can be implemented to render graphics on top of cache and between borders
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render overlays |
this
▸ Protected renderOverlaysAsync(context, callback): void
Render overlays on top of cache in asynchronous mode. This method calls renderOverlays
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render overlays |
callback | () => void | callback function |
void
BaseWidget.renderOverlaysAsync
▸ resetDiagram(): DiagramWidget
Cleans up the diagram and resets it to an original state
this
▸ resumeUpdate(rebuild?, changes?): DiagramWidget
Resume auto update
| Name | Type | Description |
|---|---|---|
Optional rebuild | boolean | force rebuild |
Optional changes | StateChanges | optional parameter to specify a reason of changes |
this
▸ rotate(theta, x, y): DiagramWidget
Rotate bounds around a given coordinate
| Name | Type | Description |
|---|---|---|
theta | number | angle to rotate node, in radians |
x | number | x coordinate to rotate around |
y | number | y coordinate to rotate around |
this
▸ saveDiagram(): string
Serializes the diagram into a JSON string
string
JSON string with serialized data
▸ saveTemplate(registry?): string
Save template saves visual properties of the current template. It is only a visual representation of the current widget. It does not contain any data
| Name | Type | Description |
|---|---|---|
Optional registry | Registry | registry |
string
▸ scale(xx, yy): DiagramWidget
Scale node
| Name | Type | Description |
|---|---|---|
xx | number | x scale factor |
yy | number | y scale factor |
this
▸ scaleModel(scale): void
Scales the model for the specified amount for X and Y axis
| Name | Type | Description |
|---|---|---|
scale | number | scale factor that will be applied to vertical and horizontal zoom |
void
▸ selectVisuals(shapes): DiagramWidget
select visuals
| Name | Type | Description |
|---|---|---|
shapes | Node[] | an array of shape to select |
this
▸ sendToBack(node): DiagramWidget
Changes z-order for the specified array of visuals, placing them "farther" from an observer. If array consists of more than 1 visual, then visual with Nth index will be placed "under" visual with 0th index.
this
▸ setAnimationStyle(animationStyle): DiagramWidget
Sets animation style
| Name | Type | Description |
|---|---|---|
animationStyle | Type | animation style |
▸ setAutoModelLimitsMode(mode): DiagramWidget
Set Model Limits Logics to use when no Model Limits have been set set to true: will use parents width and height, starting at 0 set to false: will use parents bounds. This is convenient method. It creates AutoModelLimitsStrategy
| Name | Type | Description |
|---|---|---|
mode | boolean | Model Limits Logics to be used |
this
BaseWidget.setAutoModelLimitsMode
▸ setAutoModelLimitsStrategy(strategy): DiagramWidget
Set Model Limits Logics Strategy
| Name | Type | Description |
|---|---|---|
strategy | ModelLimitsStrategy | Model Limits logic strategy to use |
this
BaseWidget.setAutoModelLimitsStrategy
▸ setBounds(bounds): DiagramWidget
Sets bounds of the node in the parent coordinates
| Name | Type | Description |
|---|---|---|
bounds | Type | bound of the node in the parent coordinates |
this
▸ setCache(cache, rebuild?): DiagramWidget
Sets cache to be used to cache
| Name | Type | Description |
|---|---|---|
cache | Cache | cache to be used |
Optional rebuild | boolean | rebuild cache |
this
▸ setChild(index, node): DiagramWidget
Replace child node by index
| Name | Type | Description |
|---|---|---|
index | number | index of the node |
node | Node | node |
this
▸ setClipStyle(style): DiagramWidget
Sets a new clipping style
| Name | Type | Description |
|---|---|---|
style | GraphicsPath | ClipStyle | Options | a new clipping style |
this
▸ setContentOrientation(orientation): DiagramWidget
Set content orientation
| Name | Type | Description |
|---|---|---|
orientation | Orientation | content orientation |
this
BaseWidget.setContentOrientation
▸ setCss(style, merge?): DiagramWidget
Sets CSS style. This style will be applied for all inserted elements
| Name | Type | Description |
|---|---|---|
style | Type | CSS style to be applied to inserted elements |
Optional merge | boolean | merge flag |
this
▸ setCssClass(name): DiagramWidget
Sets css class name of the node to be used to apply CSS style
| Name | Type | Description |
|---|---|---|
name | string | css class name of the node |
this
▸ setCssTransform(transform): DiagramWidget
Set CSS transformation
| Name | Type | Description |
|---|---|---|
transform | string | Transformation | transformation css transformation instruction or Transformation instance |
this
▸ setDesiredHeight(value, silent?): DiagramWidget
Sets desired height of the group as a layoutable object
| Name | Type | Description |
|---|---|---|
value | string | number | desired height to set, use 'auto' for automatic desired height |
Optional silent | boolean | silent setting |
this
▸ setDesiredWidth(value, silent?): DiagramWidget
Sets desired width of the group as a layoutable object
| Name | Type | Description |
|---|---|---|
value | string | number | desired width to set |
Optional silent | boolean | silent setting |
this
▸ setDiagramLimits(rect): DiagramWidget
Sets diagram size. It affects both on physical and model size
| Name | Type | Description |
|---|---|---|
rect | Rect | a new model limits |
▸ setFillStyle(fillStyle, merge?): DiagramWidget
Sets fill style
| Name | Type | Description |
|---|---|---|
fillStyle | Type | a new fill style |
Optional merge | boolean | true if you want to merge fillStyle with existing attribute, false by default |
this
▸ setHorizontalFlip(enable): DiagramWidget
Set horizontal flip of the representation
| Name | Type | Description |
|---|---|---|
enable | boolean | enable flip |
this
▸ setId(id): DiagramWidget
Allows the user to associate any identifier
| Name | Type | Description |
|---|---|---|
id | string | number | object id |
this
▸ setInfiniteMode(infinityMode): DiagramWidget
Set infinity mode flag to draw composite without collision check
| Name | Type | Description |
|---|---|---|
infinityMode | boolean | infinity mode flag |
this
▸ setLayout(layout): DiagramWidget
Associate layout with a group.
| Name | Type | Description |
|---|---|---|
layout | Record<string, any> | Layout | layout instance to be set or layout properties to apply |
this
▸ Protected setLayoutInvalidated(invalidated): void
Set invalidation status
| Name | Type | Description |
|---|---|---|
invalidated | boolean | invalidated layout |
void
BaseWidget.setLayoutInvalidated
▸ setLayoutStyle(layoutStyle, silent?, merge?): DiagramWidget
specify desired layout style
| Name | Type | Description |
|---|---|---|
layoutStyle | LayoutStyle<string | number> | Options<string | number> | desired layout style |
Optional silent | boolean | silent setting |
Optional merge | boolean | true if you want to merge layoutStyle with existing attribute, false by default |
this
▸ setLineStyle(lineStyle, merge?): DiagramWidget
Sets border color Returns this
| Name | Type | Description |
|---|---|---|
lineStyle | Type | line style or options |
Optional merge | boolean | true if you want to merge lineStyle with existing attribute, false by default |
this
▸ setLocalTransform(localTransform, force?): DiagramWidget
Sets local transformation to be used to transform from local to parent coordinate
| Name | Type | Description |
|---|---|---|
localTransform | Transformation | local transformation for this node |
Optional force | boolean | boolean flag to force update event if transformations are equal, false by default |
this
▸ setMarginsStyle(margins, merge?): DiagramWidget
Sets margins style
| Name | Type | Description |
|---|---|---|
margins | Type<string | number> | margins style |
Optional merge | boolean | true if you want to merge marginsStyle with existing attribute, false by default |
this
▸ setModelLimits(limits): DiagramWidget
Sets inner model limits
| Name | Type | Description |
|---|---|---|
limits | Type | inner limits |
this
▸ setName(name): DiagramWidget
Sets name of the node
| Name | Type | Description |
|---|---|---|
name | string | The node name |
this
▸ setNotification(notify, force?): DiagramWidget
set notification state
| Name | Type | Description |
|---|---|---|
notify | boolean | flag set to invalidate parent or not |
Optional force | boolean | true if parent should be invalidated immediately |
this
▸ setOpacity(opacity, blendMode?): DiagramWidget
Sets node opacity
| Name | Type | Description |
|---|---|---|
opacity | number | node opacity from 0 to 1 |
Optional blendMode | BlendMode | opacity blend mode. If it is normal, opacity will be replaced. |
this
▸ setPaddingStyle(paddingStyle, merge?): DiagramWidget
Sets padding style
| Name | Type | Description |
|---|---|---|
paddingStyle | Type<string | number> | padding style |
Optional merge | boolean | true if you want to merge paddingStyle with existing attribute, false by default |
this
▸ setProperties(properties?): DiagramWidget
Sets all the properties pertaining to this object Keep in mind that widgets does not accept scene-graph information NOTE properties.children property will be ignored
| Name | Type | Description |
|---|---|---|
Optional properties | Options | properties |
this
▸ setProperty(name, value): DiagramWidget
Sets dynamic property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
value | any | property value |
this
▸ setRenderingFilter(filter): DiagramWidget
Sets filter to be applied before rendering and picking
| Name | Type | Description |
|---|---|---|
filter | IFilter | filter to set |
this
▸ setResponsiveStyle(style): DiagramWidget
Sets responsive style.
| Name | Type | Description |
|---|---|---|
style | Options | ResponsiveStyle | responsive style |
this
▸ setScale(sx, sy): DiagramWidget
Sets the specified scale-x and scale-y factors on the model
| Name | Type | Description |
|---|---|---|
sx | number | horizontal scale |
sy | number | vertical scale |
this
▸ setScaleScrollStrategy(strategy?): DiagramWidget
Sets scale scroll strategy
| Name | Type | Description |
|---|---|---|
Optional strategy | Delegate | scale scroll strategy |
this
BaseWidget.setScaleScrollStrategy
▸ setSelectable(selectable): DiagramWidget
Allows to select node. If node is not selectable then child node is not selectable.
| Name | Type | Description |
|---|---|---|
selectable | boolean | flag to allow node selection |
this
▸ setSilent(bool): DiagramWidget
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setTag(tag): DiagramWidget
Allows the user to associate any arbitrary object with the node.
| Name | Type | Description |
|---|---|---|
tag | any | The object to be associated with the node. |
this
▸ Protected setTool(tool): DiagramWidget
Set root tool associated to this widget
| Name | Type | Description |
|---|---|---|
tool | CompositeTool | tool to be set |
▸ setVerticalFlip(flip): DiagramWidget
Set vertical flip of the representation
| Name | Type | Description |
|---|---|---|
flip | boolean | flag to set the vertical flip of the representation |
this
▸ setVisible(value): DiagramWidget
Sets visibility of the node. Send event Events.VisibilityChanged
| Name | Type | Description |
|---|---|---|
value | boolean | flag specifying visibility of the node |
this
▸ setVisibleModelLimits(visibleModelBounds, deviceBounds?): DiagramWidget
Set visible model limits
| Name | Type | Description |
|---|---|---|
visibleModelBounds | Rect | visible model limits or bounds |
Optional deviceBounds | Rect | device bounds |
this
BaseWidget.setVisibleModelLimits
▸ setZIndex(value): DiagramWidget
Sets z-index for node (set null for default)
| Name | Type | Description |
|---|---|---|
value | number | index determining node z-position |
this
▸ shear(shx, shy): DiagramWidget
Shear this node's bounds
| Name | Type | Description |
|---|---|---|
shx | number | x-axis shear |
shy | number | y-axis shear |
this
▸ stopPolylineEdit(): boolean
Tells the diagram widget that the polygon/polyline edit must be finished
boolean
true - on success, false - if cancelled
▸ suspendUpdate(): DiagramWidget
Suspend auto update
this
▸ toString(): string
Returns a string representation of this object (generally the classname)
string
A string representation
▸ toggleTool(toolType): DiagramWidget
Toggles the tool
| Name | Type | Description |
|---|---|---|
toolType | DiagramTools | a tool type to activate |
this
▸ translate(tx, ty): DiagramWidget
Translate bounds
| Name | Type | Description |
|---|---|---|
tx | number | x translation |
ty | number | y translation |
this
▸ ungroupVisuals(visuals): DiagramWidget
Destructs the group causing all enclosed visuals to be placed to the Model. The Local group Transformation will be multiplied with Local visuals Transformations.
| Name | Type | Description |
|---|---|---|
visuals | Node[] | An array of SvgGroup to decompose. Even though the method accepts base Node, everything but SvgGroup (and ancestors) will be ignored. |
this
▸ unregisterAnimationStyle(root): void
Unregister animation style.
| Name | Type | Description |
|---|---|---|
root | AnimatedNode | root node for node |
void
BaseWidget.unregisterAnimationStyle
▸ updateLayout(targets?): DiagramWidget
Updates layout(s)
Fires
| Name | Type | Description |
|---|---|---|
Optional targets | ILayoutable[] | optional parameter about which element to layout |
this
▸ updateSceneTransformation(): DiagramWidget
Update scene transformation
this
BaseWidget.updateSceneTransformation
▸ updateState(regions?, changes?): DiagramWidget
Update state. These methods reset node state and update state for children. this method is useful to refresh a scene graph
| Name | Type | Description |
|---|---|---|
Optional regions | Rect[] | optional array to return invalid rectangles in the parent coordinates |
Optional changes | StateChanges | optional parameter to specify a reason of changes |
this
▸ updateSuspended(): boolean
Return state of suspend state
boolean
state of update
▸ Protected updateTimeStamp(): DiagramWidget
Update time stamp to indicate that Node or Children has been changed.
this
▸ zoomIn(): void
Zoom In
void
▸ zoomOut(): void
Zoom Out
void
▸ Static enableSceneGraphNotification(enabled): void
Enable / disable all notifications
| Name | Type | Description |
|---|---|---|
enabled | boolean | sets if this object sends notifications |
void
BaseWidget.enableSceneGraphNotification
▸ Static findParent<T>(node, classType, filter?): InstanceType<T>
Find root of the node with specified type
| Name | Type |
|---|---|
T | extends Constructor<any> |
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | T | type of the class to search for |
Optional filter | (node: Node) => boolean | additional filter to apply |
InstanceType<T>
▸ Static findParent(node, classType, filter?): Node
Find root of the node with specified type
| Name | Type | Description |
|---|---|---|
node | Node | node to start search |
classType | string | interface name to search for |
Optional filter | (node: Node) => boolean | additional filter to apply |
▸ Static getClassName(): string
string
▸ Static isSceneGraphNotificationEnabled(): boolean
Return status of the global notification for all nodes.
boolean