Interface used by FoldingManager and IFoldingView which is responsible for managing the appearance of folder nodes.
Remarks
Examples
const defaultFolderNodeConverter = new FolderNodeConverter()
// set a gray rectangle to initialize a freshly collapsed group node with
defaultFolderNodeConverter.folderNodeDefaults.style = new ShapeNodeStyle({
stroke: 'gray',
})
// use the same instance for all folders
defaultFolderNodeConverter.folderNodeDefaults.shareStyleInstance = true
// configure label handling: copy the labels
defaultFolderNodeConverter.folderNodeDefaults.copyLabels = true
// initialize labels on a freshly collapsed group node with a default style
defaultFolderNodeConverter.folderNodeDefaults.labels.style =
new LabelStyle()
// share the same style instance
defaultFolderNodeConverter.folderNodeDefaults.labels.shareStyleInstance =
true
// copy all properties from the group node labels to the folder node labels
defaultFolderNodeConverter.folderNodeDefaults.labels.initializeOptions =
FoldingSynchronizationOptions.ALL
// copy all properties from the group node labels to the folder node labels
defaultFolderNodeConverter.folderNodeDefaults.labels.updateFoldingOptions =
FoldingSynchronizationOptions.LABEL_TEXT
// upon subsequent collapse and expand: only synchronize the text
defaultFolderNodeConverter.folderNodeDefaults.labels.updateMasterOptions =
FoldingSynchronizationOptions.LABEL_TEXT
// adjust the preferred size to the new text
defaultFolderNodeConverter.folderNodeDefaults.labels.autoAdjustPreferredSize =
true
manager.folderNodeConverter = defaultFolderNodeConverter
Type Details
- yFiles module
- view
See Also
Methods
initializeFolderNodeState
(state: FolderNodeState, foldingView: IFoldingView, viewNode: INode, masterNode: INode)Called by view implementations to initially create the appearance of a folder node.
Remarks
This method is called by the view to allow for initially creating the appearance of a local folder node in the view when it is included in the view for the first time. This can be used, e.g. to initialize the labels or style properties with the corresponding properties of the masterNode
.
By default, the state
contains some state from the masterNode
: including layout, style, and tag, as well as copies of the master ports. If you want to copy or add labels, this should be done here.
Note that changing the appearance has to be done on state
, directly.
Parameters
A map of options to pass to the method.
- state - FolderNodeState
- The folder node state to initialize.
- foldingView - IFoldingView
- The graph instance for which the folder node has been created.
- viewNode - INode
- The folder node instance in the view.
- masterNode - INode
- The node that represents the getMasterItem of the view state to change.
See Also
updateFolderNodeState
(state: FolderNodeState, foldingView: IFoldingView, viewNode: INode, masterNode: INode)Called by view implementations to change the appearance of a folder node.
Remarks
This method is called by the view to allow for adjusting the appearance of a local folder node in the view when the master node for it has changed properties. This can be used, e.g. to synchronize the label or style properties with the corresponding properties of the masterNode
.
Note that changing the appearance has to be done on state
.
Parameters
A map of options to pass to the method.
- state - FolderNodeState
- The folder node state to update.
- foldingView - IFoldingView
- The folding view for which the folder node can be changed.
- viewNode - INode
- The folder node instance in the view.
- masterNode - INode
- The node that represents the getMasterItem of the view state to change.
See Also
updateGroupNodeState
(state: FolderNodeState, foldingView: IFoldingView, viewNode: INode, masterNode: INode)Called by view implementations to adapt the appearance of a group node to changes of its closed state.
Remarks
This method is called by the view to allow for adjusting the appearance of a master to changes of its local folder node. This can be used, e.g. to synchronize the label or style properties with the corresponding properties from the state
to the masterNode
.
Note that changing the appearance has to be done to the masterNode
using the masterGraph which can be obtained from the foldingView
.
Parameters
A map of options to pass to the method.
- state - FolderNodeState
- The folder node state to get the properties from.
- foldingView - IFoldingView
- The folding view for which the folder node has been changed. The masterGraph can be retrieved from this instance.
- viewNode - INode
- The folder node instance in the view.
- masterNode - INode
- The node that represents the getMasterItem of the view state. This is the item to change.
See Also
Static Methods
Parameters
A map of options to pass to the method.
- updateFolderNodeState - function(FolderNodeState, IFoldingView, INode, INode):void
Called by view implementations to change the appearance of a folder node.
This property holds the implementation for updateFolderNodeState.
- updateGroupNodeState - function(FolderNodeState, IFoldingView, INode, INode):void
Called by view implementations to adapt the appearance of a group node to changes of its closed state.
This property holds the implementation for updateGroupNodeState.
- initializeFolderNodeState - function(FolderNodeState, IFoldingView, INode, INode):void
Called by view implementations to initially create the appearance of a folder node.
This property holds the implementation for initializeFolderNodeState.