I

IFolderNodeConverter

Interface used by FoldingManager and IFoldingView which is responsible for managing the appearance of folder nodes.
Inheritance Hierarchy

Remarks

Since createFoldingView creates views that can potentially contain nodes which have a different set of attributes, these attributes need to be determined somehow. Implementations of this interface are being called by the views to configure the appearance of these folder nodes.

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

See Also

Developer's Guide

API

FolderNodeConverter, folderNodeConverter, isInFoldingState

Members

No filters for this type

Methods

Called by view implementations to initially create the appearance of a folder node.

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.

abstract

Parameters

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

Developer's Guide
API
updateFolderNodeState
Called by view implementations to change the appearance of a folder node.

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.

abstract

Parameters

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

Developer's Guide
API
initializeFolderNodeState, updateFolderNodeState
Called by view implementations to adapt the appearance of a group node to changes of its closed state.

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.

abstract

Parameters

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

Developer's Guide
API
initializeFolderNodeState, updateFolderNodeState

Static Methods

static

Parameters

Return Value

IFolderNodeConverter