A helper class that provides configuration options and helper methods that can be used in the context of initializing and updating folding edges.
Remarks
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
Type Details
- yFiles module
- view
See Also
Constructors
Creates a new instance of this type, optionally configuring the values from the given IEdgeDefaults object.
Parameters
A map of options to pass to the method.
- defaults - IEdgeDefaults
- The optional IEdgeDefaults to initialize the properties of this new instance from.
- initializeOptions - FoldingSynchronizationOptions
- What properties to initialize the FoldingEdgeState with when an edge is initialized from its master edges. This option sets the initializeOptions property on the created object.
- updateFoldingOptions - FoldingSynchronizationOptions
- What properties to update the FoldingEdgeState with when a folding edge is updated to reflect changes made to its master items. This option sets the updateFoldingOptions property on the created object.
- updateMasterOptions - FoldingSynchronizationOptions
- What properties to backpropagate from the FoldingEdgeState when master edges are updated to reflect changes made to its folding variant. This option sets the updateMasterOptions property on the created object.
- copyLabels - boolean
- A value indicating whether the labels of the master item should be recreated for the folding item. This option sets the copyLabels property on the created object.
- sourcePort - FoldingPortDefaults
- The FoldingPortDefaults to which updating the edges' sourcePort will be delegated to. This option either sets the value directly or recursively sets properties to the instance of the sourcePort property on the created object.
- targetPort - FoldingPortDefaults
- The FoldingPortDefaults to which updating the edges' targetPort will be delegated to. This option either sets the value directly or recursively sets properties to the instance of the targetPort property on the created object.
- labels - FoldingLabelDefaults
- The FoldingLabelDefaults to which updating the edges' labels will be delegated. This option either sets the value directly or recursively sets properties to the instance of the labels property on the created object.
- style - IEdgeStyle
- The IEdgeStyle to use for the folding edge. This option sets the style property on the created object.
- shareStyleInstance - boolean
- A value indicating whether the edge style instance should be shared referentially or cloned. This option sets the shareStyleInstance property on the created object.
Properties
Gets or sets a value indicating whether the labels of the master item should be recreated for the folding item.
Remarks
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.
Remarks
Gets or sets the FoldingLabelDefaults to which updating the edges' labels will be delegated.
Remarks
See Also
Gets or sets the FoldingPortDefaults to which updating the edges' sourcePort will be delegated to.
Remarks
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
Gets or sets the IEdgeStyle to use for the folding edge.
Remarks
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.
See Also
Gets or sets the FoldingPortDefaults to which updating the edges' targetPort will be delegated to.
Remarks
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
Gets or sets what properties to update the FoldingEdgeState with when a folding edge is updated to reflect changes made to its master items.
Remarks
See Also
Gets or sets what properties to backpropagate from the FoldingEdgeState when master edges are updated to reflect changes made to its folding variant.
Remarks
See Also
Methods
Creates the default IEdgeStyle to use in initializeState.
Returns
- ↪IEdgeStyle?
- The style or a clone of it depending on the shareStyleInstance property. This method may return
null
to indicate that the style should be obtained from the master edge.
Initializes the initial labels of the folding edge.
Remarks
Parameters
A map of options to pass to the method.
- state - FoldingEdgeState
- The view state whose labels should be synchronized.
- masterEdges - IListEnumerable<IEdge>
- The master edges that the folding edge represents.
See Also
Initializes the sourcePort and targetPort of the folding edge.
Remarks
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.Parameters
A map of options to pass to the method.
- 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.
Remarks
initialize
methods, only.Parameters
A map of options to pass to the method.
- state - FoldingEdgeState
- The state object to use for modifying the properties.
- masterEdges - IListEnumerable<IEdge>
- The collection of edges this folding edge represents.
See Also
Called by updateState to synchronize the labels if copyLabels is enabled.
Remarks
Parameters
A map of options to pass to the method.
- state - FoldingEdgeState
- The view state of the edge to change.
- masterEdges - IListEnumerable<IEdge>
- The master edges.
updateMasterEdges
(masterGraph: IGraph, state: FoldingEdgeState, masterEdges: IListEnumerable<IEdge>)Called in response to updateMasterEdges to optionally update the various properties of the master edges according to the state of the folding edge.
Parameters
A map of options to pass to the method.
- 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
updateMasterLabels
(masterGraph: IGraph, state: FoldingEdgeState, masterEdges: IListEnumerable<IEdge>)Updates the labels of the master edges to match the state of the folding edge.
Remarks
Parameters
A map of options to pass to the method.
- 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
updateMasterPorts
(masterGraph: IGraph, state: FoldingEdgeState, masterEdges: IListEnumerable<IEdge>)Called by updateMasterEdges to synchronize the ports via updateMasterPort.
Remarks
Parameters
A map of options to pass to the method.
- 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.
updatePorts
(state: FoldingEdgeState, foldingView: IFoldingView, foldingEdge: IEdge, masterEdges: IListEnumerable<IEdge>)Called by updateState to synchronize the ports.
Remarks
Parameters
A map of options to pass to the method.
- 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.
updateState
(state: FoldingEdgeState, foldingView: IFoldingView, foldingEdge: IEdge, masterEdges: IListEnumerable<IEdge>)Called by implementations of the IFoldingEdgeConverter interfaces to update the state of a folding edge in the folding view, once it has changed.
Remarks
Parameters
A map of options to pass to the method.
- 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.