C

FolderNodeDefaults

A helper class that provides configuration options and helper methods that can be used in the context of initializing and updating folder nodes.
Inheritance Hierarchy

Remarks

This class can be used to manage and synchronize the state of folder nodes in implementations of the IFolderNodeConverter interfaces. Start by configuring the initializeOptions, updateFoldingOptions, and updateMasterOptions, as well as 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 the immediate labels at the node. Likewise, the ports property is used to synchronize the ports and their labels at the folder node. For custom requirements, this class may be sub-classed and implement a more customized synchronization behavior.

FolderNodeConverter delegates to an instance of this class.

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

FoldingManager

Members

Show:

Constructors

Creates a new instance, optionally using all relevant values from the provided nodeDefaults objects.

Parameters

nodeDefaults?: INodeDefaults
An optional INodeDefaults implementation from which to initialize this instance's values from.

Properties

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

Developer's Guide
API
FoldingLabelDefaults
Gets or sets what properties to initialize the FolderNodeState with when a folder node is initialized from its master node.
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 nodes' 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 FoldingPortDefaults to which updating the nodes' ports will be delegated to.
The default implementation will delegate the work of initializing and updating the state of the ports, accordingly. Updating the labels of the ports is the responsibility of the FoldingPortDefaults implementation.
final

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 = defaultFolderNodeConverter

See Also

API
copyLabels
Gets or sets a value indicating whether the node style instance should be shared referentially or cloned.
This applies to both the default style as well as the style of the master node or state from which the state or master node 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 folder node style should be shared; false otherwise.
Sets the initial size of the layout of the collapsed group node that will be assigned during the creation of the appearance of the collapsed group node.
Since the layout of an expanded group node normally encompasses the child nodes, it will have quite a large size. Since the contents of a collapsed group node are not visible, there is no need for the collapsed group node to encompass the area of its children. Thus the size can be different and most of the time should be smaller. Setting this property to non-null values will make the initial layout of the collapsed node become the given size assigned. The default is null, keeping the size of the expanded node.
conversionfinal
Gets or sets the INodeStyle to use for the collapsed group nodes.

Depending on the shareStyleInstance property, initializeState will assign a clone to the property or this instance. The default is null.

A value of null (the default) will leave the style property unmodified from the expanded node.

This value will be used during initializeState, only.

final
Gets or sets what properties to update the FolderNodeState with when a folder node 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

API
initializeOptions, updateMasterOptions
Gets or sets what properties to backpropagate from the FolderNodeState when a master node 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

API
updateFoldingOptions

Methods

Creates the default INodeStyle to use in initializeState.
Initializes the initial labels of the collapsed group node.
This implementation initializes and creates the labels according to copyLabels, only.
protected

Parameters

state: FolderNodeState
The node view state whose labels should be synchronized.
masterNode: INode
The master node that the folder node represents.

See Also

API
labels, initializeState, getFolderNodeState
Initializes the layout of the collapsed group node.
This implementation will set the bounds of the nodes in such a way that the size will be that of the size property (if non-null)
protected

Parameters

state: FolderNodeState
The node view state whose layout should be synchronized.
masterNode: INode
The master node that is represented by the local group node.
Called by initializeState to initialize the appearance of the representatives of the master ports at the collapsed group node.
This method will delegate to the ports' initializeState implementation to initialize the state of the ports.
protected

Parameters

state: FolderNodeState
The node view state whose ports should be synchronized.
masterNode: INode
The master group node.
Called by implementations of the IFolderNodeConverter to initialize the state of a folder node in the folding view.
Typically the initializeState method will have been called once for each node, before updateState will be called upon further updates. This implementation delegates to the various initialize methods, only.

Parameters

state: FolderNodeState
The state object to use for modifying the properties.
masterNode: INode
The node this folder node represents.

See Also

API
updateState
Callback that updates the immediate labels of the node during updateState.
This implementation updates the labels according to copyLabels, only. Folding labels at the ports of the node will be updated by the ports implementation in updatePorts
protected

Parameters

state: FolderNodeState
The state object to write the values to
masterNode: INode
The node this folder node represents.

See Also

API
labels
Updates the labels of the master group node to match the state of the folder node.
Depending on the copyLabels this will use the labels property to update the master.
protected

Parameters

masterGraph: IGraph
The graph to use for modifying the master labels.
state: FolderNodeState
The state of the folder node and its labels to synchronize with.
masterNode: INode
The master node to synchronize.

See Also

API
copyLabels
Called in response to updateGroupNodeState to optionally update the various properties on the master group node according to the state of the folder node.

Parameters

state: FolderNodeState
The state of the folder node.
masterGraph: IGraph
The master graph to use for modifying the masterNode.
masterNode: INode
The master group node to potentially synchronize the state.

See Also

API
updateMasterOptions
Updates the ports of the master group node to match the state of the folder node.
This will use the ports property to update the master.
protected

Parameters

masterGraph: IGraph
The graph to use for modifying the master ports.
state: FolderNodeState
The state of the folder node and its ports to synchronize with.
masterNode: INode
The master node to synchronize.
Called by updateState to update the appearance of the representatives of the master ports at the collapsed group node.
This method will delegate to ports' updateState implementation to update each port.
protected

Parameters

state: FolderNodeState
The node view state whose ports should be synchronized.
masterNode: INode
The master group node.
Called by implementations of the IFolderNodeConverter to update the state of a folder node in the folding view, once it has changed.
Typically the initializeState method will have been called at least once for each node, before this method is called to further update the state. This implementation delegates to the update methods, only.

Parameters

state: FolderNodeState
The state object to use for modifying the properties.
masterNode: INode
The node this folder node represents.

See Also

API
initializeState