documentationfor yFiles for HTML 2.6

FoldingManager

This class adds folding support to IGraph implementations.

Inheritance Hierarchy
FoldingManager

Remarks

Folding is an extension to the grouping concept. It adds the functionality of collapsing (closing) and expanding (opening) group nodes. Collapsing a group node means that its content is hidden and the group node itself becomes a normal (i.e. non-group or leaf) node.

In yFiles folding works with two graph instances: a master graph which is is the complete unfolded graph and the so called view graph which supports collapsing and expanding. This view graph is a modified and managed copy of the master graph. To make sure that the state of both graphs is correctly synchronized, yFiles provides the types FoldingManager and the IFoldingView.

The FoldingManager holds the master graph and synchronizes changes between the master graph and the different IFoldingViews. Therefore, it also serves as see factory for instances of IFoldingView. In turn, each IFoldingView instance manages an IGraph implementation that provides a view of a subset of the masterGraph where group nodes can appear as collapsed group nodes with their contents hidden. The views are synchronized with the masterGraph, but may contain additional view state.

Creating a graph where nodes can be collapsed and expanded
// first create the manager
const manager = new FoldingManager()
// the manager serves as factory to create views
const foldingView = manager.createFoldingView()
// each view contains a folding-enabled graph: the view graph
const viewGraph = foldingView.graph
// the view graph is the graph which should actually be displayed
graphComponent.graph = viewGraph

Collapsed group nodes in a view, as well as their adjacent edges, maintain a separate set of labels, ports, bends, and geometry. This view-local state is shared between all views that have been created by the same manager. It can be obtained and modified via the methods getFoldingEdgeState for folding edges and getFolderNodeState for folder nodes. The FoldingManager manages the varying states nodes and edges can have in different views and during different collapsed/expanded states of the nodes. Group nodes can appear as collapsed group nodes with their contents hidden. Edges that connect to elements inside collapsed group nodes can be configured to be represented by folding edges in the views. The process of converting one or more true edges from the masterGraph to zero or more folding edges can be customized, as well as the process of converting an expanded group node to a collapsed group node.

Related Reading in the Developer's Guide

Class FoldingManager's central role for folding support is discussed in the section Folding Revisited. A brief description of the class's API, set-up, etc. is given in the section Working with Folding.

Related Programming Samples

Graph Editor
Shows the graph editing features of the graph component.

Type Details

yfiles module
view-folding
yfiles-umd modules
view-folding, view-graphml, view
Legacy UMD name
yfiles.graph.FoldingManager

See Also

Constructors

Properties

Methods