A helper class that provides configuration options and helper methods that can be used in the context of initializing and updating folding ports.
Inheritance Hierarchy
Remarks
This class can be used to manage and synchronize the state of folder node ports in implementations of the IFolderNodeConverter interface and the source and target node ports 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 property can be configured to recursively define the behavior for labels at the ports. For custom requirements, this class may be sub-classed and implement a more customized synchronization behavior.
Examples
const defaultFolderNodeConverter = new FolderNodeConverter()
defaultFolderNodeConverter.folderNodeDefaults.ports.copyLabels = true
// initialize: copy all label properties (the default)
// but update only the text after initialization
defaultFolderNodeConverter.folderNodeDefaults.ports.labels.updateFoldingOptions =
FoldingSynchronizationOptions.LABEL_TEXT
defaultFolderNodeConverter.folderNodeDefaults.ports.updateMasterOptions =
FoldingSynchronizationOptions.LABEL_TEXT
defaultFolderNodeConverter.folderNodeDefaults.ports.copyLabels = true
// copy all port properties upon initialization (the default)
// but update only the layout afterward
defaultFolderNodeConverter.folderNodeDefaults.ports.updateFoldingOptions =
FoldingSynchronizationOptions.LAYOUT
defaultFolderNodeConverter.folderNodeDefaults.ports.updateMasterOptions =
FoldingSynchronizationOptions.LAYOUT
manager.folderNodeConverter = defaultFolderNodeConverterSee Also
Members
Show:
Constructors
Creates a new instance of this type, optionally configuring the values from the given IPortDefaults object.
Creates a new instance of this type, optionally configuring the values from the given IPortDefaults object.
Parameters
- defaults?: IPortDefaults
- The optional IPortDefaults to initialize the properties of this new instance from.
Properties
Gets or sets whether to copy the labels from the master item to the view item.
Gets or sets whether to copy the labels from the master item to the view item.
This setting determines how to delegate the work of synchronizing labels to the labels instance. Set the value to false if you need to implement your own logic. Otherwise, this feature can be used to initially create a copy of the labels of the master (if any) and subsequently synchronize the labels with changes to the master.
The default is false for new instances of this type.
final
See Also
Gets or sets what properties to initialize the FoldingPortState with when a port is initialized from its master port.
Gets or sets what properties to initialize the FoldingPortState with when a port is initialized from its master port.
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 ports' labels will be delegated.
Gets or sets the FoldingLabelDefaults to which updating the ports' 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 the IPortLocationModelParameter to use for initializing the folding ports.
Gets or sets the IPortLocationModelParameter to use for initializing the folding ports.
A value of
null (the default) will leave the model parameter property unmodified.final
This applies to both the default style as well as the style of the master port or state from which the state or master port 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
Gets or sets the IPortStyle to use for initializing the folding ports.
Gets or sets the IPortStyle to use for initializing the folding ports.
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
Gets or sets what properties to update the FoldingPortState with when a folding port is updated to reflect changes made to its master item.
Gets or sets what properties to update the FoldingPortState with when a folding port is updated to reflect changes made to its master item.
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
Gets or sets what properties to backpropagate from the FoldingPortState when a master port is updated to reflect changes made to its folding variant.
Gets or sets what properties to backpropagate from the FoldingPortState when a master port is 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
Methods
Creates the default IPortStyle to use in initializeState.
Creates the default IPortStyle to use in initializeState.
This implementation initializes the immediate properties of the FoldingPortState.
This implementation initializes the immediate properties of the FoldingPortState.
The implementation uses initializeOptions to determine which values to copy from the master port.
protected
Parameters
- state: FoldingPortState
- The state object to write the values to
- masterPort: IPort
- A single master port that is associated with this folding port and used to initialize it.
See Also
Callback that initializes the labels during initializeState.
Callback that initializes the labels during initializeState.
This implementation initializes and creates the labels according to copyLabels, only.
protected
Parameters
- state: FoldingPortState
- The state object to write the values to
- masterPort: IPort
- The single master port associated with this folding port.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to initialize the state of a port in the folding view.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to initialize the state of a port in the folding view.
Typically the initializeState method will have been called once for each port, before updateState will be called upon further updates. This implementation calls, initializeFoldingPortState, and initializeLabels with the first master port, only.
Parameters
- state: FoldingPortState
- The state object to use for modifying the properties.
- masterPorts: IEnumerable<IPort>
- The collection of ports this folding port represents.
See Also
API
- updateState
Callback that updates the labels during updateState.
Callback that updates the labels during updateState.
This implementation updates the labels according to copyLabels, only.
protected
Parameters
- state: FoldingPortState
- The state object to write the values to
- masterPort: IPort
- The single master port associated with this folding port.
Updates the labels of the master ports to match the state of the folding variants.
Updates the labels of the master ports to match the state of the folding variants.
protected
Parameters
- masterGraph: IGraph
- The graph to use for modifying the master labels.
- state: FoldingPortState
- The state of the folding port and its labels to synchronize with.
- masterPort: IPort
- The master port to synchronize.
See Also
API
- copyLabels
Updates a single master port to match the state of the folding port.
Updates a single master port to match the state of the folding port.
This will update the properties according to the updateMasterOptions and delegate to updateMasterLabels to update the labels of the port.
Parameters
- masterGraph: IGraph
- The graph to use for modifying the master port.
- state: FoldingPortState
- The state of the port to synchronize with.
- masterPort: IPort
- The master port to synchronize.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to update the state of a port in the folding view, once it has changed.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to update the state of a port in the folding view, once it has changed.
Typically the initializeState method will have been called at least once for each port, before this method is called to further update the state. This implementation calls the updateLabels method, passing the first master port, only.
Parameters
- state: FoldingPortState
- The state object to use for modifying the properties.
- masterPorts: IEnumerable<IPort>
- The collection of ports this folding port represents.