A helper class that provides configuration options and helper methods that can be used in the context of initializing and updating folding labels.
Inheritance Hierarchy
Remarks
This class can be used to manage and synchronize the state of folder node labels in implementations of the IFolderNodeConverter interface, the labels of folding edges in implementations of the IFoldingEdgeConverter interfaces and the labels of the corresponding ports of both the folder nodes and the folding edges. Start by configuring the initializeOptions, updateFoldingOptions, and updateMasterOptions, to match your synchronization requirements and use the style and other properties to set a default value for the initialization. For custom requirements, this class may be sub-classed and implement a more customized synchronization behavior.
See Also
API
- FoldingManager, labels, labels, labels
Members
Show:
Constructors
Creates a new instance of this type, optionally configuring the values from the given ILabelDefaults object.
Creates a new instance of this type, optionally configuring the values from the given ILabelDefaults object.
Parameters
- defaults?: ILabelDefaults
- The optional ILabelDefaults to initialize the properties of this new instance from.
Properties
Gets or sets whether the preferredSize should automatically be updated when the text is changed.
Gets or sets whether the preferredSize should automatically be updated when the text is changed.
If disabled, the size will be obtained from the master item. If the style differs, it is often a good idea to update the preferredSize.
final
Gets or sets what properties to initialize the FoldingLabelState with when a folding label is added to the owner for the first time.
Gets or sets what properties to initialize the FoldingLabelState with when a folding label is added to the owner for the first time.
The default value is ALL, causing the items to be exact copies of their master items.
conversionfinal
Gets or sets the ILabelModelParameter to use when initializing the folding labels.
Gets or sets the ILabelModelParameter to use when initializing the folding labels.
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 label or state from which the state or master label 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 ILabelStyle to use when initializing the folding labels.
Gets or sets the ILabelStyle to use when initializing the folding labels.
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 FoldingLabelState with when a folding label is updated to reflect changes made to its master item.
Gets or sets what properties to update the FoldingLabelState with when a folding label 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 FoldingLabelState when a master label is updated to reflect changes made to its folding variant.
Gets or sets what properties to backpropagate from the FoldingLabelState when a master label 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
Simple callback method that delegates to addLabel
Simple callback method that delegates to addLabel
protected
Parameters
- ownerState: FoldingLabelOwnerState
- The state to use for adding the label
- masterLabel: ILabel
- The label to create a representative for.
- text: string
- The text to use for the label.
- parameter: ILabelModelParameter
- The optional parameter to use.
- style: ILabelStyle
- The optional style to use
- preferredSize: Size
- The optional preferred size to use.
- tag: any
- The optional tag to use.
Return Value
- FoldingLabelState
- The label to create. May be
nullif the label was omitted.
Creates the default ILabelStyle to use in initializeState.
Creates the default ILabelStyle to use in initializeState.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to initialize the state of a label in the folding view.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to initialize the state of a label in the folding view.
Typically the initializeState method will be called once for each label, before updateState will be called upon further updates. This implementation uses initializeOptions and getDefaultStyleInstance to determine the parameters and then calls addLabel to create and initialize the label.
Parameters
- state: FoldingLabelOwnerState
- The state object to use for initializing the labels.
- masterLabel: ILabel
- The label this folding label represents.
See Also
API
- updateState
Called in response to updateGroupNodeState and updateMasterEdges to optionally update the various properties on the master label according to the state of the folding label.
Called in response to updateGroupNodeState and updateMasterEdges to optionally update the various properties on the master label according to the state of the folding label.
Parameters
- masterGraph: IGraph
- The master graph to use for modifying the
masterLabel. - state: FoldingLabelState
- The state of the folding label.
- masterLabel: ILabel
- The master label to potentially synchronize the state for.
See Also
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to update the state of a label in the folding view, once it has changed.
Called by implementations of the IFolderNodeConverter and IFoldingEdgeConverter interfaces to update the state of a label in the folding view, once it has changed.
Typically the initializeState method will have been called at least once for each label, before this method is called to further update the state. This implementation updates the state according to updateFoldingOptions.
Parameters
- state: FoldingLabelState
- The state object to use for modifying the properties.
- masterLabel: ILabel
- The master label this label represents.