C

FoldingEdgeDefaults

A helper class that provides configuration options and helper methods that can be used in the context of initializing and updating folding edges.
Inheritance Hierarchy

Remarks

This class can be used to manage and synchronize the state of folding edges in implementations of the IFoldingEdgeConverter interfaces. Start by configuring the initializeOptions, updateFoldingOptions, and updateMasterOptions, as well as the copyLabels, to match your synchronization requirements and use the style and other properties to set a default value for the initialization. The labels, sourcePort, and targetPort properties can be configured to recursively define the behavior for labels and the edges' sourcePort and targetPorts. For custom requirements, this class may be sub-classed and implement a more customized synchronization behavior.

Examples

const defaultFoldingEdgeConverter = new FoldingEdgeConverter()
// initialize the new edges with a gray style
defaultFoldingEdgeConverter.foldingEdgeDefaults.style =
  new PolylineEdgeStyle({ stroke: 'gray' })
defaultFoldingEdgeConverter.foldingEdgeDefaults.copyLabels = true

// initialize the labels with a new style
defaultFoldingEdgeConverter.foldingEdgeDefaults.labels.style =
  new LabelStyle()
defaultFoldingEdgeConverter.foldingEdgeDefaults.labels.shareStyleInstance = true

// initialize all label properties (the default)
// but synchronize only the text after initialization
defaultFoldingEdgeConverter.foldingEdgeDefaults.labels.updateFoldingOptions =
  FoldingSynchronizationOptions.LABEL_TEXT
defaultFoldingEdgeConverter.foldingEdgeDefaults.labels.updateMasterOptions =
  FoldingSynchronizationOptions.LABEL_TEXT
defaultFoldingEdgeConverter.foldingEdgeDefaults.labels.autoAdjustPreferredSize = true
manager.foldingEdgeConverter = defaultFoldingEdgeConverter

See Also

Developer's Guide

API

FoldingManager

Members

Show:

Constructors

Creates a new instance of this type, optionally configuring the values from the given IEdgeDefaults object.

Parameters

defaults?: IEdgeDefaults
The optional IEdgeDefaults to initialize the properties of this new instance from.

Properties

Gets or sets a value indicating whether the labels of the master item should be recreated for the folding item.
This setting can be used to initially create a copy of the labels of the master (if any) and subsequently synchronize the label's property with the master's label's text, according to the settings in labels.
final

Property Value

true if the labels should be copied; false otherwise.
Gets or sets what properties to initialize the FoldingEdgeState with when an edge is initialized from its master edges.
The default value is ALL, causing the items to be exact copies of their master items.
conversionfinal
Gets or sets the FoldingLabelDefaults to which updating the edges' labels will be delegated.
Depending on the setting of copyLabels, the default implementation will delegate the work of initializing and updating the state of the labels, accordingly.
final

See Also

API
copyLabels
Gets or sets a value indicating whether the edge style instance should be shared referentially or cloned.
This applies to both the default style as well as the style of the master edge or state from which the state or master edge should be initialized or updated. If the default style should show a different behavior, developers may set this property to be applied in initialize / update, and modify getDefaultStyleInstance to implement the behavior for defaults.
final

Property Value

true (the default) if the reference should be shared; false otherwise.

See Also

API
getDefaultStyleInstance, style
Gets or sets the FoldingPortDefaults to which updating the edges' sourcePort will be delegated to.
The default implementation will delegate the work of initializing and updating the state of the port, accordingly. Updating the labels of the ports is the responsibility of the FoldingPortDefaults implementation.
final

Examples

const mergingFoldingEdgeConverter = new MergingFoldingEdgeConverter()

// synchronize the labels
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.copyLabels = true
// initialize: copy all label properties (the default)
// but update only the text after initialization
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.labels.updateFoldingOptions =
  FoldingSynchronizationOptions.LABEL_TEXT
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.labels.updateMasterOptions =
  FoldingSynchronizationOptions.LABEL_TEXT

// copy all port properties upon initialization (the default)
// but update only the layout afterward
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.updateFoldingOptions =
  FoldingSynchronizationOptions.LAYOUT
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.updateMasterOptions =
  FoldingSynchronizationOptions.LAYOUT
manager.foldingEdgeConverter = mergingFoldingEdgeConverter

See Also

Developer's Guide
API
copyLabels
Gets or sets the IEdgeStyle to use for the folding edge.

Depending on the shareStyleInstance property, initializeState will either assign a clone to the property or this instance.

A value of null (the default) will leave the style property unmodified.

final

See Also

API
getDefaultStyleInstance
Gets or sets the FoldingPortDefaults to which updating the edges' targetPort will be delegated to.
The default implementation will delegate the work of initializing and updating the state of the port, accordingly. Updating the labels of the ports is the responsibility of the FoldingPortDefaults implementation.
final

Examples

const mergingFoldingEdgeConverter = new MergingFoldingEdgeConverter()

// synchronize the labels
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.copyLabels = true
// initialize: copy all label properties (the default)
// but update only the text after initialization
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.labels.updateFoldingOptions =
  FoldingSynchronizationOptions.LABEL_TEXT
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.labels.updateMasterOptions =
  FoldingSynchronizationOptions.LABEL_TEXT

// copy all port properties upon initialization (the default)
// but update only the layout afterward
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.updateFoldingOptions =
  FoldingSynchronizationOptions.LAYOUT
mergingFoldingEdgeConverter.foldingEdgeDefaults.sourcePort.updateMasterOptions =
  FoldingSynchronizationOptions.LAYOUT
manager.foldingEdgeConverter = mergingFoldingEdgeConverter

See Also

Developer's Guide
API
copyLabels
Gets or sets what properties to update the FoldingEdgeState with when a folding edge is updated to reflect changes made to its master items.
The default value is TAG, allowing items to keep a separate state after initialization, except for the tag which is synchronized by default.
conversionfinal

See Also

API
initializeOptions, updateMasterOptions
Gets or sets what properties to backpropagate from the FoldingEdgeState when master edges are updated to reflect changes made to its folding variant.
The default value is TAG, allowing folding items to keep a separate state after initialization, except for the tag which is synchronized by default.
conversionfinal

See Also

API
updateFoldingOptions

Methods

Creates the default IEdgeStyle to use in initializeState.
Initializes the initial labels of the folding edge.
This implementation initializes and creates the labels according to copyLabels, only.
protected

Parameters

state: FoldingEdgeState
The view state whose labels should be synchronized.
masterEdges: IListEnumerable<IEdge>
The master edges that the folding edge represents.

See Also

API
labels, initializeState, getFoldingEdgeState
Initializes the sourcePort and targetPort of the folding edge.
If the source port of the folding edge represented by the given state is in folding state, this implementation delegates to sourcePort's initializeState to initialize the folding port's state. The same holds true for the target port and targetPort.
protected

Parameters

state: FoldingEdgeState
The view state to change.
masterEdges: IListEnumerable<IEdge>
The master edges that the folding edge represents.
Called by implementations of the IFoldingEdgeConverter to initialize the state of a folding edge in the folding view.
Typically the initializeState method will be called once for each folding edge, before updateState will be called upon further updates. This implementation calls the various initialize methods, only.

Parameters

state: FoldingEdgeState
The state object to use for modifying the properties.
masterEdges: IListEnumerable<IEdge>
The collection of edges this folding edge represents.

See Also

API
updateState
Called by updateState to synchronize the labels if copyLabels is enabled.
This implementation will update the labels if there is exactly one master edge, using the master as reference.
protected

Parameters

state: FoldingEdgeState
The view state of the edge to change.
masterEdges: IListEnumerable<IEdge>
The master edges.
Called in response to updateMasterEdges to optionally update the various properties of the master edges according to the state of the folding edge.
final

Parameters

masterGraph: IGraph
The master graph to use for modifying the masterEdges.
state: FoldingEdgeState
The state of the folding edge.
masterEdges: IListEnumerable<IEdge>
The master edges to potentially synchronize the state.

See Also

API
updateMasterOptions
Updates the labels of the master edges to match the state of the folding edge.
Depending on the copyLabels this will use the labels property to update the masters.
protected

Parameters

masterGraph: IGraph
The graph to use for modifying the master labels.
state: FoldingEdgeState
The state of the folder node and its labels to synchronize with.
masterEdges: IListEnumerable<IEdge>
The master edges to synchronize.

See Also

API
copyLabels
Called by updateMasterEdges to synchronize the ports via updateMasterPort.
This implementation will delegate to sourcePort's and targetPort's updateMasterPort methods if the type of these ports is not MASTER_PORT. Master ports will be updated with their owning master node in updateMasterPorts instead.
protected

Parameters

masterGraph: IGraph
The master graph to use for updating the ports.
state: FoldingEdgeState
The view state of the edge.
masterEdges: IListEnumerable<IEdge>
The master edges to synchronize.
Called by updateState to synchronize the ports.
This implementation will delegate to sourcePort's and targetPort's updateState implementation to update the source and target port if the type of these ports is not MASTER_PORT. Master ports will be updated with their owning master node in updatePorts instead.
protected

Parameters

state: FoldingEdgeState
The view state of the edge to change.
foldingView: IFoldingView
The folding view.
foldingEdge: IEdge
The folding edge.
masterEdges: IListEnumerable<IEdge>
The master edges.
Called by implementations of the IFoldingEdgeConverter interfaces to update the state of a folding edge in the folding view, once it has changed.
Typically the initializeState method will have been called at least once for each folding edge, before this method is called to further update the state. This implementation updates the properties of the edge according to the updateFoldingOptions, and calls the updateLabels, and updatePorts methods.

Parameters

state: FoldingEdgeState
The state object to use for modifying the properties.
foldingView: IFoldingView
The view in which the edge will be used.
foldingEdge: IEdge
The edge instance.
masterEdges: IListEnumerable<IEdge>
The collection of edges this folding edge represents.

See Also

API
initializeState